freaking languages
Build and Push Docker Images / build-and-push (push) Successful in 22s

This commit is contained in:
2026-02-11 23:43:38 +01:00
parent e92ccd757a
commit f2e442218a
+12 -5
View File
@@ -77,8 +77,6 @@ def get_preferred_audio_stream_index(path: Path) -> int | None:
streams = data.get("streams") or [] streams = data.get("streams") or []
audio_streams = [] audio_streams = []
for s in streams: for s in streams:
if s.get("codec_type") != "audio":
continue
idx = s.get("index") idx = s.get("index")
if idx is None: if idx is None:
continue continue
@@ -260,11 +258,20 @@ def stream_live_channel(paths: list[Path], wfile, durations: list[float]) -> Non
"-stream_loop", "-1", "-stream_loop", "-1",
"-f", "concat", "-safe", "0", "-i", list_path, "-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: if NORMALIZE_LIVE_STREAM:
w, h = _parse_resolution(NORMALIZE_TARGET_RES) 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" 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, "-vf", vf,
"-c:v", "libx264", "-preset", "ultrafast", "-tune", "zerolatency", "-c:v", "libx264", "-preset", "ultrafast", "-tune", "zerolatency",
"-c:a", "aac", "-ac", "2", "-b:a", "128k", "-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: else:
output_args = [ output_args = audio_map + [
"-c", "copy", "-c", "copy",
"-avoid_negative_ts", "make_zero", "-avoid_negative_ts", "make_zero",
"-muxdelay", "0", "-muxpreload", "0", "-muxdelay", "0", "-muxpreload", "0",