Creative Communities of the World Forums

The peer to peer support community for media production professionals.

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 pm

    I 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.
    Thanks

    Luis Arredondo replied 11 years, 9 months ago 5 Members · 13 Replies
  • 13 Replies
  • Jim Sustacek

    November 15, 2013 at 1:14 pm

    Here’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.ts

    I 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 pm

    Thank 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

  • Lou Logan

    November 15, 2013 at 8:08 pm

    Why use two ffmpeg processes instead of one?

  • Jim Sustacek

    November 15, 2013 at 8:22 pm

    I 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 pm

    My 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 pm

    Here 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 occurred

    When 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 pm

    What’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 pm

    The 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 am

    Transcoding 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 am

    Thanks for the info. I have been looking at that as a possibility.

Page 1 of 2

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy