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
fix(loudness): stream-copy branch was dropping -movflags +faststart (#277)
Shogo Kajiyama2306025062d8
diff --git a/scripts/loudness.py b/scripts/loudness.pyindex 67dcbf3..109a945 100755--- a/scripts/loudness.py+++ b/scripts/loudness.py@@ -105,6 +105,8 @@ def main() -> int:cmd += ["-vn"] + audio_codec_for(output, bitrate)else:cmd += ["-map", "0:v:0", "-map", "0:a:0", "-c:v", "copy", "-c:a", "aac", "-b:a", bitrate]+ if ext in (".mp4", ".mov", ".m4v"):+ cmd += ["-movflags", "+faststart"]dropped_streams = run_keeping_subtitles(cmd, output)returncmd.append(output)diff --git a/tests/test_audio.py b/tests/test_audio.pyindex 1afaefc..03ab660 100644--- a/tests/test_audio.py+++ b/tests/test_audio.py@@ -16,6 +16,16 @@ from _fixtures import MediaFixtures, OUT, SCRIPTS, script, sh # noqa: E402from _common import probe # noqa: E402+def _is_faststart(path) -> bool:+ """moov before mdat. Reads the whole file rather than a leading slice: bytes.find() on a+ short read returns -1 for an atom that is actually further in, which compares as "before"+ every other offset and reports a false faststart -- issue #275 called this out explicitly+ after hitting it while confirming the bug."""+ data = Path(path).read_bytes()+ moov, mdat = data.find(b"moov"), data.find(b"mdat")+ return moov != -1 and mdat != -1 and moov < mdat++class AudioTests(MediaFixtures):"""Audio, loudness and waveform."""@@ -79,6 +89,12 @@ class AudioTests(MediaFixtures):self.assertClose(float(stats["input_i"]), -16.0, 1.0, "integrated loudness")self.assertLessEqual(float(stats["input_tp"]), -1.0, "true peak ceiling")self.assertEqual(probe(str(out))["video"]["codec"], "h264", "video stream copied")+ # #275: every other mp4-writing path (x264, colour, export.py) adds -movflags+ # +faststart; this stream-copy branch (video copied, only audio re-encoded -- the path+ # render.py --template's export.py --normalize step runs) silently dropped it, so a+ # template delivery came out with moov at the end despite export.py having just written+ # it faststart.+ self.assertTrue(_is_faststart(out), "#275: loudness.py's stream-copy branch must write +faststart")def test_audio_music_bed_never_shortens_the_video(self):"""#164: a looped music bed under --duck came out 11.925 s from a 12.00 s source, and