There is a very powerfull user Interface wrapped around youtube-dl which will allow you to download mass video's from youtube.
Any person that uses a pc for more than 2 hours a day should learn to use the command line. Why? Consider these reasons:
- Powerfull - The commandline is actually your friend, using It wisely will not only teach you to do your job faster and have fun while doing it!
- Endless functionalities - Most programs have an user interface which is actually hiding how the fun stuff works. And to do multiple things you would need to download 100 different programms. In the command line you have unlimited options
- Win Time - You can spend hours when you want for example to download 100 links with most programs which work 1 by 1
- Security - Most programs are not open source so you don't know if you're downloading a virus or a good working program
We will be using youtube-dl which is a Python script that can download video's from Youtube.com.
First you'll have to download and install the Microsoft Visual C++ 2010 redistributable Package (x86) https://www.microsoft.com/en-US/download/details.aspx?id=5555
Downloading and using youtube-dl
This is how the normal flow works when you want to run a specific program that requires another program. Think about Flash, Games, Java.. You need to install other pieces of software to support then. For example for the youtube-dl you would also need to download Python and other dependencies.
Most people prefer User Interfaces because it looks easier, a few clicks and you're done. But the command-line is a very powerful ally. The good guys at youtube-dl provided us with a direct executable that has everything it needs to work directly out of the box without you requiring to install python and other dependencies to make it work.
Go ahead and download it from https://yt-dl.org/latest/youtube-dl.exe
For the purpose of our tutorial you will want to save the executable to your Desktop. In normal circumstances I would advise you to create a special folder and save it there but to keep it simple we'll use the desktop. You can also create a special folder on the desktop or anywhere else and save it there.
Using the command line
Then when it's done downloading you need to open a Windows Command line, you can do that in multiple ways Either with a key combination Windows+R and then when a new window pops up you type cmd Or you click the start button and type cmd and open it
You'll see a black console looking something like this:
There are a few things to notice. Your current directory is your username's home directory. Mine's residing on the C: partition. You can then type cd Desktop which will change the directory to Desktop. Then you can type youtube-dl.exe --help to get a list of command modifiers you can give to the youtube-dl program.
For our purpose we'll download the full game soundtrack of Grim Fandango from https://www.youtube.com/watch?v=km6bLtiSSq4
You can now download any youtube video using. It usually saves the video in mp4 format.
youtube-dl https://www.youtube.com/watch?v=km6bLtiSSq4
To download audio only use the following command
youtube-dl --audio-format mp3 --audio-quality 6 -x https://www.youtube.com/watch?v=km6bLtiSSq4
But notice you''ll get an error (unless you already the required libraries installed)
If you want to download audio or encode the download in other types of formats you actually need to install ffmpeg
Installing FFMPEG
Before we can start enjoying the conversion functionality of youtube-dl we need to install ffmpeg wich is a very nifty powerful tool which encodes audio-video in the commandline as well. Youtube-dl uses it to encode audio-video without you noticing it. You can skip this step if you only want to download the .mp4
Download ffmpeg static builds from https://ffmpeg.zeranoe.com/builds/ Then unzip it into C:\\ and you'll notice a very long name, rename the folder to ffmpeg.
In the commandline you'd use ffmpeg by always providing the full path, type the following to view the codecs available
C:\\ffmpeg\\ffmpeg.exe -codecs
What we actually want is to just use ffmpeg everywhere we are.
To acheive that we need to set the path variable (you can type path in the cmd to what it contains). NOTE that the following command will truncate (eliminate) all other path functions from your path.
setx path “%path%;C:\\ffmpeg\\bin”
IF you want to set the path in a safe way using : http://adaptivesamples.com/how-to-install-ffmpeg-on-windows/
Or you can copy the contents from the ffmpeg\\bin folder to C:\\windows and you can save a lot of time and issues. Note, you need to be admin..
Now run this again and wait untill it encodes it to mp3
youtube-dl --audio-format mp3 --audio-quality 6 -x https://www.youtube.com/watch?v=km6bLtiSSq4
Magic stuff happened! We now have a mp3!
Linux
Some will say "but your blog is about Linux.. and you're going Windows??" Yes.. It's about Linux, and I want all windows users to start using Linux. Linux is much easier.. It's faster. It's much more customisable.. It's the thing your grandma should be using so you don't have to reinstall her pc every 1 month.
But warning, Linux is addicting!
Well, you can easily download it on Debian, Ubuntu, Linux Mint by just typing the following:
sudo apt-get install youtube-dl
Which will take care of downloading the program for you along with any dependencies.
You can then use the youtube-dl commandline anywhere you would like to download and save the
About the soundtrack
Grim Fandango is a very nice tune, if you like the tune consider helping the developers out by buying the game including the full orchestrated tune ffrom https://www.humblebundle.com/store/grim-fandango-remastered
If there are enough requests in the future I might do the following
- Create a script that downloads all dependencies for you on windows
- Create a tutorial on how to create your own front end for youtube-dl. There are already similair front ends so review https://github.com/MrS0m30n3/youtube-dl-gui