34

I have the following error message with youtube-dl:

WARNING: Requested formats are incompatible for merge and will be merged into mkv.
0

1 Answer 1

62

This is not really a problem but actually an expected behavior for youtube-dl.

By default the current version youtube-dl will download the highest quality audio and the highest quality video streams available and then join these streams into a compatible container. Current choices of container are mkv, mp4, ogg, webm, flv. (I note that avi is also supported through the --recode-video option.)

If these 'best' streams are codecs that do not sit well in an mp4 container, for example, youtube-dl will pack them into an mkv container and issue the warning that you have seen. Mind you vlc, SMPlayer and friends will play back the resulting mkv file with no issues on a well configured Ubuntu system...

If however you are really keen to get the best quality video and the best quality video audio but only in an mp4 container (thus bypassing the mkv warning and subsequent Matrosk container output from youtube-dl) you can use something like the following:

youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]' URL

Obviously substituting the 'URL' value for the address of the youtube video you wish to download. Such a relatively complex command line can be placed permanently in the configuration file ~/.config/youtube-dl/config as follows:

-f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]'

With the above line placed in the youtube-dl config file the settings will become the default for youtube-dl and do not need to be given on the command line each time. (Easily bypassed if needed by passing the --ignore-config option on the command line).

Many, many variations of this command line are possible...

References:

1
  • Can not find youtube-dl config file on 20.04
    – Ahmad Anis
    Jul 6, 2021 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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