~/Blog

Brandon Rozek

Photo of Brandon Rozek

PhD Student @ RPI studying Automated Reasoning in AI and Linux Enthusiast.

Backing Up YouTube Content

Published on

Updated on

There are great content on YouTube that I would be sad if it went away. Therefore, I did some digging around and found a great discussion on Reddit on backing up YouTube videos. The solution is based on youtube-dl and I modified the script a little to fit my needs.

The options added to youtube-dl makes it so that meta information such as subtitles, thumbnails, etc get added to the video.

youtube-dl --ignore-errors \
           --playlist-reverse \
           --output "%(uploader)s/%(uploader)s - %(title)s - %(upload_date)s.%(ext)s" \
           --format "bestvideo[ext=mp4]+bestaudio[ext=m4a]" \
           --merge-output-format mp4 \
           --all-subs \
           --embed-subs \
           --embed-thumbnail \
           --add-metadata \
           URL_HERE

Audio Only

To extract only audio here’s the modified command

youtube-dl --ignore-errors \
           --playlist-reverse \
           --output "%(uploader)s/%(uploader)s - %(title)s - %(upload_date)s.%(ext)s" \
           --format "bestvideo[ext=mp4]+bestaudio[ext=m4a]" \
           --merge-output-format mp4 \
           --embed-thumbnail \
           --add-metadata \
           --extract-audio
           URL_HERE
Reply via Email Buy me a Coffee
Was this useful? Feel free to share: Hacker News Reddit Twitter