ios iOS上的RTMP流

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6042353/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 19:58:43  来源:igfitidea点击:

RTMP stream on iOS

iphoneiosvideolivertmp

提问by cpprulez

I have to make an iOS app which plays a live video stream from a camera. I know that the iPhone only supports Live HTTP stream, but unfortunately it comes with a delay of about 6-10 seconds, which is far from my needs - I need a real time view. MJPEG stream is also not an option, because it generates a huge traffic. So what remains is an RTMP stream, but iOS cannot play it natively :(( I've heard of rtmpdump for iPhone, but I couldn't get it working. Has anyone succeeded in playing RTMP video on iOS? Any suggestions on how to do it are greatly appreciated!

我必须制作一个 iOS 应用程序,它可以播放来自相机的实时视频流。我知道 iPhone 只支持 Live HTTP 流,但不幸的是它有大约 6-10 秒的延迟,这与我的需求相去甚远——我需要实时查看。MJPEG 流也不是一种选择,因为它会产生巨大的流量。所以剩下的是一个 RTMP 流,但 iOS 无法在本地播放它:((我听说过 iPhone 的 rtmpdump,但我无法让它工作。有没有人成功地在 iOS 上播放 RTMP 视频?有关如何播放的任何建议不胜感激!

采纳答案by Steven Kramer

I'm pretty sure mediastreamsegmenter can be set up for slightly lower latencies (perhaps as low as 3 seconds).

我很确定 mediastreamsegmenter 可以设置为稍低的延迟(可能低至 3 秒)。

Any other solution would need an advanced-ish transport, demux and video codec, that can handle RTP-over-HTTP and something at least equal to MPEG-2 video in compression efficiency. Those things are hard to come by for free (I know of only GPL-encumbered ones).

任何其他解决方案都需要一个先进的传输、解复用器和视频编解码器,它可以处理 RTP-over-HTTP 和压缩效率至少等于 MPEG-2 视频的东西。这些东西很难免费获得(我只知道受 GPL 限制的东西)。

And even those would have latencies of at least 1 second as far as I can tell.

据我所知,即使是那些也会有至少 1 秒的延迟。

回答by ron garay

I've successfully used rtmpdump for streaming on iOS. You would have to implement the audio/video message decode as the code does not provide that. Also AMF3 is not fully implemented so you might have to deal with that too. For the most part it's just the rtmp.c file. The handleInvoke and handleCtrl methods is where the action is, along with the method that handles the packet (forgot which it is).

我已经成功地使用 rtmpdump 在 iOS 上进行流式传输。您必须实现音频/视频消息解码,因为代码没有提供。此外,AMF3 还没有完全实现,因此您可能也必须处理它。在大多数情况下,它只是 rtmp.c 文件。handleInvoke 和 handleCtrl 方法是操作所在的位置,以及处理数据包的方法(忘记它是哪个)。