Friday, October 25, 2013

Capturing RTMP video (aka Flowplayer) (in Fedora)

It may not be very elegant, but it works.

First, install rtmpdump:
sudo yum install -y rtmpdump

Then, create this script somewhere handy:
#!/bin/bash
sudo iptables -t nat -A OUTPUT -p tcp --dport 1935 -j REDIRECT
echo starting
rtmpsrv | tee rtmp.txt
echo ended
sudo iptables -t nat -D OUTPUT -p tcp --dport 1935 -j REDIRECT

Run the script, then, while it is running, try to watch the video in your browser.  If it is an RTMP stream, the terminal should show some capture information.  Ctrl+C in the terminal.

Now, you may have to edit the rtmp.txt output file to remove extra text, but leave the "rtmpdump" commandlines.

Finally, execute:
sh ./rtmp.txt

...to download the video.

(Create an alias:  alias capture='~/path/to/rtmpdump/script.sh')