feat (core): If user_format is provided, map it to the correct container if it's a codec name

This commit is contained in:
2026-08-31 19:48:31 +05:00
parent 156dfa693f
commit 5f68eccdbf
+5 -1
View File
@@ -47,7 +47,7 @@ def determine_output_format(stream_info: Dict, user_format: Optional[str],
"""
Decide which container format to use.
If user_format is provided, use it.
If user_format is provided, map it to the correct container if it's a codec name.
Else, try to detect the input file's container and codec, and use the recommended format.
If detection fails or format is not supported, fallback to:
- MKV if video/subtitles exist
@@ -55,6 +55,10 @@ def determine_output_format(stream_info: Dict, user_format: Optional[str],
- MP4 (M4A) otherwise
"""
if user_format:
# Map codec names to their correct containers
# e.g., 'opus' -> 'ogg', 'aac' -> 'mp4', etc.
if user_format in CODEC_TO_CONTAINER_MAP:
return CODEC_TO_CONTAINER_MAP[user_format]
return user_format
if input_file: