Methods of downloading YouTube videos have changed over the years. Here are two of my preferred methods for doing so in 2022.
tl;dr: easy:
Use a Youtube-Mp3 converter site, if you know how to Google then you’ve probably found one of these already.
tl;dr: is asked to fix printers:
Get the latest ‘youtube-dl’ fork like yt-dlp. Use ffmpeg to convert.
Easy
Yeah there’s really nothing else you need here
The Other Method
- Get yt-dlp. Put it in a folder somewhere in
C:\
like ‘youtubedownload’. Rename the .exe file to yt.exe
. - Get ffmpeg. Put it in the same folder. You could rename this .exe file if you want as well, the names will be the commands used in the future.
- Press the WINDOWS key, and type ‘path’.
(INCOMING WALL OF PICTURES)
- Choose ‘Enviroment Variables’
- Then,
- You can then add a new entry for the ‘path’ environment variable. The system uses this to allow the executing directory to be in any directory listed in the path. Meaning, when you run a command in CMD, the system will always check any directories in the ‘path’.
- Click OK on all open windows after adding the directory the exes are in to the ‘path’.
Example Usage
We will be using this song from YouTube: Moving Romance – Yoann Garel. It’s also available on Soundcloud here.
Right click on your Desktop > ‘Open Command Window Here’. If you don’t have this option in the context menu, you can download these registry edits to add it.
Next type the name of the yt-dlp .exe followed by a space and the url. So if you renamed it ‘yt’ like stated previously, it would look like so:
yt https://www.youtube.com/watch?v=dIMdcJWOEFM
Hitting enter will start downloading that video to the desktop directory you just launched the CMD window in. (Hint! If you want to use a Soundcloud URL like we have below, that will work too! Isn’t technology great?)
If you want to convert the resulting video to a proper audio file like .mp3, you have two options. You can use the quick solution right from yt-dl:
yt -x --audio-format mp3 [video_url]
Or to download a playlist:
youtube-dl --extract-audio --audio-format mp3 -o "%(title)s.%(ext)s"
You can ignore missing (“unavailable in your country”, or removed) videos with an -i
flag. If your playlist isn’t working and the URL contains v=<ID>
, remove it so just the ?list=
item is in the query string.
Or, since ffmpeg is useful for other tasks (and you should have it anyway), you can use it directly. A simple syntax of an ffmpeg command that would convert to an mp3 would look like ffmpeg -i [input file name] [output file name].[output file extension]
. But wait, we don’t want to type that long, ugly file name in that yt-dlp just spit out onto our desktop… luckily we have a trick for that.
Run ‘dir /x
‘ in the open CMD window.
This is an extremely helpful windows command that will show ‘short’ filenames for files, making working with longer file names a breeze. Windows is telling us in the screenshot above that we can refer to the video we just downloaded as ‘moving~3.web’. Now assuming no renaming of the ffmpeg .exe took place in the setup step, our command simply becomes:
ffmpeg -i moving~3.web output.mp3
And you’re done! You now have ‘output.mp3’ on your desktop saved as the song we were just playing on YouTube. I’ve combined this process with scripted metadata adding/titling for an offline library. And, with the right yt-dlp commands it can even become an efficient way to export entire playlists of music.
It helps me if you share this post
Published 2022-03-06 02:23:43