Download the best quality audio file with youtube-dl

WJ496582 picture WJ496582 · Apr 12, 2018 · Viewed 61.5k times · Source

I have just download youtube-dl so I can download video and audio files from youtube.

I want to download the best audio from the following video: https://www.youtube.com/watch?v=uWusmdmc0to

When I do a search for all formats with youtube-dl I get the following results:

format code  extension  resolution note
249          webm       audio only DASH audio   58k , opus @ 50k, 18.99MiB
250          webm       audio only DASH audio   75k , opus @ 70k, 25.20MiB
140          m4a        audio only DASH audio  131k , m4a_dash container, mp4a.40.2@128k, 52.40MiB
251          webm       audio only DASH audio  147k , opus @160k, 50.95MiB
171          webm       audio only DASH audio  149k , vorbis@128k, 52.64MiB
278          webm       256x144    144p  109k , webm container, vp9, 25fps, video only, 34.62MiB
160          mp4        256x144    144p  117k , avc1.4d400c, 25fps, video only, 37.86MiB
242          webm       426x240    240p  245k , vp9, 25fps, video only, 75.13MiB
133          mp4        426x240    240p  258k , avc1.4d4015, 25fps, video only, 81.39MiB
243          webm       640x360    360p  492k , vp9, 25fps, video only, 142.99MiB
134          mp4        640x360    360p  673k , avc1.4d401e, 25fps, video only, 215.29MiB
244          webm       854x480    480p  828k , vp9, 25fps, video only, 256.58MiB
135          mp4        854x480    480p 1516k , avc1.4d401e, 25fps, video only, 408.56MiB
247          webm       1280x720   720p 1882k , vp9, 25fps, video only, 526.18MiB
136          mp4        1280x720   720p 3012k , avc1.4d401f, 25fps, video only, 803.36MiB
248          webm       1920x1080  1080p 3622k , vp9, 25fps, video only, 938.81MiB
137          mp4        1920x1080  1080p 4724k , avc1.640028, 25fps, video only, 1.44GiB
271          webm       2560x1440  1440p 9253k , vp9, 25fps, video only, 2.86GiB
313          webm       3840x2160  2160p 18685k , vp9, 25fps, video only, 6.33GiB
17           3gp        176x144    small , mp4v.20.3, mp4a.40.2@ 24k
36           3gp        320x180    small , mp4v.20.3, mp4a.40.2
43           webm       640x360    medium , vp8.0, vorbis@128k
18           mp4        640x360    medium , avc1.42001E, mp4a.40.2@ 96k
22           mp4        1280x720   hd720 , avc1.64001F, mp4a.40.2@192k (best)

What is the best choice to get the best audio file? The first five are audio only. Do I need to pick one here? Or is the last one MP4 HD720 the best option and then convert it to MP3?

Thanks!

Answer

anon picture anon · Apr 12, 2018

If you want mp3, just tell youtube-dl that:

youtube-dl -x --audio-format mp3 https://www.youtube.com/watch?v=uWusmdmc0to

will get you an audio version (-x, short for --extract-audio) in or converted to mp3 (that's the --audio-format option). youtube-dl will automatically pick the best quality and most appropriate format.

Note that the listed qualities are just guesses. In practice, opus is superior to anything else, but vorbis is picked for compatibility (refer to this related answer of mine for more details), so that will be picked.

While you can use -f to select a particular format, this is intended for people who want lower quality because of limited bandwidth or storage space, or for debugging. By default, youtube-dl already downloads the highest quality.