FORUMS: list search recent posts

Convert live rtmp stream to hls

COW Forums : FFmpeg

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Todd Poole
Convert live rtmp stream to hls
on Nov 14, 2013 at 11:44:10 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


Return to posts index

Jim Sustacek
Re: Convert live rtmp stream to hls
on Nov 15, 2013 at 1:14:19 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.


Return to posts index

Todd Poole
Re: Convert live rtmp stream to hls
on Nov 15, 2013 at 3:16:12 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


Return to posts index


Lou Logan
Re: Convert live rtmp stream to hls
on Nov 15, 2013 at 8:08:35 pm

Why use two ffmpeg processes instead of one?


Return to posts index

Jim Sustacek
Re: Convert live rtmp stream to hls
on Nov 15, 2013 at 8:22:57 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.


Return to posts index

Todd Poole
Re: Convert live rtmp stream to hls
on Nov 15, 2013 at 9:19:57 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


Return to posts index


Todd Poole
Re: Convert live rtmp stream to hls
on Nov 16, 2013 at 12:50:59 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


Return to posts index

Jim Sustacek
Re: Convert live rtmp stream to hls
on Nov 16, 2013 at 8:31:40 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?


Return to posts index

Todd Poole
Re: Convert live rtmp stream to hls
on Nov 16, 2013 at 8:35:59 pm

The working rtmpdump is:

c:rtmpfilesrtmpdump.exe -v -r rtmp://live.iguide.to/edge -y 0ofj5z5lab0b3ox -W http://player.ilive.to/secure_player_ilive_z.swf --token "I8772LDKksadhGHGagf#" --live -p "http://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


Return to posts index


Reuben Martin
Re: Convert live rtmp stream to hls
on Nov 17, 2013 at 1:55:52 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


Return to posts index

Todd Poole
Re: Convert live rtmp stream to hls
on Nov 17, 2013 at 11:53:34 am

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


Return to posts index

Luis Arredondo
Re: Convert live rtmp stream to hls
on Aug 18, 2014 at 2:35:59 pm

Hello Todd, were you able to stream in Roku, I'm trying to do that now


Return to posts index


Todd Poole
Re: Convert live rtmp stream to hls
on Aug 18, 2014 at 3:28:14 pm

Luis, I was able to get live rtmp streaming to work. Not sure what you are dumping, I was pulling down live shows from websites on net. After much research and many rewrites, I got scripts to run rtmpdump and then feed that into ffmpeg. I first was using PlayOn Media Server with my Roku but I thought I might try to develop my own for my personal use. I felt PlayOn was slow or bogged down with other parts that I didn't need. I download a free server (Abyss) and installed it. I then (after research and reading) discovered PHP and how to make the Roku channel interact with the server. Not being a professional code writer but with some experience, I think Brightscript leaves much to be desired. When a particular channel is picked, it fires the PHP script on the server which runs the rtmpdump (I have variables set up in the script depending on channel). The rtmp feeds the ffmpeg which converts to hls (m3u8). I setup a delay up so it would give time for dump and conversion to start before the Roku tried to stream and give me an error message. My big obstacle now for the Roku is stopping and deleting the unused files after you exit the channel. I have a script that stops rtmpdump and deletes the files if the user press the back on the remote but the makers of Roku have the Home button that can not be programmed. The action of the Home button goes straight to home screen. I can't figure out how to manipulate that action. So if one of my kids hits the Home button instead of back button, the server keeps pulling the stream until I go to the server and manually run the cleanup script. I would be happy to share with you what I have done but would rather not post it on a message board.


Return to posts index

Luis Arredondo
Re: Convert live rtmp stream to hls
on Aug 20, 2014 at 9:34:59 pm

Thanks Todd, how can I send you a private message. I'm sorry I'm new to this forum.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]