The following steps can be used to extract the audio from a YouTube video and convert it to a stereo MP3.
Peter Leung, Extract Audio Track From A YouTube Video, Linux Commando
(Sept. 26, 2013).
Howard Pritchett, Using ffmpeg to manipulate audio and video files,
LINUX "howto" Pages
(Feb. 1, 2012).
Ricardo Garcia Gonzalez, youtube-dl Documentation (2014).
Ask Ubuntu, How to download youtube videos as a best quality audio mp3 using youtube-dl
[duplicate] (2015).
$ youtube-dl --extract-audio --audio-format wav -o [OUTPUT].wav
'[URL]'
Here [OUTPUT].wav
is the name of the file that youtube-dl
should save the audio to and [URL]
is the URL of the video
whose audio youtube-dl should extract.
$ ffmpeg -i [OUTPUT].wav -acodec mp3 -ab 256k
-ac 2 [OUTPUT].mp3
Here the option -acodec mp3
tells ffmpeg to convert the
wav audio to an mp3 (other audio formats are also available), the option
-ab 256k
tells ffmpeg that the mp3 should be a 256k (high quality
, lower numbers can be used for lower quality)
mp3, and the option -ac 2
tells ffmpeg that the mp3 should be in
stereo.
Tell youtube-dl to download the audio track and covert it to an mp3:
$ youtube-dl --extract-audio --audio-format mp3 --audio-quality 0 -o [OUTPUT].mp3 '[URL]'
Here
[OUTPUT].mp3
is the name of the file that youtube-dl should save the audio to and[URL]
is the URL of the video whose audio youtube-dl should extract.
Valid XHTML and CSS // Licensed under a Creative Commons Attribution 2.5 License