简体   繁体   English

使用FFMpeg将音频文件从iPhone实时传输到互联网

[英]live streaming video file from iphone to internet using FFMpeg

i am trying to live streaming some video content from iphone to the internet (or server). 我正在尝试将一些视频内容从iPhone流式传输到互联网(或服务器)。 I have read the following post (http://stackoverflow.com/questions/4084811/iphone-http-live-streaming-without-any-server-side-processing) 我已阅读以下帖子(http://stackoverflow.com/questions/4084811/iphone-http-live-streaming-without-any-server-side-processing)

And i understand i can first capture the images and audio into file then send it out to the internet. 我知道我可以先将图像和音频捕获到文件中,然后将其发送到互联网。 But i really have no idea how to start the work on constantly send out these video files. 但是我真的不知道如何开始不断发送这些视频文件。

I understand i can use ffmpeg to do the streaming part. 我了解我可以使用ffmpeg进行流式处理。 after long researching i can only found a sample program called iFrameExtractor using FFmpeg library. 经过长期研究,我只能使用FFmpeg库找到一个名为iFrameExtractor的示例程序。 But the sample only shows how to use ffmpeg to playback a video file, but no sample on how to use the live streaming function in ffmpeg... 但是该示例仅显示了如何使用ffmpeg播放视频文件,而没有提供有关如何在ffmpeg中使用直播功能的示例...

Can anyone provide a direction or tutorial how to live streaming a video file using ffmpeg? 谁能提供指导或教程,如何使用ffmpeg实时流式传输视频文件? or anyone can suggest other ways to solve this problem? 还是有人可以建议其他方法来解决此问题? i am sure lots of people want to know how to do that. 我相信很多人都想知道该怎么做。

I have done a similar simple demo work, here is how it works: 我已经完成了类似的简单演示工作,这是它的工作方式:

iOS side iOS端
1. using ffmpeg or other sdk to capture small video file 1.使用ffmpeg或其他sdk捕获小视频文件
2. send them to server with timestamp with order 2.将它们按顺序发送到带有时间戳的服务器

server side 服务器端
1. received file 1.收到文件
2. convert them to ts format with a ts file 2.使用ts文件将其转换为ts格式
3. write a html to show ts file 3.写一个HTML来显示ts文件

how to view them 如何查看它们
access that html with safari 使用safari访问该html

For streaming, you might want to use ffserver . 对于流式传输,您可能要使用ffserver That's a command line tool released by the FFmpeg project and it handles streaming. 那是FFmpeg项目发布的命令行工具,它可以处理流媒体。

Not directly answering your question but have you considered NAT / firewall issues? 没有直接回答您的问题,但是您是否考虑了NAT /防火墙问题?

Even if you are able to successfully run a HLS (or whatever) server on your iPhone AND your phone is connected to the Internet, it does not necessarily mean the client can connect to it, because of NAT, firewalls etc. This is an important consideration if your iPhone app is going to be used over 3G. 即使您能够在iPhone上成功运行HLS(或任何其他类型)服务器并且您的手机已连接到Internet,也不一定意味着客户端可以连接到它,因为NAT,防火墙等。这很重要请考虑您的iPhone应用程序是否要在3G上使用。

You are probably better off writing a webserver to which the iPhone first uploads unprocessed video frames and then you transcode and run a Media server on your webserver. 您最好编写一个Web服务器,iPhone首先将未处理的视频帧上传到该Web服务器,然后对您的Web服务器上的代码服务器进行代码转换和运行。 This would save iPhone's battery life, help avoid porting ffserver on iPhone (it's not easy), and of course allow you to deploy robust media servers on your webserver. 这将节省iPhone的电池寿命,有助于避免在iphone上移植ffserver(这并不容易),当然还允许您在Web服务器上部署功能强大的媒体服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM