Last active
October 20, 2023 09:31
-
-
Save nickyfoto/738b74246c775b113a68eb937ec9b16c to your computer and use it in GitHub Desktop.
Download video and its subtitle and merge subtitle to it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# list available subtitles | |
# https://superuser.com/questions/927523/how-to-download-only-subtitles-of-videos-using-youtube-dl | |
youtube-dl --list-subs https://www.youtube.com/watch?v=lmWh9jV_1ac | |
# download a particular subtitle | |
youtube-dl --write-sub --sub-lang zh-CN --skip-download https://www.youtube.com/watch\?v\=lmWh9jV_1ac | |
# download auto generated sub | |
youtube-dl --write-auto-sub --sub-lang zh-CN --skip-download https://www.youtube.com/watch\?v\=lmWh9jV_1ac | |
# https://stackoverflow.com/questions/8672809/use-ffmpeg-to-add-text-subtitles | |
# https://en.wikibooks.org/wiki/FFMPEG_An_Intermediate_Guide/subtitle_options | |
ffmpeg -i infile.mp4 -i infile.srt -c copy -c:s mov_text -metadata:s:s:0 language=eng outfile.mp4 | |
# if your ffmpeg has libass enabled at compile time, you can directly do: | |
ffmpeg -i mymovie.mp4 -vf subtitles=subtitles.srt mysubtitledmovie.mp4 | |
# https://askubuntu.com/questions/486297/how-to-select-video-quality-from-youtube-dl | |
# list all available video format | |
youtube-dl -F 'http://www.youtube.com/watch?v=P9pzm5b6FFY' | |
# download a particular one | |
youtube-dl -f 22 'http://www.youtube.com/watch?v=P9pzm5b6FFY' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment