Need help transcoding Red5 RTMP stream to MPEG2-TS

2019-05-28 19:31发布

问题:

Me and my friend are going to make live shows and for that purpose I have set up a Red5 server on my old 2006 Intel Core Duo Mac mini running Mac OS X Snow Leopard Server 10.6.8.

I use Flash Media Live Encoder to broadcast to Red5's oflaDemo application and the stream works great, except for the fact that I want the stream to work with iOS. I am developing an app for it, but I still need to convert my stream to Apple's HTTP Live Streaming protocol for it to work. Can anybody help me convert the RTMP stream to MPEG2-TS, because that's the format that mediastreamsegmenter supports? I already have Apple's HTTP Live Streaming Tools installed on the server, so the segmenter's not a problem.

FFmpeg doesn't work, at least not with the code I found here. With it a always get an "Operation not permitted" error. Xuggler doesn't work, not even with a Linux box. Can anybody please help me? I'd really, really appreciate it.

-Reynir Aron

回答1:

This invocation is what I successfully use to convert a red5 live stream into m3u8 HLS format with TS files:

ffmpeg -re -i "rtmp://domain/oflaDemo/test live=1" -hls_time 10 -hls_wrap 7 -hls_list_size 3 -f hls test.m3u8

Option "-hls_list_size 3" takes care there are 3 TS files listed in the m3u8 file. Option "-hls_wrap 7" takes care the .TS files are automatically removed after 7 files.

So there is no need for other tools, ffmpeg can do the complete job for you. If you do not specify option "-hls_wrap" the complete stream will be saved in TS files of 10 seconds (-hls_time 10).

By the way, I use ffmpeg 1.2.1 on CentOS v5.8 compiled with rtmpdump v2.3 and the latest x264 lib from git://git.videolan.org/x264.git with the following configuration options:

./configure --enable-librtmp --enable-libx264 --enable-gpl


回答2:

If you'd like to continue using Red5 for your streaming, you could try my HLS plugin, the source may be found here: https://github.com/Red5/red5-hls-plugin