YouTube DL - Download Videos & Audio

Download videos and audio from YouTube with youtube-dl. Learn how to specify formats, download playlists, extract audio, and more.

YouTube DL Command Examples

The youtube-dl command-line program is a powerful tool for downloading videos and audio from YouTube and many other video-sharing websites. Below are common usage examples to help you get started.

Download Videos by Format

You can specify the desired video format using the -f flag. It's recommended to check available formats first.

# To download a video in 720p MP4:
youtube-dl -f 22 example.com/watch?v=id

# To download a video in 720p MP4 or WebM or FLV:
youtube-dl -f 22/45/120

List Available Formats

Before downloading, you can see all the formats a video is available in.

# To list all available formats of a video:
youtube-dl -F example.com/watch?v=id

Custom Output Filenames

Organize your downloads by defining a custom output path and filename structure.

# To download a video to /$uploader/$date/$title.$ext:
youtube-dl -o '%(uploader)s/%(date)s/%(title)s.%(ext)s' example.com/watch?v=id

Download Playlists

youtube-dl makes it easy to download entire playlists or specific parts of them.

# To download a video playlist starting from a certain video:
youtube-dl --playlist-start 5 example.com/watch?v=id&list=listid

Simulate Downloads

Use the simulate option to see what youtube-dl would do without actually downloading anything.

# To simulate a download with youtube-dl:
youtube-dl -s example.com/watch?v=id

Download Audio

Extract audio from videos and save it in your preferred format, like MP3.

# To download audio in mp3 format with best quality available
youtube-dl --extract-audio --audio-format mp3 --audio-quality 0 example.com/watch?v=id

Further Information

For a comprehensive understanding of video encoding options and formats on YouTube, refer to the following resource:

YouTube Wikipedia - Quality and formats