youtube-dl: Download Opus audio or AAC audio?

No, this is not a duplicate of this question.

I have been using youtube-dl to download some music videos from YouTube. I noted that left to its defaults, youtube-dl will use bestvideo+bestaudio, and with recent videos, for bestaudio it will nearly invariably download the Opus track.

I know that, encoded from source, Opus tracks usually have better quality than AAC tracks at the same bitrate.

However, I also know that Opus audio is not supported by the MP4 container, and since uploads to YouTube does not (yet) support MKV, the original upload would be using AAC. Which means the Opus audio track will be a lossy-transcode from AAC, potentially reducing quality.

(FI, I have no problem playing the remuxed video+audio using MPC-HC + K-Lite Mega Codecs, and I also have no problem extracting the audio using ffmpeg -c:a copy and playing it using Foobar2000)

So, my question is: Do you think I should download the AAC track instead of the Opus track, or should I just let youtube-dl does its stuff? What benefit will I get downloading the Opus track compared to downloading the AAC track?


Solution 1:

You do not have to worry so much about the source audio being AAC because, even though YouTube recommends using it as well as the MP4 container, the MKV container and lossless codecs like PCM and FLAC are in fact supported (I've been using MKV + FLAC for years now on YouTube).

But even then, if the user does in fact upload their audio in AAC, YouTube will in fact still transcode it for their AAC encodes. YouTube also recommends uploading at 48KHz, but only their Opus encodes are in 48KHz - YouTube uses 44.1KHz for both AAC and Vorbis, so both of those encodes are likely to have been downsampled as well.

In the end, Opus should still be higher quality.

Solution 2:

Not to commenting on the youtube-dl but trying to answer your Opus audio related questions.

As ffcvt suggested, "the Opus audio codec is becoming the best thing ever for compressing audio -- A 64K Opu audio stream is comparable to mp3 files of 128K to 256K bandwidth".

If you are interested, check this out for some comprehensive info on Opus, which includes links to Sound Examples you can test out yourself.

I know your are worrying about the lossy-transcode comparing to AAC because of the potentially reducing quality, however, let me tell you, most people won't notice any differences, including some sound experts. Of course your experience will be different. So test out those Sound Examples yourself and see how different you can tell from each of them, and find your comfortable level. If you want to fine tune the bandwidth parameters, ffcvt can help.

Overall, Opus is a new audio codec, and it will become a new standard for audio on the web. Features include:

  • Better compression than mp3/ogg/aac.
  • Good for both music and spoken word.
  • Dynamically adjustable bitrate, audio bandwidth, and coding delay.
  • Good for real-time and pre-recorded applications.