Requested formats are incompatible for merge

Solution 1:

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:

  • youtube-dl Format Selection
  • youtube-dl Config File