I'm trying to download music from YouTube site using youtube-dl with the best quality possible. So I've tried to download as a WAV file with this command:

youtube-dl -ci -f 'bestvideo[ext=mp4]+bestaudio' -x --audio-format wav https://www.youtube.com/watch?v=tDOffPd81YI  

which produced a big WAV file (with this video, 42.3 Mo 48kHz stereo 16bit 1536kbit/s)

But when I compared with an M4A file, downloaded with:

 youtube-dl -ci -f 'bestvideo[ext=mp4]+bestaudio' -x --audio-format m4a https://www.youtube.com/watch?v=tDOffPd81YI

The M4A file is smaller and lower quality (with this video, 12.3 Mo 48kHz stereo 441kbit/s).

Why is the WAV file better quality? And what causes the difference of file size? It is more strange that I have asked the same quality for both (-f 'bestvideo[ext=mp4]+bestaudio')

I tried downloading with bestaudio quality and converting to a M4A file:

 youtube-dl -ci -f "bestaudio" -x --audio-format m4a https://www.youtube.com/watch?v=tDOffPd81YI  

On this file, I found that the first file had a bigger size and a bigger bitrate than the second, but it probably depends on the video you choose.

Does the flag bestaudio[ext=m4a] download the bestaudio stream in M4A format, or does it take the best audio and convert it to M4A?

I'm running on Manjaro Linux.


As far as I know YouTube internally stores videos in MP4 format with AAC audio (.m4a suffix). If you request a .wav file youtube-dl will simply call ffmpeg in order to convert the audio track from m4a to wav. Since wav is a lossless format both files have exactly the same quality, but wav is much bigger than m4a.

I suggest using some command like the following one:

youtube-dl -ci -f "bestaudio[ext=m4a]" https://www.youtube.com/watch?v=tDOffPd81YI

I also suggest checking the list of available formats with the -F option (uppercase F):

youtube-dl -F https://www.youtube.com/watch?v=tDOffPd81YI
| improve this answer | |
  • Thanks, I've converted some .mp3 files with audacity to .wav, and there were all bigger. So it's not youtube-dl, but the conversion (which is totally useless if you want small files). There was already a topic about this subject: stackoverflow.com/questions/15593806/… – prosopopee Aug 23 '16 at 5:20

You're confusing file size (or bit-rate) with audio quality. The MP4 audio is compressed; decompressing it to WAV format doesn't add any information (so cannot improve the quality) but does increase the file size.

Going the other way (compressing audio) does, in general, lose information, and does risk reducing perceptible quality.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.