Installing Get_iplayer on Debian Wheezy Beta on the Raspberry Pi
Following on from my original posting on get_iplayer, which was installed on the Debian Squeeze distro for the Raspberry Pi, this is a set of instructions for the Wheezy beta release. It’s quite a bit simplified because we don’t need to bother with installing rpi-update, since most of the needed firmware updates are now incorporated into the distro. :-D That’s progress for you.
Starting point assumptions.
I’m assuming that you have an internet connected Raspberry Pi with SD card (4 Gb & up – 2Gb is not enough for compiling FFMPEG) booted up into a clean install of a Debian Wheezy distribution you got from the Raspberry Pi public beta announcement page. The current version at the time of writing is 2012-06-18-wheezy-beta.zip
If you have the Debian Squeeze Raspberry Pi release you need to click here and use these different instructions.
If you have the Raspbian Wheezy Raspberry Pi release you need to click here and use these different instructions.
If, you’re on Wheezy Beta, carry on with the instructions on this page.
sudo apt-get update
This will update your packages and may take a few minutes.
Next we need to install git, which is a version control system we will need to access the latest versions of various packages.
sudo apt-get install git-core
y to confirm when prompted.
Now, let’s navigate to a known starting point
and install a required perl package.
sudo apt-get install libwww-perl
y to confirm
We’re going to use git to get the files, install the get_iplayer files, then build (compile) and install rtmpdump and ffmpeg from the latest source code.
rtmpdump is used for recording the iplayer stream. ffmpeg is used for transcoding (repackaging) the resulting flv file into an mp4 wrapper – which means we can view it on our Pi with Omxplayer or XBMC etc
Now you will need to get hold of the latest version of get_iplayer…
sudo git clone git://git.infradead.org/get_iplayer.git
This will create a new folder called get_iplayer in your /home folder. All the get_iplayer files are in this folder. Let’s go there…
we need to make the get_iplayer file itself writeable or it won’t work properly, so…
sudo chmod 777 get_iplayer
This changes its permissions so it can be read, written to and run by anyone.
Let’s get back to our home folder so we know where we are.
Now we’re going to edit a file which contains the sources of debian repositories. We’ll do this with nano – a text editor.
sudo nano /etc/apt/sources.list
Then use the cursor keys to get to line 2 and add…
deb http://www.deb-multimedia.org/ wheezy main non-free
CTRL-X to exit
y to confirm you want to save
enter to confirm the filename (don’t change it)
sudo apt-get update
It will update some package lists and give two errors. W: GPG error and W: Duplicate sources… We’ll deal with those next…
sudo apt-get install deb-multimedia-keyring confirm install without verification
Now the package update should work…
sudo apt-get update to confirm install of the libraries required to build rtmpdump, which we’re going to do next.
sudo apt-get install libssl-dev librtmp-dev
Build and Install rtmpdump
Make sure we are still in the home folder.
sudo git clone git://git.ffmpeg.org/rtmpdump
sudo make SYS=posix
You will now see a some lines starting “gcc -Wall” and the process will take a few minutes. When it finishes, you’ve just compiled the latest version of rtmpdump. Now we need to install it…
sudo make install SYS=posix
You should then see some lines starting “cp” and “mkdir” as the files are copied over to their new homes. You have now compiled and installed rtmpdump. Congrats ;)
to check you are running the latest v2.4 (at the time of writing). Ignore the hostname error. We’ve got what we wanted. Onward.
Build and Install FFMPEG
Now I’ve got some good news and bad news for you. The good news is that our typing is nearly done. The bad news is that FFMPEG is quite a large, complex program and takes about 3.5 hours to compile on the Pi. But as long as you know this, you can plan round it, right?
Let’s get back to home so we don’t end up putting FFMPEG inside the rtmpdump build folder.
Now we need to install all the development libraries required to build FFMPEG. From
libvorbis-dev is is all one line.
sudo apt-get install libfaac-dev libmp3lame-dev libx264-dev libxvidcore-dev libgsm1-dev libtheora-dev libvorbis-dev
Now let’s get the FFMPEG files themselves.
sudo git clone git://source.ffmpeg.org/ffmpeg.git
This is quite a large download and will take a little while (10-20 mins). Once complete…
Note that the following command from
--enable-nonfree is all one continuous command.
sudo ./configure --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libgsm --enable-postproc --enable-libxvid --enable-libfaac --enable-pthreads --enable-libvorbis --enable-gpl --enable-nonfree
After a minute or so, you will get a warning about pkg-config not found. Ignore it. It’ll still work. Now to compile. :)
WARNING! Once you press <enter> for the sudo make command it will tie up your Pi for about 3.5 hours until the compile is finished. (If you are accessing your Pi via ssh, you might want to run it via screen, so you can detach and reattach without killing the process.)
This will show you what it is doing as it goes. There will be lots of scary messages you don’t understand. Best go and do something else. And best run the “sudo make” directly on the Pi if you can. If you do it by ssh you’ll have to leave your other computer on and connected until it finishes.
Once compiled, the install is a fair bit faster (~2 minutes).
sudo make install
So we don’t stumble across permissions issues, if you are going to be logging in as a normal user (pi) rather than root, we need to give ourselves ownership of these directories…
sudo chown -R pi /home/get_iplayer
sudo chown -R pi /home/ffmpeg
sudo chown -R pi /home/rtmpdump
It won’t work, for me, using the pi login without chowning the get_iplayer directory. I’m not 100% sure if it’s necessary to chown the ffmpeg and rtmpdump directories, but I can’t see it doing any harm.
Now your installation is finished, let’s try it out.
Starting using get_iplayer
Go to your get_iplayer directory
If it tries to update and gives an error message, make sure you have full permissions on get_iplayer
sudo chmod 777 get_iplayer
Run get_iplayer and once it’s finished updating plugins etc. It will update the program list. You’ll know when that happens you will see about 1000 programmes displayed.
Then you use it like this.
./get_iplayer keyword (substitute keyword for a keyword in a programme title)
This will result in a list of programmes (or none) with that keyword in. Make a note of your chosen programme’s ID number e.g. 460
Then, to download programme 460, type this
./get_iplayer --get 460 --modes=best
This will download the program at the best available resolution to your get_iplayer folder on your SD card, which you probably don’t want. I generally put my downloads on a USB memory stick. You can redirect the download wherever you like using…
so for me, with a USB stick mounted at /media/usbstick, the full command would be…
./get_iplayer --get 460 --modes=best -o /media/usbstick
flashhd etc. options ensure you download at the best available resolution.
To mount a USB flash drive/memory stick or other device click here for the procedure
Back Up Your FFMPEG Compile?
One more thing. It might be a good idea to back up your compiled FFMPEG files in case you ever want to re-flash your SD card. If you copy it onto a stick – (here’s how to handle mounting a USB stick), you won’t have to recompile.
sudo tar -cvzf /media/usbstick/targetfile.tgz /home/ffmpeg
This will make a full zipped archive of your ffmpeg files.
Well done and happy recording
I hope this has helped you learn how to install get_iplayer on the Raspberry Pi. Enjoy using it.