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
(Update May 2017- Jon Davies has now given us a one-line installation script which does everything for you – see below)

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? (updated May 2017, successfully retested 30 Oct 2018)

First update your packages…

sudo apt-get update
sudo apt-get upgrade

To install the repository, get-iplayer and its dependencies, paste this line into a terminal window:

wget http://packages.hedgerows.org.uk/raspbian/install.sh -O - | sh

To remove get-iplayer and the repository, paste this line into a terminal window:

wget http://packages.hedgerows.org.uk/raspbian/uninstall.sh -O - | sh

The script uses sudo for some tasks, which will ask for your password.

Both scripts use sudo for some tasks, which will ask for your password. If you want to know in advance what the script will do, see install.sh or uninstall.sh.

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.

  52 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.

  17. Although all of this went successfully, it’s now caused a good few hours of headscratching this evening, as the hedgerows.org.uk keyring apparently expired some time in January 2017, making an apt-get update/upgrade impossible unless you disable the added apt repositories.

    For reference, this was the error:
    W: GPG error: http://packages.hedgerows.org.uk wheezy/ Release: The following signatures were invalid: KEYEXPIRED 1483385045 KEYEXPIRED 1483385045 KEYEXPIRED 1483385045

  18. Don’t need anything just open BBC iPlayer with chromium! Use PI 3’s for best video result with sound from HMI

  19. How are people finding the performance of this? I’ve just installed in on an original Pi that’s bolted to the back of my TV and transferred over a bunch of PVR searches from my desktop machine (the transition to 3.00 broke my desktop installation and gave me motivation to have get_iplayer running on an always-on machine). Recording performance is fine, but running the UI is painfully unresponsive. Running ‘get_iplayer –pvr’ in a shell, I can also see it crawling through the searches – it takes 5+ seconds per search. Is that normal? Right now my ~/.get_iplayer/tv.cache has 3901 lines in it. 5s to run a regex against 4k lines seems excessive, given that’s pretty much Perl’s reason for being.

    • I’d say the original Pi is your problem there – CPU performance won’t be its strong point. It’d almost certainly be a lot quicker on a Pi 2 or 3.

  20. @Chris, I used to run get_iplater on a pi1 without any issue but I had it setup to run the PVRs as a cron job so I never had to interact with it except to check the cron log.

    Now i’m using a pi2 (as I had one spare) and it is much faster and easier to manage as I use the built in VNS server to connect and check everything is working OK. That with a minidlana server serves up the media to the network. It’s possible with a pi1 but less tedious with a 2/3.

    Cheers,
    Mat

  21. Some of this is out of date now. My includes ffmpeg from Jessie-backports, carefully compiled to run on the original raspberry Pi (as well as the newer ones). More details at packages.hedgerows.org.uk

  22. Is it possible to download iplayer radio content?

  23. Hi

    Tried the install script and got a bunch of connection timeouts.

    Any idea how to resolve? Will try a further aptget update for good measure.

    Regards
    Richard

    Err http://mirrordirector.raspbian.org/raspbian/ jessie/main libhttp-message-perl all 6.06-1
    Could not connect to mirrordirector.raspbian.org:80 (93.93.128.193), connection timed out [IP: 93.93.128.193 80]
    Err http://mirrordirector.raspbian.org/raspbian/ jessie/main libhttp-cookies-perl all 6.01-1
    Unable to connect to mirrordirector.raspbian.org:http: [IP: 2a00:1098:0:80:1000:75:0:3 80]
    Err http://mirrordirector.raspbian.org/raspbian/ jessie/main libhttp-negotiate-perl all 6.00-2
    Unable to connect to mirrordirector.raspbian.org:http: [IP: 2a00:1098:0:80:1000:75:0:3 80]
    Err http://mirrordirector.raspbian.org/raspbian/ jessie/main libnet-ssleay-perl armhf 1.65-1+deb8u1
    Unable to connect to mirrordirector.raspbian.org:http: [IP: 2a00:1098:0:80:1000:75:0:3 80]
    Err http://mirrordirector.raspbian.org/raspbian/ jessie/main libio-socket-ssl-perl all 2.002-2+deb8u2
    Unable to connect to mirrordirector.raspbian.org:http: [IP: 2a00:1098:0:80:1000:75:0:3 80]
    Err http://mirrordirector.raspbian.org/raspbian/ jessie/main libnet-http-perl all 6.07-1
    Unable to connect to mirrordirector.raspbian.org:http: [IP: 2a00:1098:0:80:1000:75:0:3 80]
    Err http://mirrordirector.raspbian.org/raspbian/ jessie/ma

  24. Update: reran the install script after an attempted apt-get update again. get_iplayer now launcehed (to –help)

  25. Looks to me like the Raspian version is behind the latest release (3.0.6?) which corrects for changes in the iPlayer html?

    Either that or my installation just isn’t working?

    Anyone confirm?

    • I haven’t had any downloads on my PVR since around Oct 23rd, so I’m guessing this is why. Would really love if this guide could be updated when it’s fixed!

  26. I have not upgraded the sd card since Alex did this article so last night did
    wget http://packages.hedgerows.org.uk/scripts/install.sh -O – | sh
    and the version has moved from 3.02 to
    get_iplayer 3.05-ppa31a
    not 3.06 as you stated
    downloaded Radio 2 program no problem
    TerryR

  27. pi@Raspi3:~ $ wget http://packages.hedgerows.org.uk/scripts/install.sh -O – | sh
    –2017-12-14 12:05:32– http://packages.hedgerows.org.uk/scripts/install.sh
    Resolving packages.hedgerows.org.uk (packages.hedgerows.org.uk)… 151.101.9.147, 2a04:4e42:2::403
    Connecting to packages.hedgerows.org.uk (packages.hedgerows.org.uk)|151.101.9.147|:80… connected.
    HTTP request sent, awaiting response… 404 Not Found
    2017-12-14 12:05:32 ERROR 404: Not Found.

    • Thanks for spotting this. It seems there has been an update and the required script is now in a different directory. I’ve amended the instructions above. New command worked for me just now :)

      • Hi Not had a chance to read full thread yet I’m looking for a way to enable my elderly mother to search for her favourite TV programmes on BBC iPlayer maybe using voice.
        Alternatively maybe I could remote onto a raspberry pi at her house and download missed episodes using your technique above but would want a VERY easy way of her navigating and selecting content

        Any ideas?

        I’m new to pi but worked in IT for last 30 years and can do some coding too if required

        Many thanks

        Glen

  28. I asked on Pimoroni Discord chat if anybody knew how to get an up to date Pi optimised ffmpeg and Sandy hinted the following…

    On Stretch you can just:

    sudo apt-get update
    sudo apt-get install ffmpeg

    On Jessie you need to:

    wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-armel-32bit-static.tar.xz
    tar -xJf ffmpeg-release-armel-32bit-static.tar.xz
    sudo cp ffmpeg-3.4.1-armel-32bit-static/ffmpeg /usr/local/bin

    If it can be of any help, I cannot say for iPlayer as my IP is not in UK… and I am not paying the thing.

Leave a Reply