Avatar
Linux, plaintext & minimalism

Notice: This blog have moved to hunden.linuxkompis.se. Read more about it here: My blog have a new home and a new address.

May 10, 2019

How to download YouTube-videos with subtitles using youtube-dl

It wasn’t obvious how this feature with youtube-dl worked, so I thought I would document it here. If you want to download a video from YouTube with embedded subtitles into the video, you can use this command:

$ youtube-dl --write-auto-sub <URL>

It will default to English, but you can specify another language with the flag --sub-lang:

$ youtube-dl --sub-lang sv --write-auto-sub <URL>

You can list all available subtitles with:

$ youtube-dl --list-subs <URL>

It’s also possible to skip the video and only download the subtitle if you add the flag --skip-download:

$ youtube-dl --sub-lang sv --write-auto-sub --skip-download <URL>

For more information consult the manual: man youtube-dl.

Tags: youtube-dl | YouTube | Subtitles | Video | CLI

Feedback

I don't have a commenting system simply because I haven't found a solution that I like. If you want to leave any feedback and/or have any questions, feel free to contact me either via e-mail, fediverse, XMPP or IRC (I'm Hund at freenode.net).