Categories
Tech

Youtube to mp3 with youtube-dl

Don’t use sketchy apps or websites with timers and ads. If you have a computer and internet connection you can do it yourself.

What you’ll need

Setup

  • Download youtube-dl.exe and the latest FFMPEG build. Extract ffmpeg to a directory, this can be the same directory as youtube-dl.exe.
  • Open the youtube link and copy the full URL.
  • Copy the command below. Replace <url> with the full youtube URL.
  • Open a command prompt (hold shift and right click > Open PowerShell window here) and paste the command.

Command

youtube-dl.exe --extract-audio --audio-format mp3 --audio-quality 0 --ffmpeg-location "ffmpeg\bin" -o %(title)s.%(ext)s <url>

Options

Click here for a list of post processing options
extract-audio: Converts video to audio. No options needed.
audio-format: Output audio format. Available options: “best”, “aac”,”flac”, “mp3”, “m4a”, “opus”, “vorbis”, or “wav”. Command above uses “mp3”, default is “best”.
audio-quality: Audio quality between 0 (best) and 9 (worst). Command above uses 0, default is 5.
ffmpeg-location: Location of ffmpeg.exe. Use \ for directories. Command above assumes the FFMPEG release was unzipped in the same directory as youtube-dl.exe (ex: youtube-dl\ffmpeg\bin\ffmpeg.exe). You do not need this if ffmpeg.exe and youtube-dl.exe are in the same directory.
-o: Output template. Click here for more options.
If you’re using this command in a .bat file you’ll need to escape % with %%. (ex: %%(title)s.%%(ext)s instead of %(title)s.%(ext)s).

Troubleshooting

Missing MSVCR100.dll or getting a blank output when running the command? Install Microsoft Visual C++ 2010 Service Pack 1 Redistributable Package (x86).