Friday, 28 January 2011

get_iplayer 2011

[This Update has now been Updated]

Time, I think, for an update on the get_iplayer situation. For the last few months I have found that my previous instructions work just fine for downloading SD content. They were borked though, for HD content. Which has been a crying shame, because that's the whole sodding point of get_iplayer as far as I am concerned. Want to watch BBC HD content but have an ISP comprised of a larger collection of cocks than the mid-west's bi-annual prettiest rooster award? Tough, your bandwidth will never be enough to watch streaming HD. Unless, of course, you set your alarm for 3 a.m.

So, time for an update, especially when I noticed that my previous and well thought out instructions were being described as out of date. The shame.

I find it is best to start with a vanilla version of Ubuntu when working out how to do stuff like this, otherwise you never know which package you installed six months ago and forgot about is actually essential to the whole enterprise. You then write down a careful list of instructions for someone else to follow who has NOT installed the critical package, and it doesn't sodding work, and you end up looking like a half-wit.

So, best to use the latest Ubuntu LiveCD in a virtual machine for testing purposes. [You can then make sure that everything actually works. If it doesn't the problem is somewhere at your end. If it does work you can go on to try to install the software on your distribution of choice, and enjoy some dependency hell, but knowing all the time that the theory is sound. None of this is necessary, if you want to you can just skip over all the virtualisation stuff and get straight to the software, go ahead.]

A perfectly sensible virtual machine is VirtualBox. You will find the installer package here. Grab the one for your architecture (intel/amd basically). You can even install the Windows version and then run Ubuntu inside the VirtualBox, and follow along with these instructions if you so desire.

If you are running it from Ubuntu, you also need to install the following package to get a screen resolution more than 800x600. This is optional if tiny resolutions do not bother you, or if you remember the time when 640x480 was standard and 800x600 was High-End.

sudo apt-get install virtualbox-ose-guest-x11

Now reboot your host machine (the physical machine you are working on).

When it comes back on, you may need to run the following command to get VirtualBox to work - I need to using Lucid:

sudo modprobe -r kvm_intel

Welcome back Windows people. Next step is to grab the Ubuntu CD from here. 32bit is fine. [I have also tested this with the latest (10th February 2011) daily build of Natty, and it still works fine - in fact the VirtualBox extensions aren't needed to get a decent resolution.] Once that has downloaded, fire up VirtualBox and create a new machine. I gave mine 1024Mb RAM. For our current purposes we will not actually be installing the OS, just testing get_iplayer and friends, so do not bother with a Hard Disk. In my version, that is all that is needed to create the machine, which will of course NOT WORK, because there is no boot media.

So, next click on the machine, and hit the settings button. I then went to the Storage option on the left hand side of the window which pops up. I clicked on the shiny CD with 'empty' next to it, and then in the drop down menu under Attributes on the right hand side I changed it to Primary Master. I then clicked the small CD button next to the drop down menu and choose to use a virtual CD/DVD file. I then just navigated to where ever I downloaded the Ubuntu LiveCD.

Next, to optionally get a better screen resolution, I went back to the middle panel, and clicked on the IDE Controller line and clicked the CD image with the green plus on it to add a new CD drive. I opted to choose a disk, and navigated to


I am not sure where that file will be located on a Windows install, but you can presumably search for it. [I tested this on Windows 7 and it worked fine. The .iso I refer to in stored in the Program Files folder where VirtualBox is installed.] It is not essential for what comes next though - it just make using VirtualBox a nicer experience.

I then fiddled about with some other settings. I activated USB 2.0, and I wanted to us 2D acceleration but that only works on Windows machines. Having done all that I just clicked OK at the bottom right of the window. I then just made sure my Machine was still selected at the left hand side of the window and hit the start button. I chose to try Ubuntu rather than install.

OK. We should now be at the Ubuntu desktop. It is a bit cramped at 800x600. If you are fine with that, just scroll down. If not, mount the Additions CD (just click on it in the places menu) pop open a terminal window and run:

sudo /media/VBOXADDITIONS_4.0.2_69518/

It took a few seconds to install and then invited me to restart the machine. That would be DAFT on a live cd, so instead just shut down X:

sudo /etc/init.d/gdm stop

And when the dust has settled, you need to switch to a text terminal screen. You would ordinarily do this with Control + Alt + F1, but if you are using an Ubuntu host, that will just change you to the terminal screen on your host. Instead use the RIGHT Control Key, NO Alt, and hit F1. Now restart X:


Bingo, better screen resolution.

Now, onto get_iplayer. Welcome to people who could not be bother with VirtualBox.

First open a terminal, make sure you have the latest package information and install some software we will be needing:

sudo apt-get update
sudo apt-get install git-core build-essential subversion libssl-dev ffmpeg

If you are playing along at home, you should now be able to paste commands straight into the Virtual machine. [So what is this extra software? 'git-core' and 'subversion' do essentially the same thing. These are programs that let you download software, including source code, from internet sites. The software maintainers are able to keep track of different versions of their software and you can interact with it. All we will be doing is downloading the latest version. 'build-essential' is a collection of tools that let us compile software from source code into executable files and libraries. 'libssl-dev' contains software that needs to be incorporated in the programs we are downloading when they compile. SSL is a secure communication system for the internet, and it is already installed on your machine. However, we need the 'dev'elopment files for it, so that it can get built into the new software. All you have at the moment is the end product. Finally 'ffmpeg' is a powerful command line video converter which is going to be used to convert the downloaded video from flash format to the easier to use .mp4 format.]

Once that software has downloaded, make sure your terminal prompt shows you are in a sensible place. Your home directory is just fine:


If not, change to your home directory by running:

cd ~

Now grab the latest version of get_iplayer by running this command (it will make a directory called get_iplayer in directory you run the command from, which is why we made sure you were in home):

git clone git://

Move into the directory that was just made and download the latest rtmpdump (which will be downloaded into its own folder much like get_iplayer):
cd get_iplayer
svn co svn:// rtmpdump

Then move in to the rtmpdump folder and build the software:
cd rtmpdump
make SYS=posix

The [SYS=posix] tells it to build the Linux version, as opposed to Windows or whatever else is possible. I then test ran the rtmpdump program that had been created and got this:

./rtmpdump: error while loading shared libraries: cannot open shared object file: No such file or directory

This got no better when I [make install]ed the rtmpdump software. I would prefer to keep everything in [~] home if I can. The error was complaining that it could not find a library. The library was right there in a subfolder, so I just made a link to the Ubuntu library folder:

sudo ln -sv ~/get_iplayer/rtmpdump/librtmp/ /lib

I then tested again, and got:

RTMPDump v2.3(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPLERROR: You must specify a hostname (--host) or url (-r "rtmp://host[:port]/playpath") containing a hostname

Which was much better. Now to set up get_iplayer, I dropped back down to the get_iplayer directory, and ran the program once to update its plugins from the net:

cd ..

And then I setup the usual preferences I use:

./get_iplayer --prefs-add --modes=flashhd,flashvhigh,flashhigh,flashnormal,iphone
./get_iplayer --prefs-add --flvstreamer "/home/ubuntu/get_iplayer/rtmpdump/rtmpdump"

It was quite happy being told to use rtmpdump under the flvstreamer preference. Job is, as they say, a good'un.

1 comment:

  1. Awesome - you brought one of the coolest scripts around back to life for me - thanks for posting this.