This commit is contained in:
@@ -77,8 +77,6 @@ def get_preferred_audio_stream_index(path: Path) -> int | None:
|
||||
streams = data.get("streams") or []
|
||||
audio_streams = []
|
||||
for s in streams:
|
||||
if s.get("codec_type") != "audio":
|
||||
continue
|
||||
idx = s.get("index")
|
||||
if idx is None:
|
||||
continue
|
||||
@@ -260,11 +258,20 @@ def stream_live_channel(paths: list[Path], wfile, durations: list[float]) -> Non
|
||||
"-stream_loop", "-1",
|
||||
"-f", "concat", "-safe", "0", "-i", list_path,
|
||||
]
|
||||
# Prefer Dutch > Flemish > English > first audio (? = optional; first match wins in output order)
|
||||
audio_map = [
|
||||
"-map", "0:v:0",
|
||||
"-map", "0:a:m:language:nld?",
|
||||
"-map", "0:a:m:language:dut?",
|
||||
"-map", "0:a:m:language:nl?",
|
||||
"-map", "0:a:m:language:vls?",
|
||||
"-map", "0:a:m:language:eng?",
|
||||
"-map", "0:a:0?",
|
||||
]
|
||||
if NORMALIZE_LIVE_STREAM:
|
||||
w, h = _parse_resolution(NORMALIZE_TARGET_RES)
|
||||
# Scale to fit target res, pad to exact size. Re-encode for uniform output.
|
||||
vf = f"scale={w}:{h}:force_original_aspect_ratio=decrease,pad={w}:{h}:(ow-iw)/2:(oh-ih)/2"
|
||||
output_args = [
|
||||
output_args = audio_map + [
|
||||
"-vf", vf,
|
||||
"-c:v", "libx264", "-preset", "ultrafast", "-tune", "zerolatency",
|
||||
"-c:a", "aac", "-ac", "2", "-b:a", "128k",
|
||||
@@ -275,7 +282,7 @@ def stream_live_channel(paths: list[Path], wfile, durations: list[float]) -> Non
|
||||
"-",
|
||||
]
|
||||
else:
|
||||
output_args = [
|
||||
output_args = audio_map + [
|
||||
"-c", "copy",
|
||||
"-avoid_negative_ts", "make_zero",
|
||||
"-muxdelay", "0", "-muxpreload", "0",
|
||||
|
||||
Reference in New Issue
Block a user