Skip to content
Back to Blog
Tech Tips

Download YouTube Videos & MP3s via the Windows Terminal

A complete guide to using yt-dlp on Windows to download videos and music from YouTube directly from the command line.

A
Alif Afriza Author
· · 4 min read
Download YouTube Videos & MP3s via the Windows Terminal

Why Use the Terminal?

Most people use third-party websites or apps to download YouTube videos. But there is a faster, safer, and more powerful way: using the terminal or command line.

You don’t need to be a programmer to use this method. Just follow the steps, and you’ll be able to download your favorite videos or music in seconds.

Preparation: Install yt-dlp

yt-dlp is an open source tool that is the successor to youtube-dl. It supports thousands of websites, not just YouTube.

Open Windows PowerShell or Terminal as admin, then run:

winget install yt-dlp

Install via Chocolatey

choco install yt-dlp

Verify the Installation

yt-dlp --version

If a version appears (for example, 2024.xx.xx), the installation was successful.

Fun Fact: yt-dlp is supported by a very active open source community. It is updated almost every week to keep up with changes on YouTube and other websites.

Download a YouTube Video

Download the Best Quality Video

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

The video will be automatically saved in the current folder in the best quality available.

Download to a Specific Folder

yt-dlp -o "C:\Users\%USERNAME%\Downloads\%(title)s.%(ext)s" "https://www.youtube.com/watch?v=VIDEO_ID"

Choose Video Quality

# List all available formats
yt-dlp -F "https://www.youtube.com/watch?v=VIDEO_ID"

# Download 720p quality
yt-dlp -f "bestvideo[height<=720]+bestaudio" "https://www.youtube.com/watch?v=VIDEO_ID"

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

Download an Entire Playlist

yt-dlp "https://www.youtube.com/playlist?list=PLAYLIST_ID"

Download Audio / MP3 Only

This is what people search for most: downloading music from YouTube in MP3 format.

Download as MP3

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

Download as FLAC (Lossless)

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

Download Audio from a Playlist

yt-dlp -x --audio-format mp3 "https://www.youtube.com/playlist?list=PLAYLIST_ID"

Advanced Features

Download with Subtitles

# Download video + Indonesian subtitles
yt-dlp --sub-lang id --write-subs "https://www.youtube.com/watch?v=VIDEO_ID"

# Download subtitles only (without video)
yt-dlp --skip-download --sub-lang id --write-subs "https://www.youtube.com/watch?v=VIDEO_ID"

Download Thumbnail

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

Download with a Size Limit

# Download only videos whose size is under 100MB
yt-dlp -f "best[filesize<100M]" "https://www.youtube.com/watch?v=VIDEO_ID"

Fun Fact: yt-dlp Can Download from Anywhere

yt-dlp is not just for YouTube. It supports more than 1000 websites, including:

  • Vimeo, a professional video platform
  • TikTok, download without watermark
  • Twitter/X, download videos from tweets
  • Instagram, download reels and stories
  • Facebook, download videos from posts
  • Bilibili, the largest video platform in China
  • Twitch, download highlights and clips

Just replace the YouTube URL with the URL from another website, and the same command will work.

Pro Tips

Use a Configuration File

Create a config.txt file in the same folder as yt-dlp:

# config.txt
-o C:\Users\%USERNAME%\Downloads\%(title)s.%(ext)s
-x --audio-format mp3
--embed-thumbnail
--add-metadata

Now just run yt-dlp URL and all options will be applied automatically.

Create a Desktop Shortcut

Create a simple .bat file:

@echo off
echo Enter YouTube URL:
set /p url=
yt-dlp -x --audio-format mp3 -o "C:\Users\%USERNAME%\Downloads\%%(title)s.%%(ext)s" %url%
pause

Save it as download-yt.bat. Now you can double-click this file and paste a URL for a quick download.

Troubleshooting

“yt-dlp is not recognized”

# Restart the terminal after installation
# Or manually add it to PATH:
$env:Path += ";C:\Users\%USERNAME%\AppData\Local\Microsoft\WinGet\Packages"

“Video unavailable” or Error 403

# Update yt-dlp to the latest version
yt-dlp -U

# Or reinstall
winget install yt-dlp --force

Slow Downloads

# Use a proxy
yt-dlp --proxy socks5://127.0.0.1:1080 "URL"

# Or limit the rate
yt-dlp --limit-rate 1M "URL"

Conclusion

Using yt-dlp through the terminal is not just about looking “cool”; it is a more efficient, safer, and more flexible way to download content from the internet.

You don’t need to install suspicious apps, visit websites full of ads, or worry about malware. Just one line of command, and the content is saved on your computer.

Happy downloading, and don’t forget to always respect the copyright of the content you download.

Open for Contributors

Your ideas deserve to be read by thousands of people.

ByteNesia is built for everyone. If you have experience, tutorials, or opinions about technology, write and share them here. Your name will be credited as a contributor.

Write anything: tool reviews, homelab tutorials, security tips, or your tech stories.

Discussion & Comments