Friday, July 05, 2013

Youtube-dl Annotations

Download youtube videos with the annotations


This is a wrapper for youtube-dl, given a video's URL it will automatically:
  1. Download the video
  2. Download the annotations
  3. Convert the annotations into subtitle format (Credit to: S.F. Yang)
  4. Fix up the naming so that the subtitles are associated with the video


  1. Download the script:
  2. Make sure both youtube-dl and  xmlstarlet are installed on your system
  3. ./


Comparison from original video on youtube

and running in MPC after using youtube-dl-annotations:



Chris Wellons said...

I'm glad someone worked this out. I've always been distrustful of annotations since they're a sort of vendor lock-in. Users who rely on annotations for their videos would find it very difficult to move all of their content to another video hosting service. Video can be saved and uploaded elsewhere, but as far as I know YouTube annotations don't follow any sort of documented standard.

tim said...

a guide for noobs please? :)
i have the video and the annotations downloaded, python instaled, youtube-dl downloaded,MPlayer r37183 for 32-bit Windows downloaded, now what? :)

Gavin Black said...

Hi Tim, sorry it's complicated, seems this gets a lot of traffic so I should probably make it easier. For Windows if you install cygwin( and make sure to also install xmlstarlet (There is a screen during cygwin install to select components) things should work.

It's pretty rare I check this blog lately, so if you want you can e-mail me on gmail, my username is:

If there is enough interest I will look into making a mingw executable (i.e. native windows one) that's easy for people to use.

Anonymous said...

Please do so, Gavin, there is definitely plenty of interest. Perhaps if you do, it's gonna get picked up and implemented natively in youtube-dl.

Gavin Black said...

Yeah overall I think the best bet would be a pull request to youtube-dl. The problem is finding time to get it implemented well enough without relying on external components.

I've also made a useful, very simple, heuristic tool that will determine if the subtitles are 'real' (i.e. not just "Please subscribe"). And on top of that a quick way to check if the subtitles are likely in the video stream itself (hard-subbed), in the captions, or in the official subtitles files and just "do-the-right-thing" so you don't have to think per video. All useful things that would be cool to have bundled into the official youtube-dl.