Download 1080p streams from iPlayer


Way back in 2010, Paul Battley was blogging about device discrimination on the Internet. The new iPlayer service was using TLS certificates to ensure that only specific devices were able to stream media from the BBC's servers.

That's a situation which continues over a decade later. If you watch iPlayer on your laptop, you're stuck with 720p quality. If you want 1080p and above, you need a specially certified device.

Well, that's what everyone thought!

A few weeks ago, I found this curious forum post which said

Yes, iPlayer 1080p is possible, not as simple as just using one of these webUI tools but its certainly possible with youtube-dl and a good look around..
audio_eng_1=128000-video=12000000.m3u8

There wasn't much information about it that I could find. And then I stumbled onto this GitHub issue for youtube-dl.

With a bit of faffing around, I was able to patch my YouTube downloader (/usr/local/lib/python3.9/dist-packages/youtube_dl/extractor/bbc.py) with this code:

for fmt in formats:
   if '-video=5070000.m3u8' in fmt.get('url', ''):
      formats = [
         {'url': fmt['url'].replace('-video=5070000.m3u8', '-video=12000000.m3u8'),
          'height': 1080, 'vbr': 12000,
          'abr': fmt.get('abr'),
          'protocol': fmt.get('protocol'),
          'preference': fmt.get('preference'),
          'format_id': fmt.get('format_id', 'hack') + '-really12M',
          }, fmt]

(To be clear, this is a horrible hack. It changes the iPlayer download function so it only downloads 1080p. It also doesn't rename the file properly once reconstructed, so you'll have to do that yourself. This is a quick hack - not for production!)

And, with that, I was able to download iPlayer in 1080p.

Screenshot of VLC reporting that the video is 1080p.

Sadly there's no surround sound - AAC stereo only.

Learning from history

Back in 2008 (!) I was blogging about the BBC's ridiculous decision to restrict iPlayer streaming to iPhones. And in 2012 I blogged about how the BBC's insistence on using Flash had misfired. The BBC (and, to be fair, the video rights-holders) are desperately trying to avoid their content being shown at high quality on "unsanctioned" devices.

I get that they don't want to lose revenue. But anyone with a USB stick can record HD off air. 4K rips of every movie appear on the Internet 5 minutes after they're released. Trying to restrict who can view your content is a losing battle. It only takes one person to figure it out, and then the genie is out of the bottle.

What's the technical overhead of trying to manage this complicated infrastructure they've created? What is the tangible loss if someone watches a 4K stream from their browser rather than the app?

At some point, surely, media companies will have to realise that making easy access to their content is more powerful than blocking off every creative use. Right?

Bah. I'm off to count the pixels on the latest episode of Doctor Who.


13 thoughts on “Download 1080p streams from iPlayer

  1. Alex Gibson says:

    Interesting hack, thanks for sharing!
    Of course, you need all the pixels you can get to properly identify the mobile phones in use, technology having converged to the point you have to measure the notch shape exactly.
    With the debacle of CBS suddenly yanking Star Trek Discovery rights from the Rest Of The World (Not Murica/Canadia) and now being forced by gigantic backlash to make it available (at specific linear TV style time slots!) on previously unknown to me Pluto.TV service, just maybe content houses may realise that the days of controlling regional access to content are if not over, increasingly hard to justify.

  2. mike says:

    Wow! I didn't even know youtube-dl worked with anything other than YouTube. I've always used get_iplayer. It's worth bearing in mind that not everything on iPlayer is available in 1080 or even 720 so if you want to test you've done the hack correctly try a recent episode of Doctor Who. The Good Life wasn't shot in HD and some very recent stuff isn't available at 720 either. I initially tried the hack with an episode of What We Do in the Shadows and something close DVD resolution and thought I'd not done the hack correctly. Then it occurred to me to try it with an episode of Doctor Who and I got 1080.

    get_iplayer can only get What We Do in the Shadows at around DVD resolution so I guess the BBC's licensing of that only allows them to put it on iPlayer at that resolution. Twelve Monkeys is still available on iPlayer and at 1080 with this hack.

  3. Interesting idea on that YouTube-dl issue (that you’d posted on) about extracting a client-cert from a “blessed” device and using that for the uhd mediaselector



  4. Caruthers says:

    This a is a great find! I have no idea on how to edit the BBC.py file in Python, any chance you could share your file so that I could drop it into my youtube-dl folder? Many thanks

    1. @edent says:

      Hi, you can edit it in any text editor. You don't need a special Python program to add it. Let me know if you need any more help.

      1. Jeff says:

        Hello, does the code need to be pasted into bbc.py and if so, could you clarify where? Novice here!

        Thanks so much!

        1. @edent says:

          It needs to go at the end of the _process_media_selector function - immediately before the line return formats, subtitles

  5. Caruthers says:

    Hi, I did try editing the file in notepad++ but it's full of control characters which I'm nervous about touching. A quick google recommends not directly editing the py file but instead editing the pyo file in python. I kinda backed off at that point, but I guess I'm missing something? Thanks for your help.

    1. Caruthers says:

      Sorry, I had that the wrong way round... I have a bbc.pyo file (I'm on windows) and when I edit that file its full of ctrl chars. Maybe this is not possible on Windows as I don't have a bbc.py file?

        1. Caruthers says:

          No worries, I'll install a VM with Linux and play around there instead 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *