In this step by step tutorial, you'll see how to download videos from YouTube using yt-dlp, the most reliable YouTube video downloader for computers. Whether you need to download single videos, entire playlists, or resume interrupted downloads, this guide covers all the essential techniques for free YouTube video downloading on Windows, Mac, and Linux.

yt-dlp is a powerful command-line tool that supports 4K video downloads, audio extraction, and playlist management, making it the preferred choice for developers and power users.

1: Install yt-dlp and Required Tools

First, install yt-dlp and ffmpeg (required for audio/video processing):

Windows:

pip install yt-dlp

Download ffmpeg from https://ffmpeg.org/download.html and add to PATH.

Mac:

brew install yt-dlp ffmpeg

Linux:

sudo apt install ffmpeg
pip3 install yt-dlp

Verify installation:

yt-dlp --version

Output Result:

2024.12.15

Update yt-dlp regularly for bug fixes and new features:

pip3 install yt-dlp -U

2: Download Single YouTube Video

The simplest way to download a YouTube video is using the video URL:

yt-dlp "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

Output Result:

[youtube] Extracting URL: https://www.youtube.com/watch?v=dQw4w9WgXcQ
[youtube] dQw4w9WgXcQ: Downloading webpage
[youtube] dQw4w9WgXcQ: Downloading ios player API JSON
[youtube] dQw4w9WgXcQ: Downloading android player API JSON
[info] dQw4w9WgXcQ: Downloading 1 format(s): 22
[download] Destination: Rick Astley - Never Gonna Give You Up [dQw4w9WgXcQ].mp4
[download] 100% of 12.45MiB in 00:05

By default, yt-dlp downloads the best available quality (up to 4K resolution if available).

Download Specific Quality

Download 1080p video:

yt-dlp -f "bestvideo[height<=1080]+bestaudio" "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

Download 4K video:

yt-dlp -f "bestvideo[height<=2160]+bestaudio" "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

List available formats:

yt-dlp -F "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

Output Result:

ID  EXT   RESOLUTION FPS │   FILESIZE   TBR PROTO │ VCODEC        ACODEC
─────────────────────────────────────────────────────────────────────
18  mp4   640x360     30 │   12.45MiB  200k https │ avc1.42001E   mp4a.40.2
22  mp4   1280x720    30 │   45.67MiB  700k https │ avc1.64001F   mp4a.40.2
137 mp4   1920x1080   30 │   89.23MiB 1200k https │ avc1.640028   video only

3: Download YouTube Video as MP3 Audio

Extract audio from YouTube videos and convert to MP3 format:

yt-dlp -f bestaudio "https://www.youtube.com/watch?v=XCihOV7o4MQ" --exec "ffmpeg -i {} -codec:a libmp3lame -qscale:a 0 {}.mp3 && rm {}"

Output Result:

[youtube] Extracting URL: https://www.youtube.com/watch?v=XCihOV7o4MQ
[download] Destination: Adele - Hello [XCihOV7o4MQ].m4a
[download] 100% of 8.92MiB in 00:03
[exec] ffmpeg -i Adele - Hello [XCihOV7o4MQ].m4a -codec:a libmp3lame...
[exec] Successfully converted to MP3
[exec] Original file removed

Simplified MP3 download (without ffmpeg post-processing):

yt-dlp -x --audio-format mp3 "https://www.youtube.com/watch?v=XCihOV7o4MQ"

Command breakdown:

  • -f bestaudio - Downloads best audio quality
  • --exec - Executes command after download
  • ffmpeg -i {} - Converts downloaded file
  • -codec:a libmp3lame - Uses MP3 encoder
  • -qscale:a 0 - Highest audio quality (320kbps)
  • && rm {} - Removes original file after conversion

4: Download Entire YouTube Playlist

Download complete playlists with a single command:

yt-dlp -f bestaudio "https://www.youtube.com/watch?v=6fGEUFBOTTM&list=PLL1tCjVaN7d-bBwohh-6DW6E8phyLgjSM" --exec "ffmpeg -i {} -codec:a libmp3lame -qscale:a 0 {}.mp3 && rm {}"

Output Result:

[youtube:tab] Extracting URL: https://www.youtube.com/playlist?list=PLL1tCjVaN7d...
[youtube:tab] Playlist: Python Tutorial for Beginners
[download] Downloading playlist: Python Tutorial for Beginners
[youtube:tab] Playlist Python Tutorial for Beginners: Downloading 50 items
[download] Downloading video 1 of 50
[youtube] 6fGEUFBOTTM: Downloading webpage
[download] Destination: 01 - Introduction to Python [6fGEUFBOTTM].m4a
[download] 100% of 5.23MiB in 00:02
[exec] Converting to MP3...
[download] Downloading video 2 of 50
...

Download Specific Playlist Items

Download videos 2 through 8:

yt-dlp -c --playlist-start 2 --playlist-end 8 "https://www.youtube.com/playlist?list=PLL1tCjVaN7d-bBwohh-6DW6E8phyLgjSM"

Download first 5 videos:

yt-dlp -c --playlist-end 5 "https://www.youtube.com/playlist?list=PLL1tCjVaN7d-bBwohh-6DW6E8phyLgjSM"

Download from video 7 onward:

yt-dlp -c --playlist-start 7 "https://www.youtube.com/playlist?list=PLL1tCjVaN7d-bBwohh-6DW6E8phyLgjSM"

Download specific videos (2, 4, 6):

yt-dlp -c --playlist-items 2,4,6 "https://www.youtube.com/playlist?list=PLL1tCjVaN7d-bBwohh-6DW6E8phyLgjSM"

5: Resume Interrupted Downloads

yt-dlp automatically resumes downloads by default. For additional reliability, use these flags:

yt-dlp -c -i -w "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

Flag explanations:

  • -c, --continue - Force resume of partially downloaded files
  • -i, --ignore-errors - Continue on errors (skip unavailable videos)
  • -w, --no-overwrites - Don't overwrite existing files

Output Result:

[download] Resuming download at byte 5242880
[download] 42% of 12.45MiB at 1.23MiB/s ETA 00:05
[download] 100% of 12.45MiB in 00:08

Real-world scenario:
If your internet connection drops or download is interrupted, simply run the same command again. yt-dlp will automatically detect the partial download and continue from where it stopped.

6: Advanced Download Options

Download with Subtitles

yt-dlp --write-sub --sub-lang en "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

Output Result:

[download] Destination: Rick Astley - Never Gonna Give You Up [dQw4w9WgXcQ].en.vtt
[download] Destination: Rick Astley - Never Gonna Give You Up [dQw4w9WgXcQ].mp4

Download Video Thumbnail

yt-dlp --write-thumbnail "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

Download with Custom Filename

yt-dlp -o "%(title)s.%(ext)s" "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

Download to Specific Folder

yt-dlp -o "~/Downloads/YouTube/%(title)s.%(ext)s" "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

Limit Download Speed

yt-dlp -r 1M "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

This limits download speed to 1 MB/s to avoid bandwidth congestion.

7: Download Multiple Videos from Text File

Create a text file with YouTube URLs (one per line):

videos.txt:

https://www.youtube.com/watch?v=dQw4w9WgXcQ
https://www.youtube.com/watch?v=XCihOV7o4MQ
https://www.youtube.com/watch?v=6fGEUFBOTTM

Download all videos:

yt-dlp -a videos.txt

Output Result:

[download] Downloading video 1 of 3
[youtube] dQw4w9WgXcQ: Downloading webpage
[download] 100% of 12.45MiB in 00:05
[download] Downloading video 2 of 3
[youtube] XCihOV7o4MQ: Downloading webpage
[download] 100% of 8.92MiB in 00:03
[download] Downloading video 3 of 3
...

8: Troubleshooting Common Issues

Error: "Video unavailable"

Solution: Update yt-dlp to the latest version:

pip3 install yt-dlp -U

Error: "Unable to extract video data"

Solution: Use cookies from your browser:

yt-dlp --cookies-from-browser chrome "https://www.youtube.com/watch?v=VIDEO_ID"

Error: "HTTP Error 429: Too Many Requests"

Solution: Add delay between downloads:

yt-dlp --sleep-interval 5 "PLAYLIST_URL"

Error: "Requested format not available"

Solution: List available formats and choose manually:

yt-dlp -F "VIDEO_URL"
yt-dlp -f 22 "VIDEO_URL"

Quality and Format Options

Format Resolution Use Case
bestvideo+bestaudio Highest available Maximum quality
bestvideo[height<=1080] 1080p Full HD Standard high quality
bestvideo[height<=2160] 4K Ultra HD Maximum resolution
bestaudio Audio only Music, podcasts
worst Lowest quality Save bandwidth/storage