YouTube’s H.264 File URL

When YouTube announced that it was going to re-encode it’s videos to H.264, we got pretty excited at Scouta. Flash is a great format for the current web, because all the major browsers support it. However, for mobile content, Flash isn’t the best.

Podcasting has taught us many things, but the most important is that media portability is incredibly important. So, we hoped that YouTube would quickly provide a way for everyone to access the H.264 files. If that happens, they’d make it possible for Scouta to automatically provide YouTube recommendations to iPods, iPhones, Apple TV, and many cell phones.

We’re still waiting.

So, today I grabbed a little command line application called tcpflow, so that I could watch my home network when I browsed YouTube from my iPod Touch.

Here’s some of the output.


GET /videodownload?version=0&secureurl=sAAAALxRpszUgT
K_K_xaZ04iy5tG5s0RQGCogbu2j7BRaDGlNUv_oRDCosYqQ2m
hyWH6ROC25CylWLkipiikyQ97c3BCl2u1oDLrNNmn8NfBQVH7
K586K8rKe9duBiKIrFEfZ46utV6egrAmilzAKQOnpUG8YNA8Oz
6Jhzcv6Hx7wHsnESwNF9XrwO_pnP1x5O7W367U3uI585NSGf
f0UapBOQO-1rkBSaoA3g8yExqnvjVvY-rhOOFptCTRaPPjjvfy5g
&sigh=cdwzKab_vQuTVjgHSBfXHDBtB4Y&begin=0&len=96000
&docid=-4739947727435681593&rdc=1 HTTP/1.1
Accept: */*
Accept-Language: en
Accept-Encoding: gzip, deflate
Cookie: PREF=ID=5af2541129cf8155:TM=1190888574:LM=1190894284:
GM=1:S=6a4wxk3bXXUt_t7a; SID=DQAAAIAAAACnwx-TfmGUo8rZC25O
UipW5UUislyZM3MJBYVws8uJJOIrF75qawK5Q-PzADqxKJcrv1BES7ELImq
kiM-xZLvGe0c4PvhR-pYD0xXqHgVVNuAp44oQtyoXCwPIUB_vRXNQR5GK3
dv_NPLdKBd0W312_q3xu66fD412BaeGJ_-c0A
User-Agent: Apple iPhone v1.1.1 CoreMedia v1.0.0.3A110a
Connection: keep-alive
Range: bytes=0-1
Host: annz.vp.video.l.google.com

This shows us the host, and the URL that the iPod used to grab a YouTube video. Put it together and you get:


http://annz.vp.video.l.google.com/videodownload?version=0
&secureurl=sAAAALxRpszUgTK_K_xaZ04iy5tG5s0RQGCogbu2j
7BRaDGlNUv_oRDCosYqQ2mhyWH6ROC25CylWLkipiikyQ97c3
BCl2u1oDLrNNmn8NfBQVH7K586K8rKe9duBiKIrFEfZ46utV6eg
rAmilzAKQOnpUG8YNA8Oz6Jhzcv6Hx7wHsnESwNF9XrwO_pnP
1x5O7W367U3uI585NSGff0UapBOQO-1rkBSaoA3g8yExqnvjVv
Y-rhOOFptCTRaPPjjvfy5g&sigh=cdwzKab_vQuTVjgHSBfXHDBt
B4Y&begin=0&len=96000&docid=-4739947727435681593
&rdc=1

Several interesting things are immediately evident.

First, it’s not simple to convert a normal YouTube link to this H.264 URL. Here’s the original URL:


http://youtube.com/watch?v=vjhSp7xGsMc

Second, they’ve implemented security: a secureurl parameter.

Third, you can’t open this URL in Firefox. Opening in Safari has a different result: the .mp4 file downloads. So it would seem they have implemented a couple of security features.

Understandably Google/YouTube want to protect their business to some degree. But, it would be nice if YouTube would open up the H.264 URL to potential partners. After all, the wider their content is available, the better their chance of monetizing. Right?

So, consider this an informal “pretty please” from Scouta to Google: Please allow us to access your files in H.264, pretty please.

10 Responses to “YouTube’s H.264 File URL”

  1. Leslie Says:

    Great post, Richard. I was able to grab that URL with Firefox by spoofing the iPod Touch’s user-agent;

    Mozila/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Geckto) Version/3.0 Mobile/3A101a Safari/419.3

    So what security there is is somewhat trivial. Weirdly, the file downloads with a double-dot file extension, ie. be3852a7bc46b0c7..mp4

  2. Richard Says:

    Thanks Leslie. And good idea spoofing the user-agent.

  3. Leslie Says:

    The URL can now be opened by default in Firefox (without needing to spoof the UA), but IE still results in a “Forbidden” error.

  4. Leslie Says:

    Aha, tinyurl’ing it works in IE.

  5. Richard Says:

    That’s interesting Leslie. I wonder what makes the difference.

  6. jvc Says:

    so is there any way to get these h.264 urls without an ipod/iphone?

  7. Richard Says:

    jvc: yes, use Safari, or use Firefox that is setup to spoof a website making it think it is safari. Saying that, Leslie also got it working without spoofing recently.

  8. Gábor Szántó Says:

    Can you please send the whole communication/output to my e-mail address? I think the trick is in the other parts.

  9. Gábor Szántó Says:

    Thanks for the dumps Richard, i made an (experimental) solution:

    http://stubes.net/data.php?what=youtubevid&h264=true&id=vjhSp7xGsMc

    You can change the Youtube video’s id in the url. It gives you an XML page where you get a direct link to the H264 file.

  10. Gábor Szántó Says:

    The experimental solution is not working yet, we need to examine further the iPhone Youtube app’s login to get an auth token, described here:

    http://iphone.fiveforty.net/wiki/index.php/Youtube

Leave a Reply