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:

  • use VPNGate by choosing a node in the UK
  • use CyberGhost with free UK servers
  • use VPNOneClick
  • get a cheap lifetime deal for a professional VPN, such as:

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.

BBC iPlayer video download

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.

Coffee

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

  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.

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

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

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

  5. 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
    
  6. 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!!

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

  8. 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! 😀

  9. 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).

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

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

  12. @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.

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

  14. @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).

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

  16. 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?

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

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

  19. @Lazza Great! I’m patiently looking forward to the new script version 🙂

  20. Your IP appears to be from a hosting company. Are you using a VPN? If the answer is yes, please try one that is not blocked by the BBC. 🙂

  21. Yes, I use a VPN when I watch BBC and it is not blocked. I can watch any show in the iPlayer.
    I just tried the scrip it in Chrome and there it works like a charm! It doesn’t work in my Firefox browser (53.0). I just started FF with all addons disabled except Greasmonkey, but the box doesn’t show up. But I’m happy it works in Chrome. Now I have to find out how to deal with youtube-dl – didn’t use it until now – let’s see …

    Anyway thank you so much for the script, just bought you some coffee 🙂

  22. Thank you for your kind donation! 🙂

    It doesn’t work in my Firefox browser

    Ah, you just reminded me that I always forget to test in Firefox. Will do in a few minutes and hopefully I don’t have to tweak that much…

  23. OK I’ve released version 4.0.1. The weird thing is that I still have issues with the first video on Firefox (I cannot even watch it, like there are no sources) but I’ve fixed a small oversight that was causing problems on the other pages as well.

  24. Yes I saw you changed it to 4.0.1 and now it works in FF too – great!
    But running the given command line I get the following:

    [generic] pc_hd_abr_v2_dash_master: Requesting header
    WARNING: Falling back on generic information extractor.
    [generic] pc_hd_abr_v2_dash_master: Downloading webpage
    [generic] pc_hd_abr_v2_dash_master: Extracting information
    ERROR: requested format not available
    
  25. @fraudiebels, it seems the trailer is disturbing the procedure that detects the video URL. As a matter of fact, the command line displayed there allows you to download the trailer (which doesn’t have subtitles). If you try to load the page a second time it should skip the trailer and work correctly. I will have a look at it, but for now you can use this workaround to get it working quickly.

    @Imnew, I get that you might have a different preference, however handling the M3U8 URLs was a mess, it required several steps and was often error prone with at least 3-4 special cases to take care of. With DASH streams it’s much simpler, the code is easier to maintain and update and also it’s less likely to break. Also youtube-dl handles them effortlessly. Hence, this method is going to stay. 🙂

    Regarding that episode, after clicking play you will get redirected to the page mentioned by fraudiebels which shows the temporary problem discussed above.

  26. I’ve updated the script to version 4.0.3. It should also solve the following error that was appearing with some youtube-dl releases:

    ERROR: requested format not available
    
  27. O.k. – thank you @Lazza. The error has disapeared, subtitles are there.
    But now I get the following warning:

    WARNING: You have requested multiple formats but ffmpeg or avconv are not instal
    led. The formats won't be merged.
    

    After that 2 files are downloaded – video and audio – but as the warning says – not merged..
    Do I still need ffmpeg?
    Can I merge them and if yes – how?

  28. Yes, you need ffmpeg for merging the videos. I should add a note in the blog post. If you want to merge them “after the fact”, you need to feed those two files to ffmpeg separately:

    ffmpeg -i audiofile -i videofile -codec copy output.mp4
    

    Or just run the download again.

  29. I answer myself – yes, I need ffmpeg. Seems I have solved it for now. Thanks a lot for your effort @Lazza

  30. @Lazza Thank you very much for your quick reply.
    Is there any way I can find the M3U8 file with the given video url? I’d really appreciate it if you can help me with the M3U8 problem.

  31. Of course, because the site has changed and the script had to be rewritten. The code is open source, so if you prefer M3U8 (with the added burden and work involved) feel free to update it yourself to get it working on the new website. 🙂

  32. Converted SRT subtitles don’t show up on CBBC or Cbeebies like:
    http://www.bbc.co.uk/iplayer/episode/b00w8hrx/arthur-series-14-17-the-agent-of-change
    http://www.bbc.co.uk/iplayer/episode/b036mytd/alphablocks-series-4-13-cowboy


    This 2 pages have the same content.
    http://www.bbc.co.uk/iplayer/episode/b06jcxg7/the-celts-blood-iron-and-sacrifice-with-alice-roberts-and-neil-oliver-episode-2
    http://www.bbc.co.uk/programmes/b06jcxg7

    but the 3.6.2 version only works with “http://www.bbc.co.uk/programmes/b06jcxg7” not the first page, can you help me modify this:

    else if (playlist.indexOf('iplayer/playlist') > 0) {
                var parts = playlist.split('iplayer/playlist');
                var playlist_address = parts[0] + subdir + '/iplayer/playlist' + parts[1];
                $.getJSON(playlist_address, function(data) {
                    console.log('VPID: ' + data.pid);
                    handle_pid(data.pid, '#empbox');
                });
            }
            return;
        }
    
    if (isProgramme) {
        var clipid = location.href.split("/")[4];
        $.getJSON('http://www.bbc.co.uk/programmes/' + clipid + '/playlist.json', function(data) {
            var vpid = data.defaultAvailableVersion.pid;
            console.log("VPID: " + vpid.toString());
            handle_pid(vpid, '.island .cf.component, .episode-playout');
        });
    }
    
  33. It is working great now. The only thing is that I get the BBC2 promo with the swan first. I have to refresh the page or use download first to get the right download. Can this be avoid? Also I use the latest ffmpeg now to merge.

  34. Imnew, Erik,

    Converted SRT subtitles don’t show up on CBBC or Cbeebies


    I get the BBC2 promo with the swan first

    This is extremely annoying. The BBC apparently did not like labeling all trailers with trailer. Turns out those elements are an ident now. Gosh, who developed that website? 😮 Anyways, I’ve added this case to version 4.0.4.

    Rocky Dennis, that’s usually related to an old ffmpeg version. Given that I cannot test all versions out there, users should use the latest version possible.

    Imnew,

    can you help me modify this

    Please note that I do not do unpaid custom software development. The code is there, provided for free and under the terms of the GPL v3 license:

    There is no warranty for the program, to the extent permitted by applicable law. Except when otherwise stated in writing the copyright holders and/or other parties provide the program “As is” without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the program is with you. Should the program prove defective, you assume the cost of all necessary servicing, repair or correction.

  35. Rocky Dennis, that’s usually related to an old ffmpeg version. Given that I cannot test all versions out there, users should use the latest version possible.

    I just tried this with 4.04 and youtube-dl (I used 4.03 and youtube-dl last time) and it still gives the error message.

  36. this used to be real simple….download a small file…open in vlc and save….. now I’m seriosly confused…. windows user I no !! 😦

  37. Rocky Dennis, actually I was not referring to the script version. 🙂 What I wanted to say is that both the version of youtube-dl you are using and the version of ffmpeg you are using should be updated. For instance, on a machine I am using the script with ffmpeg 3.3 and youtube-dl 2017.02.24.1.

    Anything newer than these should work. You need both tools as outlined in the post.

    Paul Carpenter, it used to be “copy and paste this into your terminal”. Now it’s “copy and paste that into your terminal”… it didn’t change a lot. 🙂

  38. Thanks! Apart from some initial problems i sorted everything out and it works perfectly! Grazie mille!

  39. I’ve the latest version of youtube-dl, and I have this message “ERROR: fixed output name but more than one file to download.” I’m not using any VPN so my IP is not UK. Appreciate any tips about what I’m doing wrong.

Lascia un commento

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo di WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione /  Modifica )

Google photo

Stai commentando usando il tuo account Google. Chiudi sessione /  Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione /  Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione /  Modifica )

Connessione a %s...

Questo sito utilizza Akismet per ridurre lo spam. Scopri come vengono elaborati i dati derivati dai commenti.