Skip to content

A feature-rich command-line audio/video downloader

Warn against using `-f mp4` (#13915)

sepro70f56699515e
diff --git a/yt_dlp/__init__.py b/yt_dlp/__init__.py
index bc9384b085..3277cbfa1a 100644
--- a/yt_dlp/__init__.py
+++ b/yt_dlp/__init__.py
@@ -500,6 +500,14 @@ def validate_options(opts):
'To let yt-dlp download and merge the best available formats, simply do not pass any format selection',
'If you know what you are doing and want only the best pre-merged format, use "-f b" instead to suppress this warning')))
+ # Common mistake: -f mp4
+ if opts.format == 'mp4':
+ warnings.append('.\n '.join((
+ '"-f mp4" selects the best pre-merged mp4 format which is often not what\'s intended',
+ 'Pre-merged mp4 formats are not available from all sites, or may only be available in lower quality',
+ 'To prioritize the best h264 video and aac audio in an mp4 container, use "-t mp4" instead',
+ 'If you know what you are doing and want a pre-merged mp4 format, use "-f b[ext=mp4]" instead to suppress this warning')))
+
# --(postprocessor/downloader)-args without name
def report_args_compat(name, value, key1, key2=None, where=None):
if key1 in value and key2 not in value: