Advantage BBC

Although my downloader and various other people’s efforts are still working to download programmes from the iPlayer, the files we now get back won’t actually play on anything.

At first, I thought that it might be an encoding error at the BBC, but no: the programmes can be watched on an iPhone.

file says that it’s an ‘Apple QuickTime movie file’. The headers state that it has been encoded by libfaac. This suggests that it’s a genuine movie.

It appears that the BBC have found a way to produce a QuickTime movie that’s playable only on iPhones. Whether that’s DRM or just taking advantage of some kind of out-of-spec stream handling on the iPhone is yet to be seen.

Keep an eye on the Beebhack Wiki at its new location. We’ll get to the bottom of what’s happening.


  1. Dragon

    Wrote at 2008-06-06 22:01 UTC using Safari 525.20 on Mac OS X:

    I’ve noticed, that feeding the downloaded .mov file to iphone view web server, the iphone will not play the file either. it appears to be missing a crucial mp4 atom, moov? must be doing something new to get the official player working still.
  2. Alex

    Wrote at 2008-06-07 11:11 UTC using Safari 525.17 on Windows XP:

    iplayer-dl 0.1.3 doesn’t work for me, still the same “Quicktime does not understand this file.
  3. Oli Warner

    Wrote at 2008-06-07 22:00 UTC using Internet Explorer 7.0 on Windows XP:

    They’re probably chucking some “illegal” junk into the stream that the iPhone just ignores.

    It’s pretty disappointing that they’re still wasting our TV License fees on trying to circumvent us.. I’ll give it two days before the required change is found out and all the download scripts know how to fix it.
  4. Richard

    Wrote at 2008-06-08 11:01 UTC using Firefox on Linux:

    If you’ve a download of the same show before & after the change to their format, then that could be useful

    eg. they’ve posted a new copy of Dr. Who “Silence in the Library” from last week that doesn’t play in VLC, though it’s presumably the same video.

    If it’s a few extra bytes that choke standard desktop players then that should be apparent from comparing the differences…
  5. Paul

    Wrote at 2008-06-08 19:40 UTC using Opera 9.27 on Mac OS X:

    It looks as though the ‘DRM’ is trivially simple, at least in the cases I’ve looked at (eg: the last two Doctor Who episodes downloaded today). The content is just XOR’d with alternating 0×53 and 0×3c between offset 0×2800 and offset (end – 0×400). A simple programme cleans it up, and I’ve used this to play the downloaded files without problems.

    Anybody else solved this one?
  6. Richard

    Wrote at 2008-06-08 20:30 UTC using Firefox on Linux:

    Hi Paul, I find the exact same thing with the two copies of silence in the library downloaded last weekend and last night. they’re the same length to the byte and XOR’d they show the same 2 bytes you describe.

    (I would post the C code but it makes a mess of the blog)
  7. Pawel

    Wrote at 2008-06-08 20:42 UTC using Firefox on Linux:

    Why does the iPhone decode the new XORed files correctly? Is it some inherent behaviour? Seems weird.
  8. Paul

    Wrote at 2008-06-08 20:50 UTC using Opera 9.27 on Mac OS X:

    OK, so it sounds as though this could be a general pattern. I agree it’s very strange behaviour. I can’t imagine it’s a design feature as it serves no useful purpose. Also there’s nothing in the file to signal that the data has been manipulated in this way, other than the fact that manipulation masks the ‘moov’ section of the file, making the file invalid.
  9. Richard

    Wrote at 2008-06-08 21:23 UTC using Firefox on Linux:

    Coded up a removal tool and can now play “Have I got News for You”, “QI” & “Forest of the Dead” with the same two bytes …
  10. Kaz

    Wrote at 2008-06-08 21:59 UTC using Firefox on Mac OS X:

    I’m following this discussion and I’ve got a pre and post version of the same prog (Alan Yentob) but I’m not sure how to compare them apart from perhaps in text edit (OSX). Can anyone enlighten me what XOR means etc. I can probably follow along even if I’m a little slow.
  11. Daniel Hardy

    Wrote at 2008-06-08 22:13 UTC using Firefox 3.0 on Mac OS X:

    Richard, care to share your removal tool?
  12. Pawel

    Wrote at 2008-06-08 22:24 UTC using Firefox on Linux:

    can someone detail the xor scheme for me please?

    Is it byte 1 to byte 0×2800 is clean, then alternating 0×53,0×3c until byte (length(L)-0×400), byte (L-0×3FF) onwards clean?
    – or –
    byte 1 to byte 0×27FF is clean, then from byte 0×2800 alternating 0×53,0×3c until byte (L-0×401), byte (L-0×400) onwards clean?
    – or – some other permutation of those bytes??

  13. No. 7

    Wrote at 2008-06-08 23:57 UTC using Safari 525.18 on Mac OS X:

    I can’t believe it’s that simple!

    It’s taken me a couple of hours to learn how to open and manipulate binary files in c++ (last time I used c++ was in 1999), but with your inf I’ve now cleaned this weeks Doctor Who with my very own code. I’m feeling really smug!

    Thanks guys.

    ...and to the BBC iplayer department, the secret is to bang the rocks together, guys.
  14. Winne

    Wrote at 2008-06-09 00:18 UTC using Firefox 3.0 on Windows Vista:

    I can’t get the one-liner script on the wiki to work. I am behind a proxy, but curl is working properly through the proxy. The second curl command redirects to, which says “Sorry, this programme is not available.” I’ve tried Doctor Who (b00c191w) and The Apprentice (b00byg9n). Is the script working for anyone else or has something changed?

    By the way, I don’t know how long your decoding scripts are taking but you should be able to take advantage of SIMD instructions for a significant speed boost.
  15. No. 7

    Wrote at 2008-06-09 08:53 UTC using Safari 525.18 on Mac OS X:

    Tinfoil-hat time:
    It occurs to me that this XOR “encryption” may be a red-herring. Have the BBC found another way to identify iPod/iPhone versus iPod-spoofing scripts accessing iPlayer? If the downloaded non-sanitised .movs won’t work on iPod/pPhone then they be throwing this XOR bastardised version at sources identified as non-iPod/iPhone just to keep us occupied…

    @Pawel – I’ve messed about and it dosn’t seem to matter exactly when (plus/minus one offset) the XORd section starts, as long as the alternating pattern is in sync with that used in the file. However, I’d like to know too so I can get my code “right”.

    @Winne – The deXORing code is only a handful of lines. Even with my crude code it only took 17 seconds to open, clean, and save a 172 Mb file.
  16. Irregular Shed

    Wrote at 2008-06-09 09:38 UTC using Firefox on Windows XP:

    @Winne – with the one line code, did you change the iPhone user agent that it uses (“iPhone, LOL”) to the proper, full-blown one mentioned on the wiki? When the one-liner was written the Beeb were only checking for the presence of “iPhone” in the UA string; shortly after they tightened it up to check for a whole, valid iPhone string.
  17. Jamie Thompson

    Wrote at 2008-06-09 09:47 UTC using Firefox on Windows XP:

    I wonder if the release of the Windows GUI had anything to do with this panicked pointless “tightening” of “security”. They’ll eventually realise that it’s pointless and whatever they put in place, pwople will just work around it to prove a point
  18. Richard

    Wrote at 2008-06-09 10:06 UTC using Firefox on Linux:

    perhaps we could publish the first few digits of an MD5 of our downloaded files and check if we’re getting different things, or the same thing?

    md5sum silence_in_the_library_plaintext.mp4

    + NB. The XOR on the last two bytes is transposed.

    eg, the pair


    are XOR’d the other way round to the rest of the file.
  19. P Lewis

    Wrote at 2008-06-09 12:11 UTC using Firefox 3.0 on Linux:

    Here is a hacky Perl script to do the conversion:
  20. Daniel Hardy

    Wrote at 2008-06-09 12:51 UTC using Firefox 3.0 on Mac OS X:

    @P Lewis, thanks for the script, works great on Mac OS 10.4
  21. oldman

    Wrote at 2008-06-09 13:51 UTC using Firefox 3.0b5 on Linux:

    @P Lewis great, thanks!

    I look forward to the perl being translated to ruby and integrated into iplayer-dl :-)

    On a related note, it would be nice if iplayer-dl could make use of to automatically set the iTunes flags in the .mov for ‘TV Series’ type and add the series title and episode number.
  22. Pawel

    Wrote at 2008-06-09 15:22 UTC using Firefox on Linux:

    @ Richard in his tin-foil hat

    Apparently these files do work on an iPhone, according to the post above: “At first, I thought that it might be an encoding error at the BBC, but no: the programmes can be watched on an iPhone.”
  23. Richard

    Wrote at 2008-06-09 16:02 UTC using Firefox on Linux:

    @Pawel: It’s not inconceivable that the files could be watermarked while still playable, and if I stated the whole MD5 that’d give me away to the tin-foil police… :D

    It’s a bit strange that the XOR is such a short 16 bit repeating motif, though. Why are the last two bytes in reverse order? I guess, as a media player you want to be able to seek to a random point in the file so using end-0×402,end-0×401 to store a 16 bit key doesn’t make good design sense.

    Perhaps there’s a stream cypher like SEAL or similar being employed, ( ) and either by design or accident they’ve picked a weak key? I’d better go do something useful…
  24. P Lewis

    Wrote at 2008-06-09 16:42 UTC using Firefox 3.0 on Linux:

    @oldman – Unfortunately I don’t use iplayer-dl and am not very fast with Ruby :-(

    I use my own perl cmdline system which can be even run from crontab. You can get it from:

    It does iplayer programme indexing (+cacheing), regex based downloading, basic html page creation, duplicate detection etc, etc.

    (The actual download code is based on
  25. J Bennet

    Wrote at 2008-06-09 17:00 UTC using Firefox on Windows Vista:

    since this change by the BBC, i cannot view any iplayer videos on my ipod touch in safari… perhaps it no longer works with jailbroken ipods.

    Anyway – i’m quite new to this, so i need some help with the perl script. When i run it, i get:

    Use of unititialized value $arg in stat at C:/Perl/lib/File/ line 49.
    Can’t call method “size” on an undefined value at iplayer_decode line 20.

    What am i doing wrong? (have i even got the right program installed!)

    Thanks a lot
  26. Strawp

    Wrote at 2008-06-09 17:23 UTC using Firefox 3.0b5 on Linux:

    J Bennet: They broken the Touch with this change? Amazing.
  27. Strawp

    Wrote at 2008-06-09 17:32 UTC using Firefox 3.0b5 on Linux:

    BTW, I want to do a major restructure on that wiki – get things on their own pages instead of all on one like it currently is.

    If anyone feels like having a go, feel free.
  28. No. 7

    Wrote at 2008-06-09 18:18 UTC using Safari 525.18 on Mac OS X:

    Md5 of my cleaned Dr Who starts 056883a…..
    But it is named “” by my cleansing code and doesn’t have the last two bits transposed (but it still seems to work).

    I’d like to put my c++ code up somewhere for people to use, but sourceforge rejected me when I tried to start an anonymous account (imagine that!). Any body want to point me to a free anonymous place I can post it?
  29. kzap

    Wrote at 2008-06-09 18:55 UTC using Firefox on Linux:

    If you just want to host it upload it as a zip on
  30. No. 7

    Wrote at 2008-06-09 19:08 UTC using Safari 525.18 on Mac OS X:

    It compiles and works on OS X Tiger, but I don’t have access to any other *nixs to test.
  31. Richard

    Wrote at 2008-06-09 19:43 UTC using Firefox on Linux:

    here’s a command-line in-place version for windows
    [c++ source]
  32. No. 7

    Wrote at 2008-06-09 20:14 UTC using Safari 525.18 on Mac OS X:

    Richard’s debeeb built for OS X (hope that’s ok):

    iplayerdexor built for OS X:

    They both work well on my Mac.
  33. kzap

    Wrote at 2008-06-09 20:25 UTC using Firefox on Linux:

    Any thing for Linux (ubuntu) yet????
  34. oldman

    Wrote at 2008-06-09 20:59 UTC using Safari 525.20 on Mac OS X:

    @P Lewis, get_iplayer is nice! only couple of things, it currently saves to ’.mp4’ but technically iPlayer files are not valid mp4 containers but the .mov subset, if you want proper mp4 you should pipe to MP4Box, otherwise save as .mov

    it also currently saves with underscores instead of spaces

    both are easy for me to change in the perl but it might be nice to make them as options

    the atomicparsley request applies to you too :-) setting the ‘tv series’ bit would be the most imporant and it might be trivial to add that as a hexedit directly in the perl rather than requiring the full program
  35. Paolo

    Wrote at 2008-06-09 21:16 UTC using Safari 525.20 on Mac OS X:

    Has this changed again? I’ve tried both ‘iplayerdexor’ and ‘debeeb’ on a MAC using No.7 links from above. Both say the process is complete but QT still says – “this file is not a movie file”

    Any ideas?...
  36. Paolo

    Wrote at 2008-06-09 21:19 UTC using Safari 525.20 on Mac OS X:

    Actually – when using debeeb – it will accept any file name and it still says it’s done it…

    Also, now when I use iplayerdexor it say – “Checking if file “” exists: Fail”

  37. Paolo

    Wrote at 2008-06-09 21:32 UTC using Safari 525.20 on Mac OS X:

    Back again :o) Iplayerdexor seems to be working again
  38. No. 7

    Wrote at 2008-06-09 21:35 UTC using Safari 525.18 on Mac OS X:

    @Paolo – Sorry, I fear I’m not going to be much help here. All I can sugest is that you re-download the show you want to watch from iplayer and try with a fresh file.

    iplayerdexor produces a copy (called of the file whilst debeeb converts the original file. You may have inadvertently decoded and then re-encoded the file?

    Try iplayerdexor first (on a freshly downloaded file), and if the generated file dosn’t work, try debeeb.

    BTW – Richard’s debeeb is much better coded than my iplayerdexor
  39. No. 7

    Wrote at 2008-06-09 21:48 UTC using Safari 525.18 on Mac OS X:

    @kzap – Both debeeb and iplayerdexor should compile under Ubuntu. I’ve just built iplayerdexor on an Nslu2 running SlugOSle (definitally the most pointless thing I’ve done recently) so you should have no problems on a real linux box.
  40. Paolo

    Wrote at 2008-06-09 22:46 UTC using Safari 525.20 on Mac OS X:

    Thanks for the tips No.7.

    I wasn’t sure if a new file was created or not. Just happened to notice a .mov called clean.

    Seems to work now though.

  41. Thomas

    Wrote at 2008-06-10 12:28 UTC using Firefox on Windows 98:

    Do you think this (iplayerdeoxer) could be packaged up into an iplayer-dl gui and cli package, so only one command (or lot’s of clicking ;-)) would have to be used?
  42. P Lewis

    Wrote at 2008-06-10 13:51 UTC using Firefox 3.0 on Linux:

    @oldman – Re: get_iplayer ( )
    It now saves to .mov :-) Retention of whitespace chars is now supported.

    Also full web proxying works because it now uses cURL for all downloads and page accesses.
  43. Strawp

    Wrote at 2008-06-10 14:26 UTC using Firefox 3.0 on Windows XP:

    Feel free to add source code the wiki as No. 7 did.

    Yes, a GUI version of the browser/download/decrypt script would be cool.

    I suspect the BBCs next move might be to change the phrase it XORs against, but it’d have to transmit the phrase in cleartext anyway, so… yeah :P
  44. Math Campbell-Sturgess

    Wrote at 2008-06-10 16:08 UTC using Firefox 3.0 on Mac OS X:

    I’d be more than happy to integrate this into my iPlayer Downloader.
    I already have the sourceforge and stuff going (see my “website”, tis the project page!).
    What I lack is the first hand programming knowledge…
    All my app does is put a flashy gui around Paul’s (excellent) ruby script.

    If someone who knows Objective-C a little better than me would care to transpose the decoding app into Objective C, we can add it to my downloader no bother.
    I was in the process of updating to a new version of Paul’s script but it was taking a while since he took it from one script to a better factored set of scripts and libraries.

    Please, people, if you use OS X, join the sourceforge project, the app’s already pretty feature complete, we can have a fully working GUI out in a day or two if someone can either recode the decoder into obj-c, or tell me how to (never really touched binary files yet!).
    Let’s get this up and out!!
    e-mail me on my gmail, (math.campbell at or on the sourceforge page to help out here; I have no problem adding you to the team etc.; not in it for glory, just want to watch Doctor Who on my laptop without using the CLI, and want anyone else to be able to as well :D
    Get in touch!!!
  45. Daniel Hardy

    Wrote at 2008-06-10 16:46 UTC using Firefox 3.0 on Mac OS X:

    @ Math Campbell

    I’m not sure whats happening with your downloader, but it keeps crashing on me. I’m running Mac 10.4.10 on a MacBook Pro.
  46. Math Campbell-Sturgess

    Wrote at 2008-06-10 16:56 UTC using Firefox 3.0 on Mac OS X:

    10.4 would be the thing. I built it for Leopard and it’s based on a ruby script…
    Not sure why, but it;s very annoying. Try the tiger beta that’s on there….that might run.
    Or it might not. I don’t even have a tiger machine here to test on!!
  47. Mike Trim

    Wrote at 2008-06-10 17:18 UTC using Firefox 3.0 on Linux:

    I have patched Paul’s script to do the de-xor’ing as the file is downloaded:
    It’s a bit hackish and not as efficient as the C++/Perl versions posted but it seems to work, although I don’t have any before/after files to test with.
  48. Daniel Hardy

    Wrote at 2008-06-10 17:50 UTC using Firefox 3.0 on Mac OS X:

    @ Math Campbell

    Yeah, the tiger beta is the one i’m trying. As soon as I put in the url and press “steal” it crashes.

    I can probably give you a crash log if it would be of any help.
  49. Point 4

    Wrote at 2008-06-10 18:40 UTC using Firefox 3.0 on Windows XP:

    May I suggest that the forums on the beebhack wiki are used,

    it should make it easier for people to follow the rapidly unravelling events better than on a set of blog.
  50. Paul Battley

    Wrote at 2008-06-10 19:58 UTC using Firefox 3.0 on Linux:

    Good work, guys! I go away for a long weekend, and I come back to find that you’ve found and worked around the Beeb’s (apparently laughable) protection antics.

    I’ll release some fixed code very soon.
  51. P Lewis

    Wrote at 2008-06-11 07:03 UTC using Firefox 3.0 on Linux:

    @Thomas – Try ‘iplayer_decode *.mov’. This does batch conversion if that is what you want. Get from:
  52. P Lewis

    Wrote at 2008-06-11 09:23 UTC using Firefox 3.0 on Linux:

    @Thomas – I lied! iplayer_decode cannot do batch conversion. However, ’/get_iplayer -d *.mov’ will do it :-)

  53. Winne

    Wrote at 2008-06-12 00:38 UTC using Firefox 3.0 on Windows Vista:

    @Irregular Shed – Yes, I did change the string. Any other suggestions? Has anyone tried the one-liner recently?
  54. Paul Battley

    Wrote at 2008-06-12 13:41 UTC using Firefox 3.0 on Mac OS X:

    Comments are now closed: please visit the new project page for news and more information.