How to download BBC iPlayer videos and radio programmes

Abstract (Italiano): Scrivo questo articolo in inglese perché (ovviamente) la registrazione dei video della BBC interessa maggiormente le persone che parlano inglese. Se lasciate un commento, gentilmente fatelo in inglese.

Abstract (English): I’m writing this post in English because (obviously) recording BBC videos is mostly of interest for those who speak English. Also, a small note for native speakers, especially British people: I’m Italian and I’m mostly used to write using American spelling. For this reason, the post may contain mistakes or American words which may seem unusual. I’m sorry for that. If you find errors (apart from AE spelling) let me know in the comments.

Update (30 April 2017): Version 4.0 of the script is out, which is mostly rewritten from scratch and leverages youtube-dl instead of ffmpeg. I’ve updated this post accordingly.

Introduction

I already wrote about downloading videos from the BBC and Hulu websites (in Italian), however it was about two years ago. Websites change and so does software, hence the suggested method of using get_flash_videos does not work anymore.

I also wrote a generic article about downloading videos from websites (in Italian, too) that contains many different use cases and examples. One of my readers asked for clarification about recording iPlayer videos, so I tried again myself. I was able to apply some of the techniques of my post, together with a couple of clever tricks to find the maximum quality.

Since the process is a bit involved, I wrote a small software which automates all the steps and tells you how to start the recording immediately. This program is actually a so called user script, i.e. a piece of software that runs directly into your browser.

This article explains how to download and install the script. Then it shows you how to use it and what you need to do to record BBC iPlayer videos. Before we start, you need to be able to trick the BBC website into thinking you are living in the UK. If you are actually living there, skip the next section.

Pretending to be in the UK

The BBC iPlayer service is officially available only in the United Kingdom. The website will check your IP address and refuse access if you are trying to watch content from another country. To fix this problem, you need to use a technique to access the site through a server in the UK.

Usually the best tool for the job is a VPN service. VPNs are used to establish secure connections to private networks over the Internet, but may also be used to avoid geographical restrictions of websites.

There are many different VPN services. Most of them are paid (although cheap), while some are free. Among the best options, you can:

Please keep in mind that recently the BBC has started being more aggressive at blocking VPN providers. Always verify if your VPN provider works with the BBC (most of them have free trials available).

Luckily, I also wrote a Python script for easily using VPNGate by specifying only the desired country which works perfectly on any Linux distribution, including Ubuntu, Mint, Fedora, OpenSuse and Mageia. You can check it out here.

You may also try VPN OneClick, which lists UK among the servers. Regardless of what VPN service you choose, once it is activated, you are ready to go on and start recording videos from iPlayer.

Script installation

To run the user script in your browser, you need to install an extension that is compatible with Greasemonkey (version 3) scripts. The following are recommended:

Currently the script does not work with Greasemonkey 4 on Firefox 57 or later. Please do not use Greasemonkey 4.

After this step, you can click the following link to open the script page on Greasyfork. On the page that shows up, click on the Install this script button to complete the procedure.

You are now ready to start downloading.

Recording videos

The next time you open a video page on iPlayer, you’ll see that the script adds a box under it with some instructions and a command line. The following pictures shows an example with this video.

bbc_download_youtube-dl
Example of the output of the script

The command line displayed in the gray box is a one-liner you can use together with youtube-dl. This is a software used to convert and record video files, which can be installed on any of the common Linux distributions such as Ubuntu. More informations are available on the official website.

Despite its name, it does not work only for YouTube, it works for many other websites as well. My script uses it because it can download DASH streams served through a MPD file easily. The program can download some BBC videos without the need of my script, however the latter:

  • works on many pages where youtube-dl doesn’t recognize the stream URL
  • provides you with converted SRT subtitles on the fly, thanks to its internal converter

Remember that you will still need ffmpeg installed on your system. Check out its official website here.

To start the download:

  • carefully copy the entire content of the gray box (and nothing else)
  • paste it into a terminal window
  • press Enter and wait until the process is over

Keep in mind that this will create a lot of temporary files, but they will get removed automatically at the end.

It is also possible to download the videos on Windows or macOS. On Windows you just need to create a new file called download.bat (with Notepad, or any other editor) in the same directory of youtube-dl.exe and copy-paste the command line into it. After that, you click the bat file and it should start downloading.

However, please note that I do not offer any assistance for Windows or macOS here on the blog. If in doubt, please use Linux, or find an expert to help you with your OS. You can find the installation instructions of youtube-dl by clicking here.

Recording radio programmes

Starting from version 3.2, the script supports radio programmes such as those provided by BBC School Radio. The process is exactly the same as recording a video, including the command line. The files are in M4A format as provided by the BBC (no conversion is performed).

Conclusion

The script I developed allows to automate all the necessary steps required to ensure the highest possible quality during the downloading. In particular, the script does the following:

  • find the configuration of the player for mobile phones
  • get the list of DASH manifests for different bitrates
  • look for the best available bitrate for desktop computers
  • show the command line to the user

Performing the process manually is time consuming, error-prone and tedious if done multiple times. In this way it should be much easier for those who just want to record a couple of videos to watch them with a modern TV, on the train or keep them in a personal library.

Moreover, starting from version 3.0 the script shows you a download link to the original subtitles in TTML format (which is not very widespread). In addition, it performs an automatic conversion to the commonly used SRT format for your convenience.

Happy downloading! 🙂

Did you like the article?

Writing software and tutorials like this takes time. If you found the provided information useful, and you liked the post, you may buy me a coffee by clicking on the button. 🙂 If you do so, please leave a message on the donation page telling me it’s for this script.

190 pensieri riguardo “How to download BBC iPlayer videos and radio programmes

  1. Some progress, but still not success.
    Tried first to use the latest released version of ffmpeg – 2.8.6.7-tessus. When I first ran the script on the radio 4 broadcast of Stephen Hawking, I got this – it looks as if the output file name needs double quotes round it, which your tampermonkey script wasn’t supplying:

    ffmpeg -v 16 -stats -i "http://cp401492-vh.akamaihd.net/i/prod_af_mp4_aaclc_128/iplayerstream/bUnknown-5469a7dd-29a2-4d2f-89ff-8455a5fd7933_b06qjztk_1454412145081.mp4/master.m3u8?hdnea=st=1454714285~exp=1454735885~acl=/*bUnknown-5469a7dd-29a2-4d2f-89ff-8455a5fd7933_b06qjztk_1454412145081.mp4*~hmac=3a60d49146956567a59ebd3cceb691be46f09f3e096a53e9d577b407a0c178f6" ~/Documents/My Videos/Black_holes_ain_t_as_black_as_they_are_painted_Professor_Stephen_Hawking_Black_Holes_The_Reith_Lectures_BBC_Radio_4.mp3
    [NULL @ 0x7fd26a000c00] Unable to find a suitable output format for '/Users/JohnWMcC/Documents/My'
    /Users/JohnWMcC/Documents/My: Invalid argument
    

    So I edited the command line in Terminal to put double quotes there, and get this instead:

    ffmpeg -v 16 -stats -i "http://cp401492-vh.akamaihd.net/i/prod_af_mp4_aaclc_128/iplayerstream/bUnknown-5469a7dd-29a2-4d2f-89ff-8455a5fd7933_b06qjztk_1454412145081.mp4/master.m3u8?hdnea=st=1454714285~exp=1454735885~acl=/*bUnknown-5469a7dd-29a2-4d2f-89ff-8455a5fd7933_b06qjztk_1454412145081.mp4*~hmac=3a60d49146956567a59ebd3cceb691be46f09f3e096a53e9d577b407a0c178f6" "~/Documents/My Videos/Black_holes_ain_t_as_black_as_they_are_painted_Professor_Stephen_Hawking_Black_Holes_The_Reith_Lectures_BBC_Radio_4.mp3"
    ~/Documents/My Videos/Black_holes_ain_t_as_black_as_they_are_painted_Professor_Stephen_Hawking_Black_Holes_The_Reith_Lectures_BBC_Radio_4.mp3: No such file or directory
    

    Looked more closely at this, and realise that I had edited your Tampermonkey script in line 17 to change the output directory to ~/Documents/My Videos.

    And that with the space between My and Videos, the directory name now needs quotes around it.

    But I had forgotten that I had later changed the directory name in Finder to be just Videos, not My Videos.

    so that line 17 should now read:

    return '~/Documents/Videos/' + title.replace(/\W+/g, '_');
    

    So back to your script in Tampermonkey to edit in that change. With the change, the output directory and file name no longer needs quotes, and the thing now works! Hurray.

    So there was something in the nightly build of ffmpeg that didn’t work? Or something else, perhaps the time I tried to download it first, that stopped it working?

  2. Of course I am not responsible if other people edit the script and it stops working. 😉

    So there was something in the nightly build of ffmpeg that didn’t work?

    Most likely. Nightly builds are, by definition, made from the latest source code which may contain recent modifications, bugs, omissions, etcetera. It’s best to stick with a stable release unless there is the need of using the latest additions.

    My script is created and tested with a recent stable release in mind. 🙂

  3. Ciao Andrea, for some strange reasons the script works only once.
    If I try it again on another video the text I am supposed to copy doesn’t appear under the video.
    And another thing is going on recently.. Vpnsecure looks like working for a few minutes and then “BBC iPlayer TV programmes are available to play in the UK only” appears. I change server, it works for a few minutes and the message appear again.
    Any ideas how to fix those problems?

    1. I don’t have issues with that page. Please double check that you installed my script correctly and that it shows up in the list of Greasemonkey scripts in your browser.

  4. Hi Andrea, I can work the method fine for normal iplayer programmes, but do you know if there is any way to use it on programmes purchased on the iplayer website (but not available to download)? Thanks!

  5. Hi, I’ve installed only recently your script, but the command line does not show up. I am not using any VPN, but a chromium extension. I am able to see the video in streaming, but, again, no windows comes up whit the command line to copy.

  6. Emily, sorry but I don’t know about downloading purchased programmes.

    Cassy, it usually does not work with browser extensions and you will need to use a real VPN service. This is also due to the fact that extensions and similar kinds of proxies are often detected. Conversely, VPN services (together with their DNS servers) are usually better at this. Also, sometimes it might be good to reload the page if the box does not show up the first time (while using a VPN).

  7. The script behaves inconsistently, sometimes I get the URL and sometimes I don’t. I am using Ubuntu 16.04 and the latest version of the script on Firefox and Chrome.

    For example:
    http://www.bbc.co.uk/iplayer/episode/b0078sl0/francescos-venice-1-blood (works)
    http://www.bbc.co.uk/iplayer/episode/b0078sny/francescos-venice-2-beauty (doesn’t work)

    I get a null URL:

    ffmpeg -v 16 -stats -i "null" -codec copy -qscale 0 -bsf:a aac_adtstoasc Francesco_s_Venice_2_Beauty.mp4
    
  8. Jun, Coruja, thank you for providing links! I analyzed those and it seems that the URLs of difference video qualities have a slightly different format. My script was choking at them and couldn’t determine the best quality. Please check out version 3.4.4. 🙂

    1. Embedded videos were not supported. I rewrote several parts of the script and now they should be OK, starting from version 3.5.

  9. Yes, you can now download version 3.6 which adds support for the Olympics videos, that are embedded in a slightly different way. Don’t forget to leave a positive rating on Greasyfork afterwards. 🙂

  10. It seems to have stopped working – the url is now coming up as “null”, even on a video where I was able to download before.
    Can anything be done to make it work?
    Thanks for making this script available, I really appreciate it! 🙂

    1. The script works fine for me on multiple videos. What page are you referring to? Please check your VPN, your IP address is from the Netherlands.

  11. Thanks for your reply. Strange that my IP is showing as Netherlands for you – it’s supposed to be UK and the BBC site lets me watch the iPlayer. Guess that would explain why the script no longer works for me.
    Thanks for sharing your script – I did manage to use it a little before it stopped working for me. I’ve now found an alternative which involves downloading the video fragments (something to do with Adobe HDS) and then running a PHP script to combine the fragments once downloaded. This works quite well for me as I don’t have a reliable internet connection, so not having to download the whole stream in one go is more practical for me. FYI, here’s the method I’ve used instead: https://n1njahacks.wordpress.com/2015/01/29/how-to-save-hds-flash-streams-from-any-web-page/ – see the comment by “norton”.
    Kind regards!

  12. Weird, but it can happen sometimes. Once I spent a couple of days with many websites thinking I was in the US when I was actually in Italy. IP geolocation relies on databases that sometimes change. Anyway, I sometimes use AdobeHDS.php but I tend to avoid it because HDS streams are a bit annoying to record. Well, in the end it seems you got it working in that way so it’s good. 🙂

  13. Hello,

    Thank you so much for your script and the tutorial. It’s working perfectly for me on mac. However I’m having issues with the quality. You said above that it downloads the best quality. Instead I’m having 540p quality when I know there’s 720p. Same for the radio, some stations have 320kbp but I’m getting 128kbp always. Am I doing something wrong, is there a setting I must activate?
    When I’m getting a radio show I also get this error mesage:

    [mp3 @ 0x7fb281817c00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 5807 >= 815
    

    But it still downloads the files perfectly. So I don’t understand what that’s about.

    I’m very sorry I’m new to this and I don’t know command lines very well. Thank you for your help.

    1. It may be that the quality detection fails on some videos. Could you provide the links to the specific episodes you are referring?

  14. This is the video in particular I wanted to get

    Thank you for providing a link and sorry for the late reply. Here’s what happened:

    • that video contains some streams which are declared to be 1920×1080 but they are not
    • the script was following that path, ignoring other options
    • the actual best quality of that set of streams is 960×540

    I have tweaked the script to give lower priority to the fake 1920×1080 streams. Version 3.6.2 now allows you to record that video in 1280×720 HD resolution.

    Regarding radio programmes:

    some stations have 320kbp but I’m getting 128kbp always

    MP3 conversion is enabled by default for audio-only content and the default is 128kbps I guess. This works well for voice recordings, but it might not be the best option for music. Could you share a link for a radio programme that is available in 320kbps so I can try to figure out a good compromise?

  15. Hello Andrea,
    Thank you so for your reply and for providing the update! I was able to download the video without problems and in HD resolution. You’ve made my day!

    On the mp3s, it’s not a huge deal, I’m happy your script exists in the first place. I was trying to get this http://www.bbc.co.uk/programmes/b07qbzbn among others. I was just surprised because I knew radio 3 had a higher bitrate than the other stations. They broadcast in HD at 320kbps because it’s best for classical and jazz and in the new iplayer for ios app you can download the shows and the high file size suggests higher bitrate indeed. Sadly the files are temporary and undownloadedble. It’s not a big deal but you might want to look into it. Many thanks!

  16. I have checked that page but I can’t seem to find a M3U8 stream with bitrate higher than 128kbps. One is declared as 320kbps but in reality it isn’t.

  17. Thanks very much for the script! Works perfectly on Radio 6 with Win 7, Firefox 48.0.2, Greasemonkey 3.9 and ffmpeg N-81755-g267da70 64bit.

    1. The M3U8 URL is correct and it works fine. But you cannot access it from an American IP address, you need to fix your VPN.

  18. I’m also getting “Server returned 403 Forbidden (access denied)”, and my VPN is working properly, so I don’t think thats the reason of the problem.

    1. I take for granted that the fact the BBC is actively monitoring users to detect VPNs is very well known. When I say “check your VPN” I mean that one should ensure their VPN provider is taking appropriate measures to guarantee a working functionality also on BBC iPlayer and other websites. This usually includes appropriately changing IP addresses every now and then and setting up a working SmartDNS solution on their end so the experience is not disrupted frequently.

      As I said before, the M3U8 URL which was specified above is working correctly. 🙂 If you have a different URL that doesn’t work and this is not due to an inadequate VPN then please post it so I can have a look. Thank you.

  19. Is it possible to change the location to which the mp4 files are recorded? If so, how should I modify the script?

  20. Yes, you can save the files anywhere you want but you don’t need to modify the script. 🙂 Assuming you want to save the files in /home/andrea/Videos/ you just have to change directory in the terminal before recording the video:

    cd /home/andrea/Videos/
    ffmpeg -i [...]
    

    Also, you could simply tweak the path of the output file (and its name, if you want to):

    ffmpeg -i [...] /home/andrea/Videos/whatever.mp4
    
  21. Hi!
    Thank you very much for the script, Andrea!

    Only a little advice: in the latest ffmpeg versions (v3 or upper) the filter -bsf:a aac_adtstoasc isn’t needed anymore, because it is added automatically if the program detect a Malformed AAC bitstream.
    Also the flag -qscale 0 isn’t needed anymore, because ffmpeg select automatically the better quality.

    I hope I’ve helped you.
    Happy New Year!!

  22. Hi Andrea,
    Just FYI…
    It worked perfectly on Linux Mint 18, with Firefox, and Unblock-us VPN.
    I also downloaded the srt subs and worked fine playing with VLC.

    By the way, I can’t download the same programme with iPlayer for Andriod, althought video streaming was ok… That’s why, searching how to download via my dektop I arrived here.

    Great job!

  23. Daniele, that’s good to know, thank you. For now I think I will keep those parameters there just in case someone uses an older version, but I hope to remove them soon.

    Miquel, great! 😀

  24. I’m using your script from within the UK. It works well, thank you. Because I do prefer to use an older version of ffmpeg, please don’t change the script (there are many excellent reasons for sticking with a specific build of ffmpeg that actually works). I’m writing to ask you to consider adding a note to your webpage: if the user alters the file extension on the command line (from .mp3 to some alternative), it is possible to download a different bitrate version. For example, with a radio show you can download a 128 kb/sec stream by changing the output file’s extension to .m4a or you can download a 384 kb/sec version by changing the extension to .ts (or go mad and download a 1,500 kb/sec version by changing the extension to .wav – then encode the file you get to any format, or any bitrate, or any sample rate you want).

    1. if the user alters the file extension on the command line (from .mp3 to some alternative), it is possible to download a different bitrate version

      That’s just a matter of ffmpeg presets, you can tweak the output bitrate with -b:a 320k for instance. Anyway, selecting 1500kbps is kinda pointless if the original file is at say 256kbps. You’d just oversample the audio without any improvement.

  25. Hey Andrea,

    thx a lot; seems to work just fine on MacOS 10.12.3 with ffmpeg 3.2.4 installed via Homebrew.

    Cheers
    Martin

  26. @Lazza – But the BBC’s master stream is not 256 kbps. It’s 1,500 kbps. FFmpeg taps into their master .wav source file on the server, and merely requests a particular format. You can get the original .wav file if you so wish. My tests show that it is not simply oversampling a 384 or 256 kb/sec stream.

  27. Yes, it could be on some radio shows. I haven’t tried many of them, when I use the script it’s usually for videos. Do you have any specific example?

    Given that a lot of people would complain if the format were different from MP3 (“it doesn’t play in my car!”) I preferred to stick to MP3. But I might change in the future, it’s just not a priority right now due to my current workload.

  28. @Lazza: http://www.bbc.co.uk/programmes/b00qyqd9

    @Andrea: Today I installed v3.8 of the Firefox Add-on, in Firefox 39 (running on Windows 7). It doesn’t work: FFmpeg cannot download any BBC iPlayer on-demand radio streams. For example, the one I’ve referred Lazza to.

    Version 3.6.3 of the script continues to work okay with iPlayer on-demand radio streams (in connecting to https://aod-hls-uk-live.akamaized.net); but v3.8 gets ‘connection refused’ (in trying to connect to https://aod-hls-uk-live.bbcfmt.hs.llnwd.net).

  29. http://www.bbc.co.uk/programmes/b00qyqd9

    Well, that video has 3 audio streams: one “advertised” as 320kbps, but it really is 128kbps, another one at 128kbps (for real) and a third one at 48kbps. You can verify for yourself here:

    the one I’ve referred Lazza to

    I’m now starting to get really confused about who is this other Andrea you are talking about. 😛 Anyways, that was due to a fix used for programmes using the old domain. Now it should be working with version 3.8.1. In most cases, you will see only the 128kbps quality and not the 48kbps one, so there will be no dropdown menu. This shouldn’t be a problem, I hope.

  30. Since a couple of days (maybe yesterday) no pop-up is showing. I tried Great American Railroad Journeys, but it does not work anymore. Any idea?

  31. First of all – thanx a lot @Lazza for this great script and for maintaining it!
    As @Erik says – same probleme here. 2 days before it still worked fine. Today – nope. Seems BBC modified their iPlayer. For instance they now play a trailer before every show. Until Tuesday I could download via JDownloader too, this also doesn’t work any more. This is wy I think BBC has changed something.

  32. Seems BBC modified their iPlayer

    Correct. I confirm they did a major revamp of the layout and they also tweaked a bit the inner workings of the player. I am investigating the situation a bit and I will need some time to write a new version of the script.

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *