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…

1 year ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

1 year ago

FTP getting array of file details such as size using PHP

Using FTP and PHP to get an array of file details such as size and…

2 years ago

Creating Laravel form requests

Creating and using Laravel form requests to create cleaner code, separation and reusability for your…

2 years ago

Improving the default Laravel login and register views

Improving the default Laravel login and register views in such a simple manner but making…

2 years ago

Laravel validation for checking if value exists in the database

Laravel validation for checking if a field value exists in the database. The validation rule…

2 years ago