refact (core): split large code blocks, remove useless files/code #12
@@ -47,7 +47,7 @@ def determine_output_format(stream_info: Dict, user_format: Optional[str],
|
|||||||
"""
|
"""
|
||||||
Decide which container format to use.
|
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.
|
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:
|
If detection fails or format is not supported, fallback to:
|
||||||
- MKV if video/subtitles exist
|
- MKV if video/subtitles exist
|
||||||
@@ -55,6 +55,10 @@ def determine_output_format(stream_info: Dict, user_format: Optional[str],
|
|||||||
- MP4 (M4A) otherwise
|
- MP4 (M4A) otherwise
|
||||||
"""
|
"""
|
||||||
if user_format:
|
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
|
return user_format
|
||||||
|
|
||||||
if input_file:
|
if input_file:
|
||||||
|
|||||||
Reference in New Issue
Block a user