> youtube-dl -F OKbtC223e30
139 m4a audio only DASH audio 49k , audio@ 48k (22050Hz), 525.88KiB (worst)
171 webm audio only DASH audio 129k , audio@128k (44100Hz), 1.27MiB
140 m4a audio only DASH audio 129k , audio@128k (44100Hz), 1.36MiB
172 webm audio only DASH audio 176k , audio@256k (44100Hz), 1.78MiB
141 m4a audio only DASH audio 255k , audio@256k (44100Hz), 2.71MiB
Just use youtube-dl -f 141 to direct download just the audio from YouTube. I always use this to download songs.While -f 141 is of course perfectly fine, may I suggest -f bestaudio ? That should work fine for non-YouTube sites (soundcloud or so), and will get you a better version should YouTube one day add it. If you really prefer 141, you can also use -f 141/bestaudio to fall back to bestaudio if 141 is unavailable.
That'll come in handy. I always used -F to find out what is highest # for downloading audio.
Converting it to MP3 is a bad idea. Youtube uses other lossy codecs inside, such as Vorbis and AAC. So reencoding it will degrade the quality. The best option is to keep the audio as is.
According to the docs it formats them as "best" by default.
--audio-quality QUALITY
"best", "aac", "vorbis", "mp3", "m4a", "opus", or "wav"; "best" by defaultWhen you convert audio from a lossy format to a lossy format (from YouTube's native AAC streams to MP3,) you always end up with worse quality than the original, regardless of the encoding settings. Since pretty much everything can play AAC, there's no point in converting it in the first place. Just remove --audio-format mp3, and you'll get an .m4a straight from YouTube with no conversion step.
Re:Youtube-dl
by rational-future on Sunday November 23, 2014 @08:32AM
(#8648734)
That's right, usually the best quality audio you can get from youtube is in m4a format. The only problem I'm having is youtube sets the format inside the m4a to dash, which some stupid players (including iTunes) don't want to play. So I have to run something like
ffmpeg.exe -i "Keith Wiley - The Fermi Paradox, Self-Replicating Probes, Interstellar Transport Bandwidth-AUk6ZlePtQA.m4a" -c:a copy 2.m4a
to change the format in the file header to M4A.
Winamp and VLC also don't play these..
By the way, is DASH a free technology, or it's patent encumbered like the rest of the MPEG stuff?
Hmmm, can you add the --audio-format mp3 to ~/.config/youtube-dl.conf without breaking normal video downloads?
(Edit) Answering my own question, apparently yes!
Or even shorter:
youtube-dl -x --audio-format mp3 OKbtC223e30
In general youtube-dl is great, but that short id input handling is broken, as evidenced by this:
youtube-dl -x --audio-format mp3 -fCtvurGDD8As others have pointed out, you'll need -- in this case. However, there's really no reason why youtube-dl should not detect this common problem (we also try to detect when users forget to quote URLs with ampersands). Update to youtube-dl 2014.11.23.1 or newer and try this again ;)
By the way, the GitHub issue tracker (https://yt-dl.org/bug ) is usually a better place to report issues. But just for youtube-dl reaching #1 on HN, I'll make an exception.
Like many tools, youtube-dl supports a -- flag to indicate "the remaining arguments are not flags". So your example would work as:
youtube-dl -x --audio-format mp3 -- -fCtvurGDD8
It can also convert a video to an mp3:
youtube-dl --extract-audio --audio-format mp3 https://www.youtube.com/watch?v=OKbtC223e30