How to get the highest quality audio with the smallest download size using youtube-dl?

Solution 1:

I don't know if it's actually implemented, but this could work:

youtube-dl -f worstvideo+bestaudio www.youtube.com/watch?v=dQw4w9WgXcQ

or

youtube-dl -f worst+bestaudio www.youtube.com/watch?v=dQw4w9WgXcQ

Solution 2:

If you just want to extract audio, youtube-dl has an option specifically for that, --extract-audio.

From this answer:

You can also download the mp3 directly from youtube without converting using ffmpeg

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

From the online help:

-x, --extract-audio        convert video files to audio-only files (requires
                           ffmpeg or avconv and ffprobe or avprobe)

Bear in mind as well that youtube-dl defaults to using avconv so you should consider specifying either avconv or FFmpeg at the commandline . From the online help :

--prefer-avconv                  Prefer avconv over ffmpeg for running the
                                 postprocessors (default)
--prefer-ffmpeg                  Prefer ffmpeg over avconv for running the
                                 postprocessors

Further options for keeping the original video, adjusting the bitrate or quality of the audio and a few others can be seen by looking at youtube-dl -h .