Jun 212012
 

Update 15 November 2016

Installing latest Get_iplayer instructions here…

https://raspi.tv/2016/get_iplayer-on-raspberry-pi-update-november-2016

Update 5 November 2014

Installing latest Get_iplayer instructions here…

https://raspi.tv/2014/get_iplayer-raspberry-pi-update

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.

Install Packages

Now, let’s navigate to a known starting point

cd /home

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…

cd get_iplayer

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.

cd /home

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

Then
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
y
confirm install without verification

Now the package update should work…
sudo apt-get update
sudo apt-get install libssl-dev librtmp-dev
y
to confirm install of the libraries required to build rtmpdump, which we’re going to do next.

Build and Install rtmpdump

Make sure we are still in the home folder.

cd /home
sudo git clone git://git.ffmpeg.org/rtmpdump
cd 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 ;)

Test with
rtmpdump -v
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.
cd /home

Now we need to install all the development libraries required to build FFMPEG. From sudo to 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…

cd ffmpeg

Note that the following command from ./configure to --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.)

sudo make

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
sudo ldconfig

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

cd /home/get_iplayer
then
./get_iplayer
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.

part of get_iplayer program list

part of program list

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…

-o /path/to/file-destination

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

All those 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.

cd /home
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.

  10 Responses to “Get_iplayer installation on Raspberry Pi with Debian Wheezy Beta”

  1. […] If you have the Debian Wheezy Beta released on 19 June 2012, the instructions are different, click here to go to the Get_iplayer Wheezy installation instructions. […]

  2. Any tips on running the get_iplayer web interface at startup?

  3. […] If you have the Debian Wheezy Beta Raspberry Pi release you need to click here and use these different instructions. […]

  4. Hello, Excellent tutorial and most appreciated (I can’t imagine how long it took to put together) but I’m stuck getting libfaac-dev. I got E: Unable to locate package libfaac-dev when trying to get it, but didn’t notice. Then I tried the “sudo ./configure blah blah” and didn’t get the warning about pkg-config not found as you mention, but that libfaac wasn’t found, so the “make” command failed.

    I’ve tried sude get-apt libfaac-dev to no avail. Any ideas please (be gentle, I’m as green as you like).

    Thanks, and thanks for bothering to put all of this together in the first place. Noobs like me would be knackered without your selflessness. :-)

    • Are you actually using the Debian Wheezy Beta or Raspbian?

      Most people have left the Wheezy Beta behind since Raspbian came out in August. If you are in fact using Raspbian, you should follow these instructions, although you may well need to read the comments at the end of that page to get it fully up and running, as a few things have changed recently. Anyway – here’s the link…

      https://raspi.tv/2012/get_iplayer-installation-on-raspberry-pi-with-raspbian

      • Thanks for your reply. I checked the debian-version file and it says “wheezy/sid” which I assume is debian wheezy, not sure where the ‘beta’ fits in there though.

      • I’m using Raspian wheezy it turns out, sorry for the confusion, I’ll try again.

        • Ah OK. I was going to tell you how to check, but then I forgot how to do it myself and couldn’t quickly find out how to do it without attaching a monitor and rebooting :)

  5. Does anybody know how to stream to omxplayer on Raspian? I tried: get_iplayer –stream 123 –player=omxplayer -cache 3072 -” and get message “Streaming failed with exit code 1”.

Leave a Reply to Alastair Cancel reply