I downloaded Python and youtube-dl, on my desktop I saved the file yt-dl.py. My goal is to download video with subtitles. I opened cmd, wrote cd Desktop, pressed enter, after I dragged the file yt-dl.py on the cmd and then I don't know how download video with subtitles (I only know how download video without subtitles: after dragged file, I enter a space and after the link of video). What command could I use to download video with subtitles?
(In the figure there is a mistake: the file is yt-dl.py instead of yt-dll.py)
Thank you for your time.
P.S. I tried the command --write-srt --sub-lang en '' found on How to download videos from YouTube with subtitles? but it does not work. The link which I used is instead of .
In the file yt-dl.py there is .
12 Answers
According to the Readme file for youtube-dl (the program you run as the file yt-dl.py), --write-srt is not an option, but --write-sub is. The Readme file with all options is available here:
I successfully downloaded a video with subtitles using yt-dl.py --sub-lang en --convert-subs srt --write-sub <youtube url>. --sub-lang en chooses english subtitles, --convert-subs srt converts the subtitles to the common SubRib (.srt) format, --write-sub writes the subtitles to a .srt file and <youtube url> is simply the URL/web address of the youtube video page.
An example: yt-dl.py --sub-lang en --convert-subs srt --write-sub
If you use the windows executable, launch your DOS-prompt, navigate to your youtube-dl.exe file and write e.g: youtube-dl.exe --sub-lang en --convert-subs srt --write-sub . The --convert-subs command will not work if you do not have the ffmpeg program installed. If that is the case, you have to omit this option and youtube-dl will output .vtt subtitles instead.
see Subtitle Options () and Post-processing Options ()
My example on fedora 29. youtube-dl --help (youtube-dl --version 2019.08.13)
youtube-dl -ci -f "bestvideo[ext=mp4]"+"bestaudio[ext=m4a]" --write-sub --embed-subs --merge-output-format mp4 --proxy socks5://127.0.0.1:1080/
-c, --continue Force resume of partially downloaded files. By default, youtube-dl will resume downloads if possible.
~
-i, --ignore-errors Continue on download errors, for example to skip unavailable videos in a playlist
~
-f, --format FORMAT Video format code, see the "FORMAT SELECTION" for all the info (requires ffmpeg or avconv installed)
~
--write-sub Write subtitle file
~
--embed-subs Embed subtitles in the video (only for mp4, webm and mkv videos)
~
--proxy URL Use the specified HTTP/HTTPS/SOCKS proxy. To enable SOCKS proxy, specify a proper scheme. For example socks5://127.0.0.1:1080/. Pass in an empty string (--proxy "") for direct connection
~
--merge-output-format FORMAT If a merge is required (e.g. bestvideo+bestaudio), output to given container format. One of mkv, mp4, ogg, webm, flv. Ignored if no merge is required
ref:
2