RTMPDump: Watch live flash streams in mplayer
Flash on Linux sucks. You may find it useful to stream live flash streams to mplayer (or vlc).
Example live flash stream: http://cricfree.tv/sky-sports-1-live-stream.php. Screenshot of it in mplayer: http://ompldr.org/vZ2NubA.
Redirect RTMP traffic through to local port:
$ sudo iptables -t nat -A OUTPUT -p tcp --dport 1935 -j REDIRECT
Start RTMP Server to hold sniffed RTMP info:
$ rtmpsrv RTMP Server v2.4 (c) 2010 Andrej Stepanchuk, Howard Chu; license: GPL Streaming on rtmp://0.0.0.0:1935 ...
Open or refresh the link to live flash stream in your web browser. The corresponding rtmpdump command output will be printed in the RTMP Server window. e.g.
... rtmpdump -r "rtmp://212.7.212.22:1935/lb/" -a "lb/" -f "LNX 11,2,202,251" -W "http://cdn.yycast.com/player/player.swf" -p "http://www.yycast.com" -y "kjghfsdm" -o kjghfsdm.flv ...
Close RTMP Server with Ctrl-C:
... ^CCaught signal: 2, cleaning up, just a second...
Delete previously added iptables rule:
$ sudo iptables -t nat -D OUTPUT -p tcp --dport 1935 -j REDIRECT
Test sniffed rtmpdump command, omitting output:
$ rtmpdump -r "rtmp://212.7.212.22:1935/lb/" -a "lb/" -f "LNX 11,2,202,251" -W "http://cdn.yycast.com/player/player.swf" -p "http://www.yycast.com" -y "kjghfsdm" RTMPDump v2.4 (c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL WARNING: You haven't specified an output file (-o filename), using stdout Connecting ... INFO: Connected... ERROR: rtmp server sent error ERROR: rtmp server requested close
If similar errors are received, analyse sniffed command with the verbose flag, -V:
$ rtmpdump -r "rtmp://212.7.212.22:1935/lb/" -a "lb/" -f "LNX 11,2,202,251" -W "http://cdn.yycast.com/player/player.swf" -p "http://www.yycast.com" -y "kjghfsdm" -V ... DEBUG: Property: <Name: level, STRING: error> DEBUG: Property: <Name: code, STRING: NetConnection.Connect.Rejected> DEBUG: Property: <Name: description, STRING: Connection failed: Application rejected connection.> DEBUG: Property: <Name: ex, OBJECT> DEBUG: (object begin) DEBUG: Property: <Name: redirect, STRING: rtmp://95.211.186.227:1935/live/_definst_> DEBUG: Property: <Name: code, NUMBER: 302.00> DEBUG: (object end) DEBUG: Property: <Name: clientid, NUMBER: 1754134368.00> ...
This log shows errors due to unhandled URL redirection. Update rtmpdump command to reflect direct URL:
$ rtmpdump -r "rtmp://95.211.186.227:1935/live/_definst_" -a "live/" -f "LNX 11,2,202,251" -W "http://cdn.yycast.com/player/player.swf" -p "http://www.yycast.com" -y "kjghfsdm" -V ... DEBUG: Property: <Name: level, STRING: status> DEBUG: Property: <Name: code, STRING: NetConnection.Connect.Success> DEBUG: Property: <Name: description, STRING: Connection succeeded.> DEBUG: Property: <Name: data, OBJECT> ...
Error message is now gone. Remove verbose option. Pipe output to mplayer:
$ rtmpdump -r "rtmp://95.211.186.227:1935/live/_definst_" -a "live/" -f "LNX 11,2,202,251" -W "http://cdn.yycast.com/player/player.swf" -p "http://www.yycast.com" -y "kjghfsdm" | mplayer -
Other things to try in case of rtmpdump errors:
- Adding the
--liveoption. - Using
--port 80. - Increase cache when piping to mplayer:
rtmpdump... | mplayer -cache 4096 -



