added back mono and audio-extraction - logic

This commit is contained in:
2025-08-11 13:51:22 +02:00
parent 2c29e3f037
commit 8d5b8894e6

View File

@@ -21,7 +21,7 @@ REMUX_CODECS = {"aac", "opus"} # Using a set for efficient lookups
SVT_AV1_PARAMS = { SVT_AV1_PARAMS = {
"speed": "slower", # "slower", "slow", "medium", "fast", "faster" "speed": "slower", # "slower", "slow", "medium", "fast", "faster"
"quality": "medium", # "lowest", "low", # "higher", "high", "medium", "low", "lower" "quality": "medium", # "lowest", "low, # "higher", "high", "medium", "low", "lower"
"film-grain": 6, "film-grain": 6,
"color-primaries": 1, "color-primaries": 1,
"transfer-characteristics": 1, "transfer-characteristics": 1,
@@ -53,7 +53,7 @@ def convert_audio_track(index, ch, lang, audio_temp_dir, source_file, should_dow
print(f" - Extracting Audio Track #{index} to FLAC...") print(f" - Extracting Audio Track #{index} to FLAC...")
ffmpeg_args = [ ffmpeg_args = [
"ffmpeg", "-v", "quiet", "-stats", "-y", "-i", str(source_file), "-map", f"0:{index}" "ffmpeg", "-v", "quiet", "-stats", "-y", "-i", str(source_file), "-map", f"0:{index}", "-map_metadata", "-1"
] ]
if should_downmix and ch >= 6: if should_downmix and ch >= 6:
if ch == 6: if ch == 6:
@@ -81,14 +81,16 @@ def convert_audio_track(index, ch, lang, audio_temp_dir, source_file, should_dow
else: else:
# Not downmixing (or source is already stereo or less). # Not downmixing (or source is already stereo or less).
# Base bitrate on the source channel count. # Base bitrate on the source channel count.
if ch == 2: # Stereo if ch == 1: # Mono
bitrate = "64k"
elif ch == 2: # Stereo
bitrate = "128k" bitrate = "128k"
elif ch == 6: # 5.1 Surround elif ch == 6: # 5.1 Surround
bitrate = "256k" bitrate = "256k"
elif ch == 8: # 7.1 Surround elif ch == 8: # 7.1 Surround
bitrate = "384k" bitrate = "384k"
else: # Mono or other layouts else: # Other layouts
bitrate = "96k" # A sensible default for mono. bitrate = "96k" # A sensible default for other layouts.
print(f" - Encoding Audio Track #{index} to Opus at {bitrate}...") print(f" - Encoding Audio Track #{index} to Opus at {bitrate}...")
run_cmd([ run_cmd([