Ruby script to download, convert and tag stuff from 4od
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.gitignore initial commit May 13, 2012
4od-dl.rb New SWF player url Feb 10, 2013 Update Mar 2, 2015

This script is broken and no longer works! Don't waste your time using it :)


Ruby script to download, convert and tag stuff from 4od.

Supported Platforms

This script has been tested on OS X 10.7 (Lion). I imagine it will work on older versions of OS X and perhaps on Linux too, but I've not tested it.

It definitely won't run on Windows but other than the hardcoded 'which' calls to find rtmpdump/ffmpeg/AtomicParsley it should probably work. Feel free to have a go and send a pull request :).


To run, the following 3 binaries must be resolvable via your PATH:

  1. rtmpdump: Either download and compile yourself or grab the OS X package from
  2. ffmpeg: Either download and compile or grab the OS X binary from
  3. AtomicParsley: Either download and compile or grab the binary from

It also uses the following gems that you must install (I will sort out a Gemfile eventually):

  • logger
  • hpricot
  • crypt


Usage: 4od-dl [options]
	-p, --programids ID1,ID2,ID3     Program IDs to download - this is the 7 digit program ID that you find after the hash in the URL (e.g. 3333316)
	-o, --outdir PATH                Directory to save files to (default = pwd)
    -r, --remux                      Copy video/audio streams from FLV to MP4 - do not transcode audio
	-s, --search-range N             Search range to find MP4 versions of a program (default = 10)
    -v, --version                    Display version information
    -d, --debug                      Show advanced debugging information
    -h, --help                       Display help

For instance the ID for the following programme is 3264880:

F4M files

4od-dl does not support downloading F4M files as these are an encrypted form of Adobe HTTP Dynamic Streaming (HDS) and I don't know how to download or decrypt them.

A workaround to this was suggested on the issues tracker by richthespoof. It turns out that there are unencrypted MP4 versions of the episode available but under a different episode ID - I think there are for streaming to a PS3 as 4od supports streaming to a number of different devices. If 4od-dl comes across a f4m file it will automatically search surrounding episode IDs to find a MP4 version to download. The search range is currently 10 either side, but feel free to change the value of @search_range if you have problems.

Copying to your iPad

I have had trouble copying some downloaded programmes to my iPad - iTunes just refuses to transfer them. I think it is because the AVC level of the downloaded file is too high (some of the downloads are High@4.1). I have tried changing the AVC level using subler however it still does not work, most likely because the video stream uses features that the iPad does not support.

The only workaround I have so far is to re-encode the file using handbrake (or similar). See issue 4 for more information.


v0.4 (beta) (22 December 2012):

  • Added --search-range / -s parameter to control the search range used to find a MP4 version when the prog ID points to a F4M. Default is 10.

v0.3 (15 December 2012):

  • Improved error handling - now ignores some non-fatal errors when downloading a program
  • Improved algorithm for generating file name
  • AtomicParsley now embeds a program thumbnail into the AVI
  • Improved handling of programs with incomplete metadata (such as no Episode/Series number)

v0.2 (11 December 2012):

  • Better support of new-style 4od programs by searching for a MP4 version of the program ID given
  • Uses new 4odplayer SWF file (v 11.34.1) with rtmpdump

v0.1 (May 2012):

  • First version of 4od-dl

To Do

This is a pretty rough hack so I'd like to add (in no order):

  • Basic text-based PVR functionality to find programmes to download
  • More control over the filename
  • Use a Gemfile to manage Gem dependencies
  • Support downloads of .f4m files Workaround added December 2012
  • Ability to download to another directory than the one you're running 4od-dl in Done 14th May
  • Remove the .flv once downloading is complete Done 14th May