Categories: Development

Handy Youtube-dl command to archive a whole Youtube channel

A youtube-dl command to archive a Youtube channel in HD as an mp4, write the downloaded id to a file, save the thumbnail plus embed metadata to the video.

This is the command:

youtube-dl -f "bestvideo[height>=720]+bestaudio/best" -ciw -o "%(id)s.mp4" --add-metadata --embed-thumbnail --download-archive downloaded.txt --merge-output-format mp4 -v [CHANNEL URL]

All the options are from the documentation.

Breaking it down

"bestvideo[height>=720]+bestaudio/best"

This gets the best video (stream) where the resolution height is equal to or greater than 720p. So if the video is available in 4k (2160p)  that will be downloaded.

-ciw

Force resume of partially downloaded files, ignore erros and don’t overwrite files.

-o "%(id)s.mp4"

Save the file as id.mp4 where id is the video id.

--add-metadata --embed-thumbnail

Add metadata about the video into the file and save the thumbnail (id.jpg).

--download-archive downloaded.txt

Creates a text file (downloaded.txt) and writes in each video id that gets downloaded. This helps track and download newly uploaded videos.

-merge-output-format mp4

Merge the video into an MP4. This option is to avoid webm files. If you want webm video files remove this option and change .mp4 to .webm in the -o option.

-v [CHANNEL URL]

The channel URL.

 

Share

Recent Posts

Kennington reservoir drained drone images

A drained and empty Kennington reservoir images from a drone in early July 2024. The…

2 years ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

2 years ago

Early September spring shots

Some early September spring shots from a bushwalk, It is still too early for wildflowers.

3 years ago

Cloning an NVMe to SK Hynix Platinum P41 NVMe

I recently needed to clone over a smaller NVMe to a 2TB SK Hynix Platinum…

3 years ago

Using Laravel’s deleteDirectory to delete folders and their contents

If you ever needed a simple solution in Laravel to delete an entire directory and…

3 years ago

How to allow only 1 user to register in a Laravel application

How to enforce only one user to register or be registered in a Laravel web…

3 years ago