Youtube-dl: a sample config file

Useful miscellaneous tech tricks and tips…

I’m sure, like everyone else in the world, that you’ve wanted to convert Youtube videos into audio. But there are so many shady sites and you don’t know which ones are safe…(does anyone actually buy the music?)

Youtube-dl is by far the most useful youtube to audio/video converter. There are literally so many things you can do with it, SO MANY OPTIONS. I’ve only took dabbled a bit, mostly because I want to listen to music on Youtube I can’t find on Apple Music, and also because I want to change the pitch of songs and take out the vocals to practice Karaoke.

It’s a project on Github, which you can find here. That’s also where you can find the installation instructions and everything. It took me like…2-3 hours on Windows but it was totally worth it, because now I don’t have to suffer thinking I’m going to install malware when I used those shady youtube-mp3 sites.

BTW, I use ffmpeg to do the conversion, which youtube-dl requires (you can also use avconv but I’ve never used that). Sometimes there’s detection issues with ffmpeg, you can try putting it in the same folder as your youtube-dl folder.

Description from the Github:

“Youtube-dl is a command-line program to download videos from YouTube.com and a few more sites. It requires the Python interpreter, version 2.6, 2.7, or 3.2+, and it is not platform specific. It should work on your Unix box, on Windows or on macOS. It is released to the public domain, which means you can modify it, redistribute it or use it however you like.”

Anywho, because it’s a bit of a struggle when you just want to convert a video to audio/video for casual listening, here’s what I wrote in the config file I use to convert Youtube videos to mp4 (config file just means that these instructions will be executed every time you run the program, specifying where the file should be put, what type of file it should be converted into, what type of audio, etc.)

 --audio-format "mp3"
--output "C:\Users\my_name\Music\youtube-dl\%(title)s.%(ext)s"
--format 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4'

But what if you just want audio? Here’s what I do:

--audio-format "mp3"
--output "C:\Users\my_name\Music\youtube-dl\%(title)s.%(ext)s"
--extract-audio

Obviously, change the path from “my_name” to your actual username. Also, here is how to run the program in Windows Powershell:

.\youtube-dl https://www.youtube.com/watch?v=LbuuTeGGwnY

Have fun 😀

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s