welcome to my yt-dlp guide!
disclaimer: i am not an expert, but i want to share what i know! also, this guide is for windows! i dont know if it works the same on other operating systems.
what is yt-dlp?
yt-dlp is a free and open source command line video/audio downloader, which you will use through powershell. it gets the media straight from the source, and you don't have to risk getting a virus by going to some third party youtube downloader.
in the age of not even owning the things you buy, and media suddenly disappearing due to censorship, i think tools like these are more useful than ever.
note: it works on many different sites, not just youtube! BUT: it doesn't work on spotify. keep this in mind!
setup
1. download yt-dlp
here you can choose the version
here is the direct link to the windows download
2. decide on a folder where you will put yt-dlp
you will also put two other important parts of the program here (yt-dlp.ffmpeg and yt-dlp.conf), i will explain later.
i will use C:\yourfolder as the example folder in this guide.
3. put yt-dlp.exe into C:\yourfolder
4. (optional) install the newest version of powershell
this is for quality of life. the new version has completion suggestions, which means you don't have to type out every command. so it's not strictly necessary, but highly recommended.
you will install it through winget, which is a package manager. those let you install things through the command line.
(i am not specifying what version of powershell "the newest version" is, because i dont know when you will read this guide, and the steps to update to the latest version should remain the same)
- press the windows key, type
powershelland press enter - in powershell, type the command:
winget install -e Microsoft.PowerShelland press enter - you will be asked to accept the terms, type
yand press enter - when its finished, close the old powershell
- open the new powershell by pressing the windows key, typing
pwshand pressing enter
steps
5. download yt-dlp.ffmpeg
in simplified terms, yt-dlp.ffmpeg is the part that converts the downloaded files into the formats you want, like .mp4 and .mp3.
- in powershell, type:
winget install yt-dlp.ffmpeg --verbose -l "C:\yourfolder\winget"and press enter
step singular. only one step
6. create your config file
the config file contains a command so you dont have to enter it manually every time.
the command i'm showing sorts the available downloads by quality and a well-compatible audio codec (so you can play it on any device/app) and downloads the best one of those.
- open a new text file with notepad
- copy this into the text file:
--ffmpeg-location "C:\yourfolder\winget\ffmpeg[...]\bin" -S quality,acodec:aac
-> NOTE: the [...] part is different for everyone. theres only one folder in \winget that starts with ffmpeg. so just nagivate to the bin folder and then copy the path, and paste it where i put"C:\yourfolder\winget\ffmpeg[...]\bin" - save it as
yt-dlp.conf- NOT .txt! - put your yt-dlp.conf file into C:\yourfolder
steps
7. add yt-dlp to path
this just means telling powershell that, when you type yt-dlp in a command, you want it to call C:\yourfolder\yt-dlp.exe
- press the windows key, type
sysdm.cpl, and press enter - at the top, click on Advanced
- then, at the bottom right, click on Environmental Variables
- on the User Variables window, click on Path
- click on Edit
- in the Edit Environment Variables window, click new
- paste in the path to your yt-dlp.exe, so in our example, its
C:\yourfolder\yt-dlp.exe - click Ok on every window
- restart powershell for changes to apply
steps
you're ready to go!
you will use yt-dlp through powershell and download stuff through commands.
here are the commands i've used, and are probably most frequently needed.
commonly used commands
to download a video
yt-dlp -P "C:\savingfolder" https://www.youtube.com/watch?v=dQw4w9WgXcQ
note: obviously, put in your own link of the video you want to download, this is a placeholder. "C:\savingfolder" is also a placeholder i've used here for the folder you will want to save your videos in.
to download a video as an mp3
yt-dlp -t mp3 -P "C:\savingfolder" https://www.youtube.com/watch?v=dQw4w9WgXcQ
to download a playlist
yt-dlp -P "C:\savingfolder" -o "%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s" https://www.youtube.com/watch?v=dQw4w9WgXcQ&list=RDdQw4w9WgXcQ&start_radio=1
note: this will create a folder inside your folder, containing your playlist in the correct order.
for age restricted videos
yt-dlp -P "C:\savingfolder" https://www.youtube.com/watch?v=dQw4w9WgXcQ --cookies-from-browser Firefox
note: this tells yt-dlp to use your cookies, so if youre logged into your youtube account in your browser, it will access the video through your account. dont worry, you are not giving this information to a third party, because yt-dlp runs locally. i put Firefox here, but put which ever browser you are using. the accepted ones are: brave, chrome, chromium, edge, firefox, opera, safari, vivaldi, whale
to update yt-dlp
yt-dlp -U
tidbits
workaround if downloading a video as mp3 doesnt work
yt-dlp -x youtube.com/watch?v=dQw4w9WgXcQ --extractor-args "youtube:player_js_version=actual" -P "C:\savingfolder" https://www.youtube.com/watch?v=dQw4w9WgXcQ
note: this will download an .m4a file, which is a well-supported audio format too.
locally convert mp4
to mp3: ffmpeg -i "C:\savingfolder\yourfile.mp4" -map 0:a "C:\savingfolder\yourfile.mp3"
to aac: ffmpeg -i "C:\savingfolder\yourfile.mp4" -vn -acodec copy "C:\savingfolder\yourfile.aac"
always save to same folder
remember the yt-dlp.conf file? you can specify other things in there, for example -P "C:\savingfolder", then you wont have to put it into your command.
useful links
yt-dlp READMEyt-dlp FAQ
output template files
format selection examples
(you can use ctrl+f on these pages to find what you need!)