## youtube-dl - <https://ostechnix.com/youtube-dl-tutorial-with-examples-for-beginners/> --- - Can be used to download videos from webpages with minimal arguments if i go to any directory and run: - `youtube-dl www.exampleURL.com` - It will download the YouTube video. plenty of other options available in the man pages - **DOWNLOAD CAPABILITIES** - Single video URL - Playlist URL (downloads all individual videos) - Channel URL (downloads all videos on the entire YouTube channel) - **DOWNLOAD OPTIONS** - `-F` shows all the formats available for the video download - `-f` followed by a number picks that download options for video quality - `-f bestaudio` will download only the best audio for the video (GREAT FOR MUSIC DOWNLOADS) - `-f140` Downloads the highest quality mp4 files with no errors - `--write-thumbnail` will download the thumbnail(s) of the video(s) - `--skip-download` will skip the download of the actual video but with other options might do something like still download the thumbnails ### Download just thumbnails ```bash youtube-dl --write-thumbnail --skip-download <URL> ``` ### Download transcripts Might have to change `en` to the desired language such as when the language is listed as `english` for subtitles ```bash youtube-dl --sub-lang en --write-auto-sub --sub-format vtt --skip-download <URL> ``` - Combine with [THIS](https://gist.github.com/glasslion/b2fcad16bc8a9630dbd7a945ab5ebf5e) to clean the output to `.txt` ### Download video with english subs written to the video file Might have to change `en` to the desired language such as when the language is listed as `english` for subtitles ```bash youtube-dl --write-sub --sub-lang en <URL> # Combine the video file and subtitles with ffmpeg: ffmpeg -i input_video_file.mp4 -vf subtitles=subtitled_file.english.srt output_file_name.mp4 # Loop through all files present including video files and thier subtitle files with the same names and burn them for file in *.mp4; do ffmpeg -i ${file} -vf subtitles="${file//.mp4/.en.vtt}" ${file//.mp4/.NEW.mp4}; done ``` ### Formatting filenames of downloaded playlist: ```bash youtube-dl --format mp4 -o "%(upload_date)s %(title)s by %(uploader)s.%(ext)s" <URL> ```