Local video editor for coding agents: 42 FFmpeg tools with a machine-readable contract and an MCP server, for Claude Code, Cursor and Codex. Cut, captions, reframe, loudness, platform exports. No cloud, no API keys.
Python agent-skillsai-agentsaudio-processingcaptionsclaude-codecodexcoding-agentcursorffmpegloudness-normalizationmcpmcp-servermodel-context-protocolpythonsubtitlestranscodingvideovideo-editingvideo-processingwhisper
feat: one time grammar (@fps, time_arg in broll/cut/freeze), probe hdr_signal, eval-8 follow-ups (#206)
claude[bot]8dccba2e7764
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 7c4491a..2422083 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -4,7 +4,9 @@## Unreleased-(nothing yet)+- One time grammar (issue #189 B, docs/design-decisions.md "Time grammar", roadmap 1.9.0): `broll.py`, `cut.py` and `freeze.py` now parse their times through `time_arg()` like every other tool, so a bad or fps-less value is `kind: input` naming the flag; `hh:mm:ss:ff@fps` (e.g. `00:01:02:[email protected]`) names a timecode's rate explicitly and is accepted by every time-taking flag and cue file. `references/scripts.md` documents the grammar once.+- Eval 8 follow-ups. `render.py` turns `--normalize` on by default for a platform export preset when the project has no `loudness` stage (`"normalize": false` opts out); SKILL.md shows the Japanese shape of the report next to the English one, lists a `join.py` that scaled or padded a clip under the Look rule, and says when `--codec` / `--quality` are the right call.+- `probe` gains `hdr_signal` (true only for a PQ / HLG transfer or Dolby Vision) next to `hdr`, which keeps counting BT.2020 primaries on an SDR transfer until 2.0 renames it (issue #189 A1, pre-shipped as a parallel key).## 1.8.1diff --git a/SKILL.md b/SKILL.mdindex 82747e1..54d680b 100644--- a/SKILL.md+++ b/SKILL.md@@ -66,7 +66,8 @@ Scripts live in `scripts/` next to this file; run them with `python3 <skill-dir>7. **Keep the user's originals.** Never overwrite the source file. Write newfiles next to the input or where the user asked.8. **Look at the picture.** Whenever the picture changed (captions, overlays,- graphics, crop/pad, resize, colour, transitions) run `look.py OUTPUT`+ graphics, crop/pad, resize, colour, transitions, a `join.py` that scaled or+ padded a clip to the first clip's frame) run `look.py OUTPUT`(contact sheet) or `look.py OUTPUT --at T`, view the PNG. The job is notfinished until the report's `Look:` line names that PNG; a probe alonecannot see a caption sitting on someone's face. Audio-only jobs (sync,@@ -162,6 +163,7 @@ If a request needs an FFmpeg feature none of the 42 scripts expose, say so and n| "remove the green screen", "chroma key this" | `overlay.py bg.mp4 --video greenscreen.mp4 --chromakey 0x00ff00` || "sync the lav mic to the camera", "line up the two cameras" | `sync.py camera.mp4 mic.wav --replace-audio` / `sync.py camA.mp4 camB.mp4 --trim-second` || "fix the audio levels", "normalise to -14 LUFS" | `loudness.py input.mp4` (`-I -16 --tp -1.5` for podcasts, `-I -23` for broadcast) |+| "cut this and make it HEVC / AV1", "a ProRes intermediate of the trimmed clip" (an edit whose *output codec* the user named) | `cut.py input.mp4 --start 0:10 --end 0:40 --codec hevc` (`--codec h264\|hevc\|av1\|prores` and `--quality N` on every editing tool that re-encodes; ProRes needs `-o NAME.mov`; without a named codec leave the default) || "export for YouTube / Reels / X", "give me a ProRes master", "make it HEVC" | `export.py input.mp4 --preset youtube|reels|x|prores|h265` (`--normalize` meets the platform's loudness spec in the same call, no separate `loudness.py` pass) || "make a GIF preview" | `export.py input.mp4 --preset gif` || "make a small/low-res proxy for an analysis pass", "a cheap preview file" | `proxy.py input.mp4 [--width 640 --no-audio]` — not a delivery preset, see `export.py` for those |@@ -253,6 +255,18 @@ Look: final_sheet.png (captions inside the safe area, logo top-right)Notes: source was VFR, conformed to 30 fps; audio was mono, made stereo```+The same five lines for a Japanese request, prose in Japanese around the English labels+(this is the shape a short job keeps too; English `Done:`/`Steps:` sentences with one Japanese+word in `Notes:` is not a Japanese report):++```+Done: final.mp4 — 59.98 秒、1080x1920、30 fps、H.264、AAC ステレオ、-14.1 LUFS+Steps: 0:12-1:12 をカット(無劣化)-> 9:16 にクロップ -> 字幕(ポップ、カラオケ)-> ラウドネス -14 -> Reels 書き出し+Check: reels — 12 項目すべて合格(verified: true)+Look: final_sheet.png(字幕はセーフエリア内、ロゴは右上)+Notes: 元は VFR だったので 30 fps に揃えた。音声はモノラルだったのでステレオにした+```+Keep it to those five lines plus anything the user must decide. Attach the contact sheet when the edit touched the picture. Never report success without the probe of the output; never describe a fix you did not run.When a step fails, replace `Done:` with `Failed:` and keep the rest honest:diff --git a/docs/design-decisions.md b/docs/design-decisions.mdindex 0f5af0b..12ddeb9 100644--- a/docs/design-decisions.md+++ b/docs/design-decisions.md@@ -135,7 +135,9 @@ exists. When a decision changes, edit the entry in the same PR.accepted by `time_arg()` and documented once in `references/scripts.md`; nothing else changes,so no CLI is removed. Rejected: "seconds only in single tools, composite input only in`render.py`" -- editors quote timecode, and refusing it moves the conversion onto the agent.- Code: `_common.time_arg()`.+ Code: `_common.time_arg()`. 1.9.0 shipped it: `broll`, `cut` and `freeze` (the last three+ callers of the raw parser) go through `time_arg()`, and `@fps` is accepted everywhere, so 2.0+ has nothing left to change here.- **Encoder abstraction: `--codec h264|hevc|av1|prores` and `--quality N` on everyre-encoding tool, resolved in one place.** `video_args()` already centralises x264 + theHDR/10-bit branch; 2.0 adds the two flags to `add_common()` for tools that re-encode, keeps@@ -146,6 +148,13 @@ exists. When a decision changes, edit the entry in the same PR.duplicated; one more duplication is the wrong direction). Code: `_common.video_args()`.1.8.0 shipped the two flags (`add_common()` adds them to every tool that declares `--crf`;`encoder_args()` resolves them; `--crf`/`--preset` unchanged), so 2.0 only has to deprecate the aliases.+- **`hdr` keeps counting BT.2020 primaries on an SDR transfer until 2.0; `hdr_signal` (1.9) is+ the parallel key that is true only for PQ / HLG / Dolby Vision.** The editing tools keep+ routing every `hdr: true` source through the HEVC Main10 path with its own tags (a BT.2020 SDR+ source re-encoded as x264 with BT.709 tags would shift its colours, so the old path is the safe+ one); a caller that wants to know whether the file is a real HDR signal reads `hdr_signal`, and+ `hdr_format` says "BT.2020 SDR" for the in-between case. 2.0 renames: `hdr` takes+ `hdr_signal`'s meaning. Code: `_common.probe()`.- **Per-request Context: `STATE` stays process-global through 1.x; 2.0 passes a `Context`explicitly to `run()`/`emit()`/`die()`.** Today the MCP server spawns one subprocess percall, so the global is never shared between requests; the risk only appears if a futurediff --git a/references/scripts.md b/references/scripts.mdindex 9c24d1d..012c17f 100644--- a/references/scripts.md+++ b/references/scripts.md@@ -2,6 +2,18 @@Every script prints the same information with `--help`; this file exists so the agent can read several at once. All scripts accept `--dry-run`, `--json`, `--fast`, `--progress`, `--timeout SECONDS`, `--overwrite`, `--plan FILE` (the dry run written as a plan document that `render.py FILE` executes later; see render.py), `-o OUT`; every editing tool that re-encodes (not `export.py`, whose preset decides the codec) also takes `--codec h264|hevc|av1|prores` (the encoder for the re-encode; default x264 for SDR, x265 Main10 for HDR, unchanged) and `--quality N` (CRF scale, overrides `--crf`; up to 63 for av1; ignored by prores). `--codec hevc` on SDR writes 8-bit BT.709 HEVC (`hvc1`), `av1` uses SVT-AV1 (libaom fallback), `prores` is 422 HQ and needs an explicit `-o NAME.mov` (or `.mkv`), `h264` refuses an HDR source (`kind: input`, run `color.py --to-sdr` first). `export.py` keeps choosing the codec from its preset and has neither flag; a `render.py` project cannot choose a codec either -- but `--dry-run` only guarantees nothing is written for writing tools: `probe` (read-only, `--dry-run` changes nothing) still runs ffprobe, `check`/`sync`/`multicam`/`scenes`/`cropdetect`/`report`/`silence`/`loudness`/`stabilize` still run their ffmpeg/ffprobe measurements (a dry-run plan rests on real numbers; they just don't write the final artifact), and `verify` accepts the flag but ignores it entirely. Exact per-tool semantics: `contract --json`'s `dry_run` field (or `docs/contract.md`).+## Time grammar (every time-taking flag, 1.9)++One parser, `time_arg()`, behind every `--start`, `--end`, `--at`, `--from`,+`--duration`, `--segments`, cue file and project field: seconds (`12.5`),+`mm:ss(.fff)` (`1:30`), `hh:mm:ss(.fff)` (`00:01:30.250`; a comma also works,+as in SRT). A four-part `hh:mm:ss:ff` is SMPTE non-drop-frame timecode at the+source's frame rate; append `@fps` (`00:01:02:[email protected]`) to name the rate+yourself, which is the only way for a tool with no input file (`caption.py+--text` without a video, and `--fps` there). A four-part value with no fps+anywhere is `kind: input` naming the flag. Nothing else about times differs+between tools.+## Contents- probe.py — inspect- cut.py — cut / join segments@@ -43,7 +55,9 @@ Every script prints the same information with `--help`; this file exists so the```probe.py INPUT... [--compact] [--field duration|video.fps|...]```-JSON with `duration`, `video{codec,width,height,fps,pix_fmt,color_space,rotation,variable_frame_rate_suspected}`,+JSON with `duration`, `video{codec,width,height,fps,pix_fmt,color_space,rotation,variable_frame_rate_suspected,hdr,hdr_signal,hdr_format}`+(`hdr_signal` is true only for a PQ / HLG transfer or Dolby Vision; `hdr` also counts+BT.2020 primaries on an SDR transfer, which `hdr_format` names "BT.2020 SDR" -- 2.0 renames),`audio{codec,channels,sample_rate}`. `--compact` gives one line per file.### cut.py — cut / join segmentsdiff --git a/scripts/_common.py b/scripts/_common.pyindex 95998c6..13925fc 100755--- a/scripts/_common.py+++ b/scripts/_common.py@@ -1322,6 +1322,10 @@ def probe(path: str, role: str = "input") -> Dict[str, Any]:"pix_fmt": video.get("pix_fmt"),"bit_depth": _bit_depth(pix),"hdr": hdr,+ # 1.9 (2.0 A1 pre-shipped as a parallel key): true only for a PQ / HLG transfer or Dolby+ # Vision, i.e. a genuinely HDR signal. `hdr` also counts BT.2020 primaries on an SDR+ # transfer ("BT.2020 SDR" in hdr_format) and keeps that meaning until 2.0 renames it.+ "hdr_signal": trc in ("smpte2084", "arib-std-b67") or bool(dovi),"hdr_format": (("Dolby Vision %s" % (("profile %s" % dovi["profile"]) if dovi and dovi.get("profile") is not None else "")).strip() if dovi else"HDR10/PQ" if trc == "smpte2084" else "HLG" if trc == "arib-std-b67" else "BT.2020 SDR" if hdr else None),"dolby_vision": dovi,@@ -1429,10 +1433,23 @@ def parse_time(value: str, fps: Optional[float] = None) -> float:v = value.strip().replace(",", ".")if not v:raise ValueError("empty time")+ if "@" in v:+ # 1.9: 'hh:mm:ss:[email protected]' names the timecode's rate explicitly (docs/design-decisions.md,+ # time grammar); it overrides the source fps a tool passed in, and is meaningless without+ # the four-part form+ v, _, rate = v.rpartition("@")+ try:+ fps = float(rate)+ except ValueError:+ raise ValueError(f"bad @fps suffix in '{value}' (expected a number such as @29.97)")+ if fps <= 0:+ raise ValueError(f"bad @fps suffix in '{value}': the rate must be positive")+ if len(v.split(":")) != 4:+ raise ValueError(f"'{value}': the @fps suffix belongs to an hh:mm:ss:ff timecode, not to seconds or mm:ss")parts = v.split(":")if len(parts) == 4:if fps is None or fps <= 0:- raise MissingFpsError(f"'{value}' looks like an hh:mm:ss:ff SMPTE timecode, but no fps was given to convert its frame count to seconds")+ raise MissingFpsError(f"'{value}' looks like an hh:mm:ss:ff SMPTE timecode, but no fps was given to convert its frame count to seconds (append @fps, e.g. {value}@29.97, or use seconds / mm:ss / hh:mm:ss.ms)")h, m, s, f = partsif "." in f:raise ValueError(f"bad SMPTE timecode: {value}")@@ -1462,7 +1479,7 @@ def time_arg(value: str, flag: str, fps: Optional[float] = None) -> float:except MissingFpsError as e:die(f"{flag} {value!r}: {e}")except ValueError as e:- die(f"{flag} {value!r}: {e} (use seconds, mm:ss, hh:mm:ss.ms or, with a known fps, hh:mm:ss:ff)")+ die(f"{flag} {value!r}: {e} (use seconds, mm:ss, hh:mm:ss.ms, or hh:mm:ss:ff at the source's fps or with an explicit @fps suffix)")return 0.0 # unreachablediff --git a/scripts/broll.py b/scripts/broll.pyindex 144b39d..5b294dd 100755--- a/scripts/broll.py+++ b/scripts/broll.py@@ -21,7 +21,7 @@ import argparseimport sysfrom typing import Any, Dict, List-from _common import STATE, add_common, aac_args, apply_common, cfr_args, default_output, die, emit, ffmpeg_base, info, parse_time, probe, run, validate_color, video_args, X264_PRESETS, fmt_secs+from _common import STATE, add_common, aac_args, apply_common, cfr_args, default_output, die, emit, ffmpeg_base, info, time_arg, probe, run, validate_color, video_args, X264_PRESETS, fmt_secsdef main() -> int:@@ -69,13 +69,13 @@ def main() -> int:meta_b = probe(path)if not meta_b.get("video"):die(f"{path} has no video stream")- at = parse_time(args.at[i], fps)- start_b = parse_time(per(args.from_, i, "0"), fps)+ at = time_arg(args.at[i], "--at", fps)+ start_b = time_arg(per(args.from_, i, "0"), "--from", fps)if args.end:- end = parse_time(per(args.end, i, "0"), fps)+ end = time_arg(per(args.end, i, "0"), "--end", fps)length = end - atelse:- length = parse_time(per(args.duration, i, "4"), fps)+ length = time_arg(per(args.duration, i, "4"), "--duration", fps)if length <= 0:die(f"cutaway {i + 1}: length must be > 0 (at {at:g}s, got {length:g}s)")if dur_a and at >= dur_a:diff --git a/scripts/cut.py b/scripts/cut.pyindex e41a6a6..ca70fcd 100755--- a/scripts/cut.py+++ b/scripts/cut.py@@ -30,7 +30,7 @@ import sysimport tempfilefrom typing import List, Tuple-from _common import video_args, STATE, add_common, apply_common, audio_codec_for, emit, aac_args, cfr_args, default_output, die, ffmpeg_base, info, is_audio_output, parse_time, probe, run, X264_PRESETS, keyframes_near, MissingFpsError, concat_list_line, refuse_output_is_input, fmt_secs+from _common import video_args, STATE, add_common, apply_common, audio_codec_for, emit, aac_args, cfr_args, default_output, die, ffmpeg_base, info, is_audio_output, time_arg, probe, run, X264_PRESETS, keyframes_near, MissingFpsError, concat_list_line, refuse_output_is_input, fmt_secs# outputs whose re-encode dropped a subtitle/data stream (reported as dropped_non_av_streams)DROPPED_STREAMS: List[str] = []@@ -39,13 +39,9 @@ DROPPED_STREAMS: List[str] = []NEAREST_KEYFRAMES: list = []-def _t(value: str, fps) -> float:- """parse_time() with the input's fps (SMPTE hh:mm:ss:ff) and every failure as kind input."""- try:- return parse_time(value, fps)- except (ValueError, MissingFpsError) as e:- die(f"bad time {value!r}: {e}")- return 0.0 # unreachable+def _t(value: str, fps, flag: str = "--segments") -> float:+ """time_arg() with the input's fps (SMPTE hh:mm:ss:ff, or @fps): the one parser every tool uses (1.9)."""+ return time_arg(value, flag, fps)def parse_segments(spec: str, fps=None) -> List[Tuple[float, float]]:@@ -183,17 +179,17 @@ def main() -> int:if args.segments:segments = parse_segments(args.segments, fps)else:- start = _t(args.start, fps)+ start = _t(args.start, fps, "--start")if start < 0:die(f"--start must not be negative, got {args.start!r}")if args.end and args.duration:die("use --end or --duration, not both")if args.end:- end = _t(args.end, fps)+ end = _t(args.end, fps, "--end")if end < 0:die(f"--end must not be negative, got {args.end!r}")elif args.duration:- end = start + _t(args.duration, fps)+ end = start + _t(args.duration, fps, "--duration")else:end = totalif end <= start:diff --git a/scripts/freeze.py b/scripts/freeze.pyindex c42b497..3bd6898 100644--- a/scripts/freeze.py+++ b/scripts/freeze.py@@ -19,7 +19,7 @@ Examples:import argparseimport sys-from _common import add_common, apply_common, aac_args, cfr_args, default_output, die, emit, ffmpeg_base, info, probe, run_keeping_subtitles, video_args, X264_PRESETS, MissingFpsError, parse_time, fmt_secs, run+from _common import add_common, apply_common, aac_args, cfr_args, default_output, die, emit, ffmpeg_base, info, probe, run_keeping_subtitles, video_args, X264_PRESETS, MissingFpsError, time_arg, fmt_secs, rundef main() -> int:@@ -45,10 +45,7 @@ def main() -> int:dur = meta.get("duration") or 0.0fps = meta["video"].get("fps") or 30.0if args.at is not None:- try:- at = parse_time(args.at, (meta.get("video") or {}).get("fps"))- except (ValueError, MissingFpsError) as e:- die(f"--at {args.at!r}: {e}")+ at = time_arg(args.at, "--at", (meta.get("video") or {}).get("fps"))else:at = durif at < 0 or at > dur:diff --git a/scripts/render.py b/scripts/render.pyindex 9badffa..38df63b 100755--- a/scripts/render.py+++ b/scripts/render.py@@ -56,7 +56,7 @@ import sysfrom pathlib import Pathfrom typing import Any, Dict, List-from export import PRESETS+from export import PRESETS, PLATFORM_OFfrom _common import STATE, add_common, apply_common, child_args, die, emit, info, probe, run_tool, place_output, refuse_output_is_input, fingerprint, PLAN_VERSIONHERE = Path(__file__).resolve().parent@@ -464,7 +464,14 @@ def main() -> int:argv += ["--fit", ex["fit"]]if ex.get("crf") is not None:argv += ["--crf", str(ex["crf"])]- if ex.get("normalize"):+ normalize = ex.get("normalize")+ if normalize is None and ex["preset"] in PLATFORM_OF and not proj.get("loudness"):+ # eval 8: a reels project without the key rendered fully, failed the loudness check and+ # was rendered again; a platform preset with no loudness stage of its own gets the+ # one-export behaviour by default ("normalize": false opts out)+ normalize = True+ info(f"export: --normalize on by default for the {ex['preset']} preset (set \"normalize\": false to skip)")+ if normalize:argv += ["--normalize"] # one export that meets the platform's loudness (export.py --normalize)sh("export.py", *argv)stages_done.append("export")diff --git a/tests/test_all.py b/tests/test_all.pyindex faf6990..894121f 100644--- a/tests/test_all.py+++ b/tests/test_all.py@@ -1085,6 +1085,45 @@ class FFmpegSkillTests(unittest.TestCase):self.assertTrue((sub / "cap_side.srt").exists(), "SRT written beside the output")self.assertFalse((OUT / "source.srt").exists(), "no SRT dropped next to the source")+ def test_time_grammar_is_one_parser_with_an_fps_suffix(self):+ """1.9 (roadmap): hh:mm:ss:ff@fps names the rate; broll / cut / freeze refuse a bad time as+ kind input naming the flag, like every other tool, instead of their own wording."""+ sys.path.insert(0, str(SCRIPTS))+ try:+ import _common as c+ finally:+ sys.path.pop(0)+ self.assertAlmostEqual(c.parse_time("00:00:01:15@30"), 1.5)+ self.assertAlmostEqual(c.parse_time("00:00:01:15@30", fps=24), 1.5, msg="the suffix beats the fps a tool passed in")+ self.assertAlmostEqual(c.parse_time("01:00:00:[email protected]"), 108000 / 29.97)+ with self.assertRaises(ValueError):+ c.parse_time("12.5@30")+ with self.assertRaises(ValueError):+ c.parse_time("00:00:01:15@fast")+ with self.assertRaises(c.MissingFpsError):+ c.parse_time("00:00:01:15")+ # the three tools that had their own wrappers+ d = json.loads(script("cut.py", self.src, "--start", "00:00:01:15@30", "--end", "00:00:02:00@30", "-o", OUT / "tc_cut.mp4", "--json", "--overwrite").stdout)+ self.assertAlmostEqual(d["expected_duration"], 0.5, places=2)+ d = json.loads(script("cut.py", self.src, "--start", "nonsense", "-o", OUT / "tc_bad.mp4", "--json", expect_fail=True).stdout)+ self.assertEqual(d["error"]["kind"], "input")+ self.assertIn("--start", d["error"]["message"])+ d = json.loads(script("freeze.py", self.src, "--at", "1:xx", "--hold", "1", "-o", OUT / "tc_freeze.mp4", "--json", expect_fail=True).stdout)+ self.assertEqual(d["error"]["kind"], "input")+ self.assertIn("--at", d["error"]["message"])+ d = json.loads(script("broll.py", self.src, "--insert", self.src, "--at", "1:xx", "-o", OUT / "tc_broll.mp4", "--json", expect_fail=True).stdout)+ self.assertEqual(d["error"]["kind"], "input")+ self.assertIn("--at", d["error"]["message"])++ def test_probe_hdr_signal_is_the_transfer_not_the_primaries(self):+ """1.9: hdr_signal is true for PQ / HLG / Dolby Vision only; hdr keeps its 1.x meaning."""+ m = probe(str(self.hdr))+ self.assertTrue(m["video"]["hdr"])+ self.assertTrue(m["video"]["hdr_signal"])+ m = probe(str(self.src))+ self.assertFalse(m["video"]["hdr"])+ self.assertFalse(m["video"]["hdr_signal"])+def test_caption_smpte_timecode_cues_convert_frames_to_seconds(self):tc = OUT / "tc_cues.txt"tc.write_text("00:00:00:12 --> 00:00:02:00 Hello\n00:00:02:00 --> 00:00:04:00 World\n", encoding="utf-8")@@ -2372,14 +2411,31 @@ class FFmpegSkillTests(unittest.TestCase):proj = OUT / "project_normalize.json"proj.write_text(json.dumps({"output": "render_normalize.mp4",- "clips": [{"src": "source.mp4", "in": "0:01", "out": "0:03"}],+ "clips": [{"src": "source.mp4"}],"export": {"preset": "x", "normalize": True},"check": {"platform": "x"},}), encoding="utf-8")data = json.loads(script("render.py", proj, "--fast", "--json").stdout)self.assertTrue(data["check"]["ok"], data["check"])rows = {r["check"]: r["status"] for r in data["check"]["checks"]}- self.assertEqual(rows["loudness"], "PASS", "the -9 LUFS source only passes when export ran --normalize")+ self.assertEqual(rows["loudness"], "PASS", "the -9 LUFS source (whole clip: a 2 s slice happens to sit at -13 LUFS) only passes when export ran --normalize")+ # 1.9: a platform preset with no loudness stage normalises by default; false opts out+ proj.write_text(json.dumps({+ "output": "render_normalize_default.mp4",+ "clips": [{"src": "source.mp4"}],+ "export": {"preset": "x"},+ "check": {"platform": "x"},+ }), encoding="utf-8")+ data = json.loads(script("render.py", proj, "--fast", "--json").stdout)+ self.assertEqual({r["check"]: r["status"] for r in data["check"]["checks"]}["loudness"], "PASS")+ proj.write_text(json.dumps({+ "output": "render_normalize_off.mp4",+ "clips": [{"src": "source.mp4"}],+ "export": {"preset": "x", "normalize": False},+ "check": {"platform": "x"},+ }), encoding="utf-8")+ data = json.loads(script("render.py", proj, "--fast", "--json", expect_fail=True).stdout)+ self.assertEqual({r["check"]: r["status"] for r in data["check"]["checks"]}["loudness"], "FAIL")def test_check_unmeasurable_loudness_warns_instead_of_silently_passing(self):"""measure_loudness() returns {} when ffmpeg's loudnorm JSON doesn't parse out of stderr