Reputation: 23830
This command downloads the video and embed the auto-generated youtube subtitle to the file
youtube-dl.exe -ci -f "bestvideo[ext=mp4]"+"bestaudio[ext=m4a]" --write-auto-sub --embed-subs --merge-output-format mp4 https://www.youtube.com/watch?v=k4rCdHsdiss
However the subtitle is only embedded. I want it to be burned/hardcoded so that it can be played on non-embed supporting platforms such as treadmill
I am using windows 10
Upvotes: 4
Views: 5915
Reputation: 56
youtube-dl cannot burn the subtitles by itself. You need to use postprocessors like FFmpeg or avconv for it. youtube-dl use them internally for some tasks. As you successfully used bestvideo+bestaudio
argument, you already have installed one of these in your system. avconv is a fork of FFmpeg, so they accept mostly the same arguments. I'll show the FFmpeg case here.
youtube-dl has a feature to add arguments to the postprocessors but I can't see how to use it to solve this task.
Other possibility is using --exec
flag. Regretfully, I have not a Windows machine now so I wrote only Linux variant.
youtube-dl -f "[height=360][ext=mp4]+bestaudio[ext=m4a]" --write-sub --write-autosub --embed-subs --exec "mkdir temp && ffmpeg -i {} -vf subtitles={}:force_style='FontName=Arial' -acodec copy temp/{} && mv -f temp/{} {} && rm -r temp" --restrict-filenames AO4In7d6X-c
This is a one-line command but it has several flaws:
--restrict-filenames
to make it work. No more nice filenames.So my best guess is using FFmpeg manually or with a batch script after downloading the video with youtube-dl. Not tested on Windows but it should work well.
ffmpeg.exe -i "input.mp4" -vf subtitles="filename='input.mp4':force_style='FontSize=20,FontName=Arial'" -c:v libx264 -x264-params crf=22 -preset fast -profile:v high "output.mp4"
input.mp4
must be a file with embedded subtitles.libass
. Type ffmpeg.exe
without arguments and look for --enable-libass
. libx264
is recommended too. crf
parameter. The smaller the number the better quality but also the bigger file size. Numbers from 16 to 30 are optimal.baseline
and lower the level.Upvotes: 4