Capture Flash .flv streams with RTMPDump on the Mac

RTMPDump is a very powerful software to download/capture Flash streams. It’s incredibly useful for sites that don’t let you download Flash videos for offline usage. And you know what, it’s free to use (GPLv2)! RTMPDump is command line only though so if you’re looking for a nice user interface, RTMPDump may not be for you.
If you want to use the latest version of RTMPDump you need to compile it on the Mac as there’s no official version provided for Mac OS X. Compiling RTMPDump is pretty easy even though you need to modify a Makefile in order to build the binary. You also need a build environment like Apple Xcode. If you decide to download my binary of RTMPDump you can skip the next section about compiling it. The RTMPDump binary runs pretty well on Snow Leopard 10.6.4 but may not do so on earlier version of Mac OS X.

Compiling RTMPDump

  1. Download and extract the latest RTMPDump source tarball, open a Terminal window and cd to the directory you just extracted the sources, i.e. ./rtmpdump-2.3
  2. We need to make a small change in the Makefile in the ./librtmp directory, so you need to cd into that directory
  3. Edit Makefile in ./librtmp and replace -soname with -dylib_install_name
  4. cd ..
  5. sudo make install SYS=posix

Depending on the version you compile, the compilation output will look something like this:

Jans-Mac-Pro:rtmpdump-2.3 jan$ make SYS=posix
gcc -Wall   -DRTMPDUMP_VERSION=\"v2.3\" -DUSE_OPENSSL  -O2 -fPIC   -c -o rtmp.o rtmp.c
gcc -Wall   -DRTMPDUMP_VERSION=\"v2.3\" -DUSE_OPENSSL  -O2 -fPIC   -c -o log.o log.c
gcc -Wall   -DRTMPDUMP_VERSION=\"v2.3\" -DUSE_OPENSSL  -O2 -fPIC   -c -o amf.o amf.c
In file included from amf.c:33:
bytes.h:74:2: warning: #warning "Float word order not defined, assuming the same as byte order!"
gcc -Wall   -DRTMPDUMP_VERSION=\"v2.3\" -DUSE_OPENSSL  -O2 -fPIC   -c -o hashswf.o hashswf.c
gcc -Wall   -DRTMPDUMP_VERSION=\"v2.3\" -DUSE_OPENSSL  -O2 -fPIC   -c -o parseurl.o parseurl.c
ar rs librtmp.a rtmp.o log.o amf.o hashswf.o parseurl.o
gcc -shared -Wl,-dylib_install_name,librtmp.so.0  -o librtmp.so.0 rtmp.o log.o amf.o hashswf.o parseurl.o  -lssl -lcrypto -lz
ln -sf librtmp.so.0 librtmp.so
gcc -Wall   -DRTMPDUMP_VERSION=\"v2.3\"   -O2   -c -o rtmpdump.o rtmpdump.c
gcc -Wall  rtmpdump.o librtmp/librtmp.a  -o rtmpdump -lssl -lcrypto -lz
gcc -Wall   -DRTMPDUMP_VERSION=\"v2.3\"   -O2   -c -o rtmpgw.o rtmpgw.c
gcc -Wall   -DRTMPDUMP_VERSION=\"v2.3\"   -O2   -c -o thread.o thread.c
gcc -Wall  rtmpgw.o thread.o librtmp/librtmp.a  -o rtmpgw -lpthread -lssl -lcrypto -lz
gcc -Wall   -DRTMPDUMP_VERSION=\"v2.3\"   -O2   -c -o rtmpsrv.o rtmpsrv.c
gcc -Wall  rtmpsrv.o thread.o librtmp/librtmp.a  -o rtmpsrv -lpthread -lssl -lcrypto -lz
gcc -Wall   -DRTMPDUMP_VERSION=\"v2.3\"   -O2   -c -o rtmpsuck.o rtmpsuck.c
gcc -Wall  rtmpsuck.o thread.o librtmp/librtmp.a  -o rtmpsuck -lpthread -lssl -lcrypto -lz</pre>

Now there should be a rtmpdump executable in your /usr/local/bin directory.

Using RTMPdump

Let’s say you want to download one of the free promo tutorials from Kelbytraining.com for offline viewing. The following command stores Joe McNally’s Elinchrom Quadra sample directly on your desktop:

./rtmpdump -r "rtmpe://flashmedia.kelbymediagroup.com/vod/mp4:promos/mcnally_quadra/day1.flv" -W "http://media.kelbymediagroup.com/players/player-4.6-licensed.swf" -o $HOME/Desktop/mcnally_quadra.flv

RTMPDump v2.3
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
Connecting ...
INFO: Connected...
Starting download at: 0.000 kB
INFO: Metadata:
INFO:   duration              251.75
INFO:   width                 852.00
INFO:   height                480.00
INFO:   videodatarate         768.00
INFO:   canSeekToEnd          TRUE
INFO:   videocodecid          4.00
INFO:   audiodatarate         64.00
INFO:   audiocodecid          2.00
INFO:   framerate             12.00
INFO:   creationdate          Thu Apr 08 17:17:38 2010
INFO:   Encoded_By            Paul Wilder
INFO:   Encoded_By            Sorenson Squeeze
INFO:   Encoded_With          Sorenson Squeeze
6174.913 kB / 251.67 sec (99.9%)
Download complete

By the way, on some sites RTMP stream URLs are pretty well hidden and it can be quite a challenge to find them.

If you like RTMPDump please consider a donation to Andrej and Howard for their great work.

27 thoughts on “Capture Flash .flv streams with RTMPDump on the Mac

  1. There were a couple of typos in -dylib-install-name – it should be -dylib_install_name according to the compilation output you listed.

  2. Thanks for this great blog, but how to detect the RTMPdump stream? I tried to use :

    sudo ipfw add 40 fwd 127.0.0.1,1935 tcp from any to any 1935 not uid rtmp

    and then start:
    sudo -u rtmp ./rtmpsuck

    But it only locks up my Mac OSX. Any examples how to do this?

  3. Hello,

    first of all, thanks for your explanation :)

    I have a little question :

    Why “SYS=posix” and why not “SYS=macosx” ?

    Thanks for your answer !

    Carmelo

  4. hello,
    i’m running Mac OS X 10.5.8 and I think there is an OS mismatch issue because when I run your binary, I get the following error:

    dyld: unknown required load command 0×80000022

    Could you post a build for 10.5 systems?

    I have also tried to build myself but I’m running into a problem with the OpenSSL. I receive the following error when I try to “make” rtmpdump:

    handshake.h:67:2: error: #error Your OpenSSL is too old, need 0.9.8 or newer with SHA256

    This despite the fact that I updated to OpenSSL 1.0.0. The default installation of OpenSSL is located in /usr/bin. I installed 1.0.0 in /usr/local/ssl/bin. I have updated my PATH such that the latter location appears first (and therefore takes precedence). When I type “openssl version” in terminal, I get the following:

    OpenSSL 1.0.0b 16 Nov 2010

    Can you explain why I still receive the error that my OpenSSL version is out of date when I try to make rtmpdump? Thanks much.

  5. John, I’m afraid, I have no idea how to build this binary for 10.5 and I also don’t know how to solve your OpenSSL problem. Maybe the easiest thing for you to do is to update to 10.6.?

    Cheers,
    Jan

  6. I can’t reproduce this problem on a 2010 MacBook Air in 32-bit kernel mode and 10.6.5. What exactly are you doing and what OS version do you have? Are you using a software firewall?

    Ahh… now I get it. You’re trying to use rtmpsuck. Well, I don’t know how to use this sucker, this post is all about rtmpdump!

    Cheers,
    Jan

  7. Hey! Thanks for the binaries and this great tuto!
    I’ve been looking over the web and how do you find the url specially for kelbytraining?! do you have a quick tip/tuto on that?
    Thanks

  8. I’m having trouble with your binary? this is the error message I’m receiving:

    Last login: Tue May 24 21:53:47 on ttys000
    /Users/jessica/Downloads/rtmpdump\ 3 ; exit;
    jessicas-macbook:~ jessica$ /Users/jessica/Downloads/rtmpdump\ 3 ; exit;
    RTMPDump v2.3
    (c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
    ERROR: You must specify a hostname (–host) or url (-r “rtmp://host[:port]/playpath”) containing a hostname
    logout

    [Process completed]

    Any help is much appreciated; thanks!

  9. Hey Jan is there any chance you have also also compiled rtmpsuck and rtmpsrv versions 2.1 and 2.3 ?

  10. Netdog, I just updated the archives using Xcode 4.2 in the download area. I haven’t really tested if the other binaries work though. A commenter wrote that it locked up his Mac.

    Cheers,
    Jan

  11. I had to restore the old download archives because Xcode 4.2 creates bad rtmpdump binaries. Rtmpdump starts fine but crashes after connecting without any error message. The older binaries were compiled with an older version of Xcode.

    Cheers,
    Jan

  12. Piggybacking on Netdog’s request, would it still be possible to upload the rtmpsrv binary that were compiled with the older version of Xcode?

  13. I know this might sound stupid, (beginner here), but how do you “Edit Makefile in ./librtmp and replace -soname with -dylib_install_name” as your step 3 says? I’m in the ./librtmp directory now..

    thanks,
    dor

  14. Thanks so much for the info, I too was not sure about the Edit MakeFile, until I looked at it literally, just open up the MakeFile adn edit it!

    Voila, after three days of newbie work I have Perl, Xcode and RTMPDump all installed and working and successfully downloading PBS streaming flash movies

  15. Hi, thanks for making this available as a Snow Leopard Binary so I don’t have to compile it myself!

  16. I am using Mountain Lion 10.8 OS. I have downloaded and installed rtmpdump 2.4 and it seems to be working but I am trying to use rtmpsuck and I have no idea how to get my flash videos on port 1935 to route through the rtmpsuck proxy. I have added the two rule with ipfw and still the video tcp traffic on port 1935 is not being routed through rtmpsuck from my browser. I have tried with Firefox and with Safari. I can tell the proxy is working as I can telnet to 127.0.0.1 port 1935 from my machine and it connects fine. What else do I need to do to get the tcp 1935 traffic to route from the web browser to the rtmpsuck ??

  17. I can’t remember what it is but there is something in OS X that prevents you from doing this. I set up a linux VM and used rtmpsuck from there.

    Cheers,
    Jan

  18. i’m stuck at point 5, what command i should write? i have try sudo make SYS=posix and inserted a password but the terminal said it’s not recognized command?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>