As of 2013, some streams require the 'ksv'/'k-s-v' patch.. Arch users can use rtmpdump-ksv instead of rtmpdump
Commands
Redirect rtmp port using iptables.
sudo iptables -t nat -A OUTPUT -p tcp --dport 1935 -j REDIRECT
Sniffing for stream parameters.
rtmpsrv
Once you've captured a stream, you can undo the redirection.
sudo iptables -t nat -D OUTPUT -p tcp --dport 1935 -j REDIRECT
Use rtmpdump like so, piping the output to mplayer/vlc
rtmpdump -q -r "rtmpe://origin.hdcast.org:1935/redirect/" -a "redirect/" -f "LNX 11,9,900,152" -W "http://www.udemy.com/static/flash/player5.9.swf" -p "http://www.hdcast.org/embedlive2.php?u=ban5&vw=640&vh=460&domain=www.btsportshd.com" -y "ban5" -b "10000" -v | mplayer -really-quiet -framedrop -
Important options
rtmpdump
- -r [tcURL ex. "rtmp://stream.url/"]
- -a [app ex. "redirect/"
- -y [playpath ex. "freetv4"]
- -v [live]
- -b [buffersize ex. "10000"]
- -W [swfURL ex. "http://stream.url/flash/player5.9.swf"]
mplayer
- -really-quiet [Suppresses output.]
- -framedrop [Helps with streams.]
- - [Plays from stdout.]
Port redirect helper script
I wrote a bash script that takes the hard part, remembering, out of the iptables step.
#!/bin/bash
## PND4
## o1.27.13
success() {
echo ".. success :)"
}
failure() {
echo "-- FAILURE :("
}
add-rule() {
sudo iptables -t nat -A OUTPUT -p tcp --dport 1935 -j REDIRECT
}
del-rule() {
sudo iptables -t nat -D OUTPUT -p tcp --dport 1935 -j REDIRECT
}
case "$1" in
start)
echo "Starting.."
# also delete rule if it exists for some reason to avoid dupes.
# always errors out so we ignore it
del-rule 2>/dev/null
add-rule
[ $? -eq 0 ] && success || failure
;;
stop)
echo "Stopping.."
del-rule
[ $? -eq 0 ] && success || failure
;;
*)
echo "Usage: $0 <start|stop>"
;;
esac