Nov 152016
 
Get_iplayer update for Raspberry Pi

I’ve posted several times in the past about get_iplayer – a very useful set of scripts that allow you to download BBC iPlayer content for offline viewing. I’ve even written a MagPi article about it, which also appears in the Official Raspberry Pi Projects Book

There have been several software updates since then, but something broke some time over the last few months (I wasn’t watching closely) and get_iplayer now requires a manual install of FFMPEG or it won’t convert the downloaded .ts files to .MP4

I think what broke was that the file format changed to allow higher quality streams (or something like that) and the default avconv can’t handle the new format. So FFMPEG, which is no longer part of Debian (and hence Raspbian) needs to be installed manually to overcome this.

When I found that out I went “EEEEEEEEEEK” because I can remember, in the first weeks of Pi, having to compile FFMPEG, which took 10 hours on a Pi 1. I’m sure it would be a LOT faster on a Pi3. But, happily, we don’t have to do it because ccrisan has shared a pre-compiled .deb file on github

So I’m going to give a complete rundown of the get_iplayer installation with the new part at the end…

How Do I Install get_iplayer on my Pi?

First update your packages…

sudo apt-get update
sudo apt-get upgrade

Then add Jon Davies’ repository to your sources.list. Copy and paste the following 5 lines of code into a terminal window on your Raspberry Pi (and press ENTER)…

sudo bash -c "cat > /etc/apt/sources.list.d/packages.hedgerows.org.uk.list <<EOF
deb http://packages.hedgerows.org.uk/raspbian wheezy/
deb-src http://packages.hedgerows.org.uk/raspbian wheezy/
EOF
"

Then enter each of these three lines one at a time to update your package list again, install the right keyring, then update again…

sudo apt-get update
sudo apt-get --allow-unauthenticated -y install jonhedgerows-keyring
sudo apt-get update

Now we’re ready to install. (Notice the installation name is – hyphenated, not _ underscored.)

sudo apt-get install get-iplayer

After installing get_iplayer we need to install FFMPEG. If you don’t want to compile it yourself, grab it from github with…

wget https://github.com/ccrisan/motioneye/wiki/precompiled/ffmpeg_3.1.1-1_armhf.deb

Then install it with…
sudo dpkg -i ffmpeg_3.1.1-1_armhf.deb

Then configure get_iplayer to use it…
get_iplayer --add-prefs --ffmpeg="/usr/bin/ffmpeg"

Then you should be good to go. Run it with… (Notice the program name is _ underscored, not – hyphenated.)

get_iplayer --help

This will give you a list of the basic usage options. If you want to see all of the advanced options as well…

get_iplayer --helplong

Basic Command Line Usage

That’s nice, but how do I get started? Typing…

get_iplayer planet gave this output…

output from get_iplayer planet

output from get_iplayer planet

So, supposing I want to download number 2688 Planet Earth II – Mountains…

get_iplayer --get 2688 --modes best (--modes best gives you the best available quality)

After about 10-15 minutes the file “Planet_Earth_II_-_1._Islands_p048sflc_editorial.mp4” is downloaded and processed and can be watched using…

omxplayer Planet_Earth_II_-_1._Islands_p048sflc_editorial.mp4

(CTRL+C to exit)

And that’s about all there is to it. Have fun. :)

Usage Tips

Sometimes there is a discrepancy between the list provided by running get_iplayer and what’s on the BBC site. But it’s easy enough to circumvent…

e.g. the URL for the Eagle Has Landed used to be (they removed it now)…
http://www.bbc.co.uk/iplayer/episode/b00glr88/the-eagle-has-landed
b00glr88 is the programme id, so…

get_iplayer --pid=b00glr88 --modes best

would get you that programme.

The Boring Bit

If you download programmes using get_iplayer you are supposed to delete them after 30 days. get_iplayer will remind you to do this, but it doesn’t force you to.

To use iPlayer you must be located in the UK. More specifically, your IP address must be a UK registered one.

From 1st September 2016 you need a UK TV license to use iPlayer legally.

  30 Responses to “get_iplayer on Raspberry Pi – update November 2016”

  1. Really excellent.
    Thanks
    Richard

  2. I would like to point out that a valid TV licence must be held to use iPlayer.
    Greg

  3. Will have to have a go at this one and my Wife’s brother is the guy putting the parachute on Michael Caine . TerryR

  4. A very easy installation. Thanks, Alex.
    Only one problem: the search for –cat film only gave items with “film” in the title and they were programmes about films. Looking down the very long list of items I could only find TV programmes. Are the BBC including links to films and the download files? Copyright ??? However you can build your own ‘boxed set’ of Planet Earth II or crime serial.

    • Darn it! You’re right. Looks like it’s name only now – the categories no longer work :( Will amend the post.
      (Fixed, by changing the example to a new one.)

  5. Interestingly, Ubuntu 16.04 moved back to ffmpeg and away from avconv. I wonder why. Actually, I don’t wonder why, because I expect the answer is going to be some tedious legal or OS-purity flamewar. Anyhoo… I do hope that either proper ffmpeg makes its way to Raspbian, or avconv gets updated.

  6. Sounds nice, but for all readers interested in BBC programming, can the content be accessed outside of the UK?

  7. Alex All working except the github download kept failing so direct to laptop then transfer the file solved the problem.
    TerryR

  8. doesn’t work, there are only one listing now and the pid doesn’t work if not listed :(

    • It did for me yesterday. You can find the PIDs on the BBC website if they’re not listed.

      The catalog search function no longer works. I’ve corrected the post, but PID still works. I’ve just tested it again.

  9. Be aware that –modes=best now gets you HD 50fps files for many programmes (2GB per hour of video). To spare disk and bandwidth, use –tvmode=tv25fps to get HD 25fps when available. Also, you only need ffmpeg to remux MPEG-TS files to MP4. so you may be able to get by without. Use –raw to skip remux and keep the MPEG-TS files.

    • Thanks for that. I’ve got my Pi connected to a media server via cifs, so space is not an issue for me, but it would be for some if using the Pi SD card.

  10. I’m still interested in downloading films but they are no longer available as ‘catchup’. Is it possible to capture the film while it is broadcast ‘live’ with get_iplayer?

    • Films (those with requisite broadcast rights) are still available for catchup. Search by title or find PIDs via: http://www.bbc.co.uk/iplayer/categories/films/all?sort=dateavailable

    • Also: it is possible to capture a live programme, though that has been hit-or-miss for me. It may work better for you. Live capture has apparently been deprecated, however.

    • It seems films are available if you find the PID on the iPlayer website and use the PID method or search for them by name.
      e.g. http://www.bbc.co.uk/iplayer/episode/b00pmcs6/the-painted-veil

      get_iplayer painted finds
      3866: The Painted Veil (at the moment anyway, it changes constantly)

      Or you could do…

      get_iplayer pid=b00pmcs6

      But only current content is there. They don’t maintain a permanent archive of films and some just don’t appear (licensing issue?)

      Another example. Bitter lake didn’t come up in the index when I searched for ‘bitter’.
      But with get_iplayer pid=p02gyz6b it found and downloaded it fine.

      So it looks like a hybrid of looking on the iPlayer website and using get_iplayer will be the best way to go with films.

  11. great post, encountered the same problem when I upgraded get_iplayer recently. I took the opportunity to move my install from a pi1 to a pi2 – so much faster encoding! Still battling with minidlna – why are linux permissions always such a pain ! :)

  12. This website, https://squarepenguin.co.uk/guides/, has awesome get_iplayer guides. Not mine, I just always use it.

  13. Just dropped on this.
    Installed and setup exactly as described here.
    Excellent,
    Thanks.

    This Get-iPlayer is excellent, didn’t know I could download like this from the BBC.
    Don’t suppose there are any similar bits of software for the other channels?

    Thanks
    Martin

  14. ~~~ UPDATE and WARNING!! ~~~

    This whole ffmpeg nonsense SCREWS UP your working get_iplayer

    !!DO NOT USE FFMPEG NOR INSTALL IT!!

    It took me well over an hour to update and fix my 2.97 to a working setup (it was working before I came here – silly me to blindly follow third party unproven guides! I should know better!)

    STEPS:

    ~ Add repos and import keys, etc etc, as instructed, and do update/upgrade.
    ~ INSTEAD of ffmpeg (forget it, it’s screwed up!) do this at the end:

    get_iplayer –add-prefs –ffmpeg=”/usr/bin/avconv” [hit return]

    NOTE: “libav-tools” should auto install when the hedgerows repo variant of get_iplayer 2.97 is enabled and installed – in “libav-tools” is “avconv” which you are then configuring get_iplayer to use INSTEAD of ffmpeg (and it works fine… why change it?)

    One thing I detest is my time being wasted, and I wasted my own precious time on this piffle, tonight, so to the tutorial author, I do not blame you, but PLEASE CHECK YOUR STEPS BEFORE POSTING :)

    Thank you and God bless – please remove my last, erroneous post.

    • All my blog posts are based on a full run-through. That is exactly what I do.

      Something may have gone wrong for you, or something may have changed. Sadly that happens sometimes :(

      As you can clearly see from the other comments, some people did the install as above and it worked perfectly.

      Boohoo for your lost hour. It takes a lot longer than an hour to do a decent blog post which benefits hundreds or thousands of people. Sorry it didn’t work out for you on this occasion. There was some potentially useful stuff in your comment, which is why I approved it.

  15. I always try something like this on a new SD card – they are very cheap – never on a valuable card where there might be conflicts. Then, if it worked on the new card and I want to add the functionality to my main SD card, I do the upgrade on a clone of the main card – very quick and easy to get now. If that carries on working the cloned SD card becomes my new main card and the previous main a backup.
    I suggest you always keep a few spare SD cards to try out new ideas on.

    • Good call using live and test sd cards. I actually like it when it breaks as it’s fun working out how to fix and learning more. Plus the sense of accomplishment is great.

      Cheers

    • Yes that’s definitely the way to go. Anything important or valuble should always be backed up and you work on a ‘working copy’.

      I’m reviewing some sound cards at the moment and each one gets a fresh, fully updated, SD card as a fair, fresh starting point before installing any software or drivers, precisely according to the manufacturer’s instructions.

  16. I’m getting an ffmpeg error when downloading a show:

    INFO: Begin converting file: /home/pi/Dipdap_-_11._Sleep_b00xwjb8_original.partial.mp4.ts
    /usr/bin/ffmpeg: error while loading shared libraries: libx264.so.142: cannot open shared object file: No such file or directory
    INFO: Command exit code 127 (raw code = 32512)
    WARNING: Conversion failed – retaining /home/pi/Dipdap_-_11._Sleep_b00xwjb8_original.partial.mp4.ts

    It seems like ffmpeg relies on version 142 of libx264, but I’ll be damned if I can figure out how to find and install that. Can you help?

    Some more info – I’m running this on an old pi B+. It had ffmpeg already installed, and following your instructions overwrote it, I think.

Leave a Reply