Gary Sieling

Google2SRT Alternatives for command line use

There is a neat GUI tool (written in Java) that extracts subtitles from Youtube, and converts them to the “SRT” subtitle format (which I like for ease of parsing). Youtube has subtitles for most things, because they automatically generate them from the audio.

The downside of this application is that it does not work on the command line, and consequently is nearly worthless for any scale of conversion beyond a few hundred videos, and this is not a feature that the author is intending to add.

However, you can get around this with youtube-dl and ffmpeg combined.

First, you download a video with youtube-dl:

youtube-dl -o ./data/mXC3xGZWo_M"/%(id)s.%(ext)s" -x --sub-lang en \
  --write-sub --sub-format srt --convert-subtitles srt --write-auto-sub 
  --continue --write-info-json --write-description --write-annotations
  --min-filesize 50k --ignore-errors --write-all-thumbnails --no-call-home 
  --audio-format mp3 mXC3xGZWo_M

Then convert it to SRT with ffmeg:

ffmpeg.exe -i mXC3xGZWo_M.en.vtt mXC3xGZWo_M.en.srt

And then you get nice subtitles.

Exit mobile version