Audio/video stream recording forums (http://stream-recorder.com/forum/index.php)
-   Re-broadcasting streaming media (http://stream-recorder.com/forum/forumdisplay.php?f=38)
-   -  

Use ffserver, ffmpeg, rtmpdump, VLC to convert live RTMP stream into UDP multicast

(http://stream-recorder.com/forum/showthread.php?t=9529)

secretsquirrel 07-07-2011 04:41 PM

Use ffserver, ffmpeg, rtmpdump, VLC to convert live RTMP stream into UDP multicast


 
I've been banging my head against the desk for a while now with this problem, but hopefully one of you can help me. I'm attempting to use rtmpdump and VLC to convert (redirect) a couple of live RTMP streams into UDP multicasts.

When I try
Code:

rtmpdump.exe -v -r rtmp://stream2.france24.yacast.net/france24_live/en -a france24_live/en -W http://www.france24.com/en/sites/all/modules/maison/aef_player/flash/player.swf -p http://www.france24.com/en/aef_player_popup/france24_player -y f24_liveen | "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" -
VLC pops up and the video plays perfectly. However, when I try

Code:

rtmpdump.exe -v -r rtmp://stream2.france24.yacast.net/france24_live/en -a france24_live/en -W http://www.france24.com/en/sites/all/modules/maison/aef_player/flash/player.swf -p http://www.france24.com/en/aef_player_popup/france24_player -y f24_liveen | "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" - :sout-all :sout=#duplicate{dst=udp{mux=ts,dst=239.1.1.1:9000},dst=display} :ttl=20 :sout-keep
The audio shows up, but the video disappears on the local display. Tuning into the multicast confirms the video PID has dropped. VLC is pumping out the error that duplicate PCRs are being output, so I'm guessing this is why the video is being dropped. Any ideas on how to fix this?

Thanks in advance
-SS

hyc 07-12-2011 11:58 PM

Re: use rtmpdump and VLC to convert a couple of live RTMP streams into UDP multicasts


 
Personally I would use ffserver instead, though I'm not sure it does UDP broadcasts. It definitely does RTP though. You might even be able to just use ffmpeg with an RTMP URL as the input and a UDP URL as the output.

vlc has always been pretty finicky and I've never had much success with it for streaming.

secretsquirrel 08-05-2011 11:52 AM

Re: use rtmpdump and VLC to convert a couple of live RTMP streams into UDP multicasts


 
I've actually kept grinding on this issue and I think I almost have it solved, but maybe need just a little nudge to help figure it out the rest of the way.

So I took your suggestion (hyc) from the post you made at the Videolan forums and tried ...
Code:

ffmpeg "rtmp://stream2.france24.yacast.net/france24_live/en app=france24_live/en swfUrl=http://www.france24.com/en/sites/all/modules/maison/aef_player/flash/player.swf pageUrl=http://www.france24.com/en/aef_player_popup/france24_player playpath=f24_liveen" -an -vcodec copy -f rtp rtp://10.188.252.76:9002 -vn -acodec copy -f rtp rtp://10.188.252.76:9004 -newaudio
I realized this didn't work because it needs the "-i" to specify input and the swfUrl has changed recently. So I tried this ...
Code:

ffmpeg -loglevel verbose -i "rtmp://stream2.france24.yacast.net/france24_live/en app=france24_live/en swfUrl=http://www.france24.com/en/sites/all/modules/maison/aef_player/flash/player_new.swf pageUrl=http://www.france24.com/en/aef_player_popup/france24_player playpath=f24_liveen live=1" -vcodec copy -acodec copy -vbsf h264_mp4toannexb -f mpegts udp://10.188.252.76:9000
This seems to be ok, but I'm still left with only audio on the receiving end. VLC can pick up that there is a video stream (it shows it in the codec details on stream0), it just doesn't spit anything out. I get a lot of this error...
Code:

packetizer_h264 warning: waiting for SPS/PPS
I wondered if it was just this feed, so I tried Bloomberg with this command...

Code:

ffmpeg -i "rtmp://cp87869.live.edgefcs.net/live app=live playpath=us_300@21006 swfUrl=http://player.ooyala.com/static/cacheable/63abb43363926ab.e712725090ebb5f31/player_v2.swf swfVfy=1 pageUrl=http://www.bloomberg.com/tv live=1" -vcodec copy -acodec copy -vbsf h264_mp4toannexb -f mpegts udp://10.188.252.76:9000
Now I have the opposite problem. I get pictures with no audio. Once again VLC sees both the audio and video streams and can identify the codec being used, but I get a lot of this error...
Code:

faad warning: Unexpected channel configuration change
Any clue at all how I could clean this up?

Thanks!

hyc 08-06-2011 01:22 AM

Re: Use ffserver, ffmpeg, rtmpdump, VLC to convert live RTMP stream into UDP multicas


 
Are you sure you even need that bitstream filter in there? I have to say, that filter has been pretty buggy for as long as I've worked with the ffmpeg code. (Which is a couple years already...) Just for experimental purposes, have you tried using any other output formats?

Like I said, I have pretty good luck with ffserver serving over RTP and HTTP.

secretsquirrel 08-06-2011 05:24 PM

Re: Use ffserver, ffmpeg, rtmpdump, VLC to convert live RTMP stream into UDP multicas


 
Unfortunately, yes, I seem to need the bitstream filter. If I don't use it, I get ...
Code:

[mpegts @ 0x985cde0] h264 bitstream malformated, no startcode found, use -vbsf h264_mp4toannexb
av_interleaved_write_frame(): Operation not permitted

And I get dumped back out to command prompt.

All these errors seem to me to center around malformed or missing PCR or ffmpeg's mpegts muxer is broken. Actually, in looking about the Internet, it would seem there's something odd about mpegts and h264 that ffmpeg doesn't handle well. I'm not about to give up yet, but I do need some more ideas on what I could try to do to fix this.

hyc 08-06-2011 08:48 PM

Re: Use ffserver, ffmpeg, rtmpdump, VLC to convert live RTMP stream into UDP multicas


 
I still think you should try ffserver instead. This works for me with your France24 stream

ffserver.conf example
Code:

Port 8090
RTSPPort 554
BindAddress 0.0.0.0
MaxHTTPConnections 1000
MaxClients 200
MaxBandwidth 10000
CustomLog -

<Feed l.ffm>
File /tmp/l.ffm
FileMaxSize 2000M
</Feed>

<Stream test1.flv>
Format rtp
Feed l.ffm
MulticastAddress 224.124.0.1
MulticastPort 5000
MulticastTTL 16
NoLoop

VideoCodec libx264
VideoFrameRate 25
VideoBitRate 400
VideoSize 384x224
AVPresetVideo default
AVPresetVideo main
AVOptionVideo flags +global_header

AudioCodec libfaac
AudioBitRate 48
AudioChannels 1
AudioSampleRate 44100
AVOptionAudio flags +global_header

</Stream>

Start ffserver with that config file, start ffmpeg:
Code:

ffmpeg -i "rtmp://stream2.france24.yacast.net/france24_live/en app=france24_live/en swfUrl=http://www.france24.com/en/sites/all/modules/maison/aef_player/flash/player_new.swf pageUrl=http://www.france24.com/en/aef_player_popup/france24_player playpath=f24_liveen live=1" http://localhost:8090/l.ffm
set client to play from http://server:8090/test1.sdp

============


This is even easier, don't use ffmpeg at all, just let ffserver fetch the stream directly:

Code:

Port 8090
RTSPPort 554
BindAddress 0.0.0.0
MaxHTTPConnections 1000
MaxClients 200
MaxBandwidth 10000
CustomLog -

<Stream test1.flv>
Format rtp
MulticastAddress 224.124.0.1
MulticastPort 5000
MulticastTTL 16
NoLoop

File "rtmp://stream2.france24.yacast.net/france24_live/en app=france24_live/en swfUrl=http://www.france24.com/en/sites/all/modules/maison/aef_player/flash/player_new.swf pageUrl=http://www.france24.com/en/aef_player_popup/france24_player playpath=f24_liveen live=1"
</Stream>


secretsquirrel 08-08-2011 09:46 PM

Re: Use ffserver, ffmpeg, rtmpdump, VLC to convert live RTMP stream into UDP multicas


 
I had to look into ffserver a bit because the documentation is fairly sparse compared to ffmpeg, but I don't think this will work unless I'm reading this all wrong.

The target playback devices are a couple of IPTV set top boxes, so I need these streams bent into standard MPEG-TS UDP or RTP multicasts. This seems to be packing them up for an on-demand reflector service. Unfortunately, I think these little boxes are too dumb to know what to do with that.

hyc 08-09-2011 03:09 PM

Re: Use ffserver, ffmpeg, rtmpdump, VLC to convert live RTMP stream into UDP multicas


 
Quote:

Originally Posted by secretsquirrel (Post 31515)
I had to look into ffserver a bit because the documentation is fairly sparse compared to ffmpeg, but I don't think this will work unless I'm reading this all wrong.

The target playback devices are a couple of IPTV set top boxes, so I need these streams bent into standard MPEG-TS UDP or RTP multicasts. This seems to be packing them up for an on-demand reflector service. Unfortunately, I think these little boxes are too dumb to know what to do with that.

The ffserver configs I posted will multicast using native RTP format. Clients need to retrieve the SDP info from the http URL in order to read the stream parameters. I'm not sure about muxing in MPEG-TS first, haven't tried that, but vlc was able to play from this ffserver with no trouble.


All times are GMT -6. The time now is 05:13 PM.