Migrate video

This commit is contained in:
Andras Schmelczer 2026-07-16 07:56:38 +01:00
parent 75c18a8eb4
commit 4428d6c50a
11 changed files with 310 additions and 80 deletions

View file

@ -38,8 +38,20 @@ def measure_loudness(cmd_head: list[str], filter_complex: str) -> dict[str, str]
Returns the measured values for the linear second pass, or None if the
measurement failed (in which case the caller falls back to one-pass).
loudnorm prints its JSON summary at ffmpeg's `info` level, so this pass
cannot inherit the caller's `-loglevel warning`: that suppressed the very
stats parsed below, the probe returned None every single time, and every
render silently took the one-pass fallback the docstring treats as the
exception. Nothing surfaced it because the fallback sounds fine until you
compare it: one-pass is the dynamic mode, which pumps on speech.
"""
probe_cmd = cmd_head + [
probe_head = list(cmd_head)
if "-loglevel" in probe_head:
probe_head[probe_head.index("-loglevel") + 1] = "info"
else:
probe_head[1:1] = ["-loglevel", "info"]
probe_cmd = probe_head + [
"-filter_complex",
f"{filter_complex};[aout]loudnorm={LOUDNORM_TARGET}:print_format=json[anorm]",
"-map",