The Two Percent

Hire Me

How to download YouTube (or Mixcloud) to MP3 on your own computer

There is a lot of great music on YouTube and with the advent of Twitch and video streaming a lot of cool DJ sets that aren’t knocking around and easy to download.

If you want these as a MP3s, you would have typically had to search for something like “YouTube to MP3” and then put up with spam websites getting you to click adverts and stuff. I thought there must be a better way! And there is.

1) Open Terminal
Open Terminal on your Mac. Terminal is a command line program, so you need to type commands and then press return to run them.

2) Install Brew
Brew is like an app store for command line programs.
You can check you have it or not on your system by running brew -v and if you get info back you already have it.
If no info is returned, install instructions are on the brew website.

3) Install ffmpeg
ffmpeg is super useful utility to convert audio files.
It’s easiest to install this via brew – just type brew install ffmpeg

4) Install youtube-dl
youtube-dl is a utility to interact with video files.
It’s easiest to install this via brew – just type brew install youtube-dl

5) Find a video you want to download and convert to MP3
This should be the easiest step. As an example, I’m gonna choose Twenty Seconds to Comply as it’s been on there for 14 years so probably isn’t going to be removed any time soon. https://www.youtube.com/watch?v=Yw9GNz-EYP8

6) Run this command in the terminal

youtube-dl --extract-audio --audio-format "mp3" --audio-quality 320K -o "/Users/$USER/Desktop/%(title)s-%(id)s.%(ext)s" "https://www.youtube.com/watch?v=Yw9GNz-EYP8"

The videos should be downloaded and then converted to an MP3 and put on your desktop.

If its not you may need to change some of the command you ran, let me run through it:

--extract-audio – extracts audio from the video file
--audio-format – saves the audio as an MP3
--audio-quality 320k – creates a 320k bitrate quality audio file
-o "/Users/$USER/Desktop/%(title)s-%(id)s.%(ext)s" – this tells the command where to save the output. If the location is not found, you can delete this part of the command and the file will be downloaded to whatever directory you are inside in the terminal.

That’s it. The same script works with Mixcloud and other services too, just switch out the URL at the end of the command for whatever you want to download.