To convert a Youtube video or any video for that matter requires just one step, in essence, you will transcode the video file (normally an MP4) to MP3 using ffmpeg.
However, in the case of Youtube there is an extra step, you need to actually download a video from Youtube first. Let us start there.
How to download a Youtube Video
To download a video from youtube will need to use the software called youtube-dl, it’s very straight forward, in essence, you will use the command line (CMD on Windows) to tell it the URL of the video you want to download and then the program will download the video and store the file in the folder you specify.
Download “youtube-dl” from here, then save this to a folder on your desktop. Call the folder “YT-to-MP3”.
In other words, create a folder on your desktop and call it “YT-to-MP3”.
Now download “youtube-dl”, by default it will sit in your downloads folder, go there and then copy it from there to the folder on your desktop.
Open CMD (Inside the search field from your taskbar, enter command or cmd. Then, click or tap on the Command Prompt result.)
Navigate to the folder on your desktop through CMD, the one we called “YT-to-MP3”. You can do that by typing the following command:
Type it exactly like that (copy it), do not change anything, that
\%username%\ part is intentional, it will essentially resolve to whatever your username is, which I won’t know since I sitting in Cape Town and don’t your PC name.
If you did it correctly then you will see you are successfully inside that folder.
Microsoft Windows [Version 10.0.18363.1016] (c) 2019 Microsoft Corporation. All rights reserved. C:\Users\erikthiart>cd C:\Users\%username%\Desktop\YT-to-MP3 C:\Users\erikthiart\Desktop\YT-to-MP3>
If you remember in Step 1 you copied the youtube-dl.exe file to this folder; so now you can talk to the youtube-dl program through the command line like so:
You are telling youtube-dl to download that URL to this folder, but let us make the downloaded file unique just in case you intend to go wild and download a lot of videos.
Change it to:
youtube-dl -f "best" -o "%(title)s.f%(format_id)s.%(ext)s" URL-of-The-Video
youtube-dl -f "best" -o "%(title)s.f%(format_id)s.%(ext)s" https://youtu.be/2kkKK_kexIQ
You will now notice that the file is in that folder. Now we are going to convert this video file to MP3 using a program called ffmpeg, the process is very similar to what you just did with youtube-dl.
Download ffmpeg.exe from here: Click here, then do the same as you did in step 1. Save this program to the folder on your desktop called “YT-to-MP3”. If it downloaded a zip file, open it and copy the .exe file over to the folder on your desktop. Now inside that folder, you should have “youtube-dl.exe”, the file you downloaded and “file.something” and “ffmpeg.exe”.
Using CMD again run the following command to convert the video file to an mp3 file. This time you will use ffmpeg instead of youtube-dl, but it is the same idea, in essence, you are now telling ffmpeg to take the video file and transcode it to an audio file (that is why we have .mp3 there.)
ffmpeg -i "the-name-of-the-video-you-downloaded.mp4" "give-this-a-name-of-your-choice.mp3"
ffmpeg -i "Digital Council Africa and Why All Local Municipalities Need Good Connectivity.f22.mp4" "Digital Council Africa and Why All Local Municipalities Need Good Connectivity.f22.mp3"
Done. Congratulations you have done something awesome that you probably think you could not do when you landed on this page. Truth is, so many things only seem complex until you sit back and just try to break it down into little pieces. Elon Musk has a great way of solving problems that he calls “First Principles”. In our case, we knew we want an audio version of a Youtube video, but that sounds daunting – however as you saw it really only becomes a two-part issue. Part one, you need to download the file from youtube and Part two, you now need to convert that video file to audio. We found that youtube-dl solves the first part and ffmpeg solves the second part, easy stuff.
Youtube-dl has a ton more options, to skip the ffmpeg part you could modify your command like this:
youtube-dl -f " bestaudio" -o "%(title)s.f%(format_id)s.%(ext)s" URL-of-The-Video
That will create an m4a audio file, which will be fine in most cases, but just figured let me show you the long way first so that you understand the process better.
If you have a specific task that you would like to solve, but don’t know how to do it, then send me a tweet @ErikThiart and I will see if I can create a tutorial for you. It’s free, basically, you suggest what I can write about and if it’s within my domain of understanding then I will write about it.
Why is this Guide of mine better to download and convert Youtube Videos to MP3 than the online services?
Safe and Virus Free
Well for starters, these free youtube to mp3 sites and software are filled with viruses and malware, normally. This way, however, by doing it yourself, you are in complete control of every step of the process – no malicious stuff is happening behind your back, you can see what you are doing.
Then the other benefit, is that this way it is free and unlimited, you can download as many videos as you want without any restrictions.
What is FFmpeg?
FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. It is also highly portable: FFmpeg compiles, runs, and passes our testing infrastructure FATE across Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, etc. under a wide variety of build environments, machine architectures, and configurations.
What is Youtube-DL?
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.
Please do not download videos from Youtube that you do not own. This guide is for educational purposes only, I just want to teach you how to solve problems and how to think. So, use this knowledge accordingly and not in nefarious ways.
If you found this guide to be useful and would like to make a donation, please head over to my donations page, the money gets split between beer and hosting costs. I need the hosting account to keep this content alive and I need the beer in order to keep myself alive.
Whether it happens gradually over time or all of a sudden, trying to work with a slow computer can be seriously frustrating. Even if you’re fairly diligent with the maintenance of your laptop or PC, it’s surprising how quickly things slow down. If you are asking yourself “Why is my laptop so slow” and running Windows 10, 8, or 7, this post is for you!Read The Article
The Sonoff lightbulbs are very affordable and provide you with the basic functionality that a smart home needs. If the budget is tight and you don’t need all bells and whistles of the more expensive lights, Sonoff lightbulbs will do the job just fine. The prices start from $9.90 for the (plastic, White + color temperature) B02 B A60 and $12.90 for the fancy, pear-shaped B02-F-ST64 (glass, retro look, White + color temperature). As far as connected lights go, the prices are very attractive and Sonoff lightbulbs indeed are as inexpensive as you can get.Read The Article
The following mikrotik firewall rules will force all the clients on your local network like your Sony PlayStation and Google Chromecast to use your Pi-hole or your own local server as their primary DNS server, even if they have hard coded their own DNS servers we do this because many apps and devices do not use the offered DNS servers per DHCP, they are just that – an offer. Hardcoded DNS servers will still resolve and allow ads and tracking unless we use NAT rules that will redirect all DNS requests, no matter where they go, to the Pihole.Read The Article
You probably know the Sonoff brand for smart home electronics like the POW R2 or the Sonoff Basic switches, but they also released a security camera, the Sonoff GK-200MP2-B. I decided to try it out and made an in-depth review so you can make the right decision. Considering this is Sonoff, a well-known brand for robust electronics. I expect a good working, premium product that just works especially since to use the Sonoff GK200MP2-B, you need the eWeLink application which integrates very well with other Sonoff devices.Read The Article
Enclosed in the same shell, SNZB-02 Zigbee temperature & Humidity sensor reports back every couple of minutes. The sensor is powered by CR2450 3V battery. The extra capacity means that the sensor will last a really long time. I have a heater connected to eWeLink app and, once I added a hub (absolutely required) this thing has performed well. The heater is controlled within +- 1°C. That's another thing, eWeLink only provides temperature readings in °C with no option for °F. I'm thinking about placing another sensor on the outside of the window so that I can control based on outdoor temperature as well.Read The Article
I know this review is long, but I wanted to include all the details to help you decide. This smart security camera from Xiaomi had so much going for it, I still believe there a route for Xiaomi to redeem themselves and make this camera available to its full potential by issuing a firmware update to remove the restrictions and allow RTSP access from the Xiaomi camera.Read The Article