ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
131.39k stars 9.96k forks source link

formats priority of --merge-output-format #32886

Closed MagicalDrizzle closed 1 month ago

MagicalDrizzle commented 1 month ago

Checklist

Question

What is the priority of format chosen when merging video+audio? For example --merge-output-format mp4/webm/mkv Is it the same as the priority list of format-sort, and is it influenced by --prefer-free-formats?

dirkf commented 1 month ago

Your link implies this

30839 ... if you were actually running yt-dlp ...

and that's how to get a definitive answer for yt-dlp.

When you say "priority of format", obviously that means "container format".

In yt-dl, you get the formats you ask for and the container you ask for, with minimal hand-holding.

I expect that in yt-dlp, the first container type compatible with the selected formats is used: the code calls get_compatible_ext() with parameters including the codecs and exts of the formats and the preferred container types, which are the --merge-output-formats or just ('webm', 'mkv') if --prefer-free-formats. This could be a fairly easy back-port if people wanted similar behaviour here.