简体   繁体   English

将iphone相机直播到媒体服务器的最佳方式是什么?

[英]What's the best way of live streaming iphone camera to a media server?

According to this What Techniques Are Best To Live Stream iPhone Video Camera Data To a Computer? 根据这种技术最适合将iPhone视频摄像机数据直播到计算机? is possible to get compressed data from iphone camera, but as I've been reading in the AVFoundation reference you only get uncompressed data. 可以从iphone相机获取压缩数据,但正如我在AVFoundation参考中读到的那样,你只能得到未压缩的数据。

So the questions are: 所以问题是:

1) How to get compressed frames and audio from iPhone's camera? 1)如何从iPhone的相机获取压缩帧和音频?

2) Encoding uncompressed frames with ffmpeg's API is fast enough for real-time streaming? 2)用ffmpeg的API编码未压缩的帧对于实时流是否足够快?

Any help will be really appreciated. 任何帮助将非常感激。

Thanks. 谢谢。

You most likely already know.... 你很可能已经知道....

1) How to get compressed frames and audio from iPhone's camera? 1)如何从iPhone的相机获取压缩帧和音频?

You can not do this. 你不能做这个。 The AVFoundation API has prevented this from every angle. AVFoundation API已经从各个角度防止了这种情况。 I even tried named pipes, and some other sneaky unix foo. 我甚至尝试过命名管道和其他一些偷偷摸摸的unix foo。 No such luck. 没有这样的运气。 You have no choice but to write it to file. 你别无选择,只能把它写到文件中。 In your linked post a user suggest setting up the callback to deliver encoded frames. 在您的链接帖子中,用户建议设置回调以提供编码的帧。 As far as I am aware this is not possible for H.264 streams. 据我所知,这对H.264流是不可能的。 The capture delegate will deliver images encoded in a specific pixel format. 捕获代表将提供以特定像素格式编码的图像。 It is the Movie Writers and AVAssetWriter that do the encoding. 正是Movie Writers和AVAssetWriter进行编码。

2) Encoding uncompressed frames with ffmpeg's API is fast enough for real-time streaming? 2)用ffmpeg的API编码未压缩的帧对于实时流是否足够快?

Yes it is. 是的。 However, you will have to use libx264 which gets you into GPL territory. 但是,您必须使用libx264才能进入GPL领域。 That is not exactly compatible with the app store. 这与app商店并不完全兼容。

I would suggest using AVFoundation and AVAssetWriter for efficiency reasons. 出于效率原因,我建议使用AVFoundation和AVAssetWriter。

I agree with Steve. 我同意史蒂夫。 I'd add that on trying with Apple's API, you're going to have to do some seriously nasty hacking. 我想尝试使用Apple的API时,你将不得不做一些严重讨厌的黑客行为。 AVAssetWriter by default spends a second before spilling its buffer to file. 默认情况下,AVAssetWriter会在将其缓冲区溢出到文件之前花费一秒钟。 I haven't found a way to change that with settings. 我还没有找到一种方法来改变设置。 The way around that seems to be to force small file writes and file close with the use of multiple AVAssetWriters. 通过这种方式似乎是通过使用多个AVAssetWriters来强制小文件写入和文件关闭。 But then that introduces lots of overhead. 但那会带来很多开销。 It's not pretty. 它不漂亮。

Definitely file a new feature request with Apple (if you're an iOS developer). 绝对向Apple提交新的功能请求(如果您是iOS开发人员)。 The more of us that do, the more likely they'll add some sort of writer that can write to a buffer and/or to a stream. 我们做的越多,他们就越有可能添加某种可以写入缓冲区和/或流的编写器。

One addition I'd make to what Steve said on the x264 GPL issue is that I think you can get a commercial license for that which is better than GPL, but of course costs you money. 我对史蒂夫在x264 GPL问题上所说的一个补充是,我认为你可以获得比GPL更好的商业许可,但当然要花钱。 But that means you could still use it and get pretty OK results, and not have to open up your own app source. 但这意味着你仍然可以使用它并获得相当不错的结果,而不必打开自己的应用程序源。 Not as good as an augmented Apple API using their hardware codecs, but not bad. 不如使用硬件编解码器的扩充Apple API好,但也不错。

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

相关问题 如何将从iPhone相机拍摄的视频发送到服务器进行直播? - How to send the video captured from iPhone's camera to a server for live streaming? 什么技术最适合将iPhone视频摄像机数据直播到计算机? - What Techniques Are Best To Live Stream iPhone Video Camera Data To a Computer? 如何在 iphone 中实现实时摄像头流式传输? - How to implement live camera streaming in iphone? 可以使用RTSP(实时流协议)将实时视频流从iPhone发送到媒体服务器吗? - Can RTSP (Real Time Streaming Protocol) be used to send live video stream from iPhone to a media server? 在iPhone上存储数据的最佳方法是什么? - What's the best way to store data on iPhone? iPhone:显示“报告”的最佳方法是什么? - iPhone: what's the best way to display a "report'? 从服务器端数据库到iPhone进行单向同步的最佳方法是什么? - What's the best way to do one-way synching from a server-side database to iPhone? 如何从服务器在iPhone中进行实时流式传输? - how to do live streaming in iphone from the server? 彩信视频流在iPhone上? (Microsoft Media Server) - mms video streaming on iPhone? (Microsoft Media Server) 从wifi h.264相机直接直播到iPhone - live streaming from wifi h.264 camera directly to iPhone
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM