How to download an audio track from a YouTube video in Linux CLI

Linux is the system of freedoms, so How to download an audio track from YouTube is a simple catch. The terminal is the key to mastering a *nix system. youtube-dl is a terminal utility that brings you the ability to get content from Youtube.

Linux operating system, terminal CLI session, and youtube-dl. That’s all

There are several posts and threads that explain how to download Youtube videos using the terminal through youtube-dl. This one can also be able to download a directly audio track from a Youtube video without converting and using ffmpeg or avconv. So, this command is the key.

youtube-dl download

youtube-dl is free and opensource, so you can download it from the official site and start playing with it. First of all, give a look at the help of the terminal or to the online documentation.

For the full options list, just type in terminal session: ~$ youtube-dl --help

cialu@andromeda:~$ youtube-dl --help
Usage: youtube-dl [OPTIONS] URL [URL...]

Options:
General Options:
-h, --help Print this help text and exit
--version Print program version and exit
Video Format Options:
-f, --format FORMAT Video format code, see the "FORMAT
SELECTION" for all the info
--all-formats Download all available video formats
--prefer-free-formats Prefer free video formats unless a specific
one is requested
Subtitle Options:
--write-sub Write subtitle file
--write-auto-sub Write automatically generated subtitle file
(YouTube only)
Post-processing Options:
-x, --extract-audio Convert video files to audio-only files
(requires ffmpeg or avconv and ffprobe or
avprobe)
--audio-format FORMAT Specify audio format: "best", "aac",
"vorbis", "mp3", "m4a", "opus", or "wav";
"best" by default
--audio-quality QUALITY Specify ffmpeg/avconv audio quality, insert
a value between 0 (better) and 9 (worse)
for VBR or a specific bitrate like 128K
(default 5)

How to download an audio track from a YouTube video

So, which is the fast way to download an mp3 track from a YouTube video?

***WARNINGS! HERE WE’RE TALKING ABOUT THE DOWNLOAD OF LEGAL TRACKS LIKE CREATIVE COMMONS LICENSED TRACKS OR FREE COPYRIGHT MUSIC. PAY ATTENTION TO DOWNLOAD COPYRIGHTED CONTENT BECAUSE IT’S ILLEGAL***

So, to download legal music tracks, easily, you need to just type in a terminal:


youtube-dl --extract-audio --audio-format mp3 <video URL from Youtube>

And to have a Vorbis track:


youtube-dl --extract-audio --audio-format vorbis <video URL from Youtube>

Youtube-dl. A command-line program to download videos from YouTube.com and other video sites

Youtube-dl is a free and open-source download manager for video and audio from YouTube and over 1,000 other video hosting websites. It is also released under the Unlicense software license.

youtube-dl was created in 2006 by Ricardo Garcia. Initially, only YouTube was supported, but as the project grew, it began supporting other video sharing websites. Ricardo Garcia stepped down as maintainer in 2011 and was replaced by phihag, who later stepped down and was replaced by dstftw. In 2021, dstftw stepped down and was replaced by dirkf.

youtube-dl
From Wikipedia, the free encyclopedia

Also, the official resources:

2 comments

  1. Pingback: Homepage

Leave a Reply

Your email address will not be published.