Activity › Forums › Compression Techniques › Convert live rtmp stream to hls
-
Convert live rtmp stream to hls
Posted by Todd Poole on November 14, 2013 at 11:44 pmI have been reading and testing different methods of downloading a live rtmp stream and “pushing” it thru some conversion to use as hls with no real luck. I am able to download the live stream with rtmpdump no problem. I could even save the file but this does me no good. I need to be able to take the downloading stream and convert, transcode or encode (not sure what to call it) the stream to HLS. Any advice or help appreciated.
ThanksLuis Arredondo replied 11 years, 9 months ago 5 Members · 13 Replies -
13 Replies
-
Jim Sustacek
November 15, 2013 at 1:14 pmHere’s what I’ve used:
ffmpeg -loglevel quiet -i rtmp://flash.server.com/vod/_definst_/streamname -c:v libx264 -profile:v baseline -level 3.1 -c:a aac -strict experimental -f mpegts - | ffmpeg -i - -c copy -map 0 -f segment -segment_list ffmpeg.m3u8 -segment_format mpegts -segment_time 10 ffmpeg%03d.tsI haven’t really used it live, but I assume if you write those files (.m3u8 and .ts) to a public web server directory, you can embed that .m3u8 file or just link it directly for iOS devices.
-
Todd Poole
November 15, 2013 at 3:16 pmThank you. I will give this a try. I am successful in downloading the stream with rtmpdump but have been unable to “push” the stream into something that outputs HLS. I know it’s possible I just can’t get it.
Thanks again -
Jim Sustacek
November 15, 2013 at 8:22 pmI guess my original rationale was that I could transcode with one process, and then just segment with the other. But I suppose you could easily combine them. Of course, if your source stream is already H.264/AAC, maybe you could eliminate the transcoding altogether?
If the original poster wants to expand upon his purpose, that might help too.
-
Todd Poole
November 15, 2013 at 9:19 pmMy intention is to stream a live rtmp stream to a roku device. After much reading and trying different things I have not been completely successful. I know it’s possible and probably not as hard as I have made it. When I started on the idea I came across rtmpdump. I was able to connect and download the stream to a file (mp4). This was a good start but I discovered even though roku recognizes mp4, it can not play it until the download is complete. I then discovered HLS. I know ffmpeg has the capability to download the rtmp and push the flv file from rtmp to hls which roku can play. That is where I am lost. I have looked at ffmpeg but can’t get something right.
Thanks for asking -
Todd Poole
November 16, 2013 at 12:50 pmHere is the line I have currently. I know the rtmp server is correct and the file name is xoaaohmeuajfeyf. When I execute the command the error states
ffmpeg.exe -i rtmp://ny.premiumcdnlive.com/edge/xoaaohmeuajfeyf -re -qscale 0 -acodec copy -vcodec copy -f HLS rtmp://localhost/live/stream
rtmp server sent error
rtmp server requested close
rtmp://ny.premiumcdnlive.com/edge: unknown error occurredWhen I run it thru rtmpdump I have a token value for security purposes. I’m not sure how to pass the token in ffmpeg or if is even required. The rtmpdump goes thru and begins downloading the stream no problem. Any ideas?
Thanks -
Jim Sustacek
November 16, 2013 at 8:31 pmWhat’s your working rtmpdump command? It sounds like the RTMP server requires this security token. Can it simply be passed as part of the RTMP URL?
-
Todd Poole
November 16, 2013 at 8:35 pmThe working rtmpdump is:
c:rtmpfilesrtmpdump.exe -v -r rtmp://live.iguide.to/edge -y 0ofj5z5lab0b3ox -W https://player.ilive.to/secure_player_ilive_z.swf –token “I8772LDKksadhGHGagf#” –live -p “https://www.ilive.to/view/49959/watch-live-SIC_Noticias-streaming-channel-for-free” -o c:output.mp4
As it goes, the stream downloads and saves but don’t need to save it but transcode it to HLS.
Thanks
-
Reuben Martin
November 17, 2013 at 1:55 amTranscoding alone is not enough. You need to be able to serve it correctly to be of any use.
There is a nginx module I use that might work for you. It supports both rtmp and hls. You can push / pull rtmp as well as convert the source streams to hls. (Hopefully is will soon support MPEG-DASH as well.)
https://github.com/arut/nginx-rtmp-module
-
Todd Poole
November 17, 2013 at 11:53 amThanks for the info. I have been looking at that as a possibility.
Reply to this Discussion! Login or Sign Up