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 input deletion after failed ffprobe inspection
Scott Thomasa6da507c463f
diff --git a/scripts/_common.py b/scripts/_common.pyindex bb5d9cb..525cd21 100755--- a/scripts/_common.py+++ b/scripts/_common.py@@ -205,6 +205,10 @@ def _cleanup_partial_output(cmd: Sequence[str]) -> None:success path, so a failed run() call never routed through it. Remove whatever ffmpeg managedto write so a caller scanning the output directory after a failure never mistakes a partialartifact for a real (if unverified) one."""+ # run() also executes ffprobe, whose last argument is an INPUT. Never+ # interpret a read-only tool's failure as permission to remove that file.+ if not _is_ffmpeg(cmd):+ returnoutput = cmd[-1]if output in ("-", "pipe:0", "pipe:1") or output.startswith("pipe:") or output.startswith("-"):returndiff --git a/tests/test_contract.py b/tests/test_contract.pyindex 9313035..0328959 100644--- a/tests/test_contract.py+++ b/tests/test_contract.py@@ -44,6 +44,24 @@ def tool(name, *args, **kw):TONE = "0.5*sin(2*PI*440*t)*gt(sin(2*PI*0.37*t)\\,0.2)+0.3*sin(2*PI*660*t)*gt(sin(2*PI*0.53*t+1)\\,0.6)"[email protected](shutil.which("ffprobe"), "ffprobe not on PATH")+class ProbeInputPreservationTests(unittest.TestCase):+ def test_failed_probe_preserves_input(self):+ # Use real ffprobe and independent fixtures: every failure mode must leave+ # even an unreadable original byte-for-byte intact.+ for flags in ([], ["--dry-run"], ["--progress"], ["--dry-run", "--progress"]):+ with self.subTest(flags=flags), tempfile.TemporaryDirectory() as tmp:+ source = Path(tmp) / "corrupt.mp4"+ original = b"not a valid MP4; preserve this original\n"+ source.write_bytes(original)+ proc = tool("probe", source, "--json", *flags, check=False)+ self.assertNotEqual(proc.returncode, 0)+ self.assertIn("ffprobe failed", proc.stderr)+ self.assertEqual(json.loads(proc.stdout)["status"], "failed")+ self.assertTrue(source.exists(), "failed inspection deleted the input")+ self.assertEqual(source.read_bytes(), original)++class ContractTests(unittest.TestCase):@classmethoddef setUpClass(cls):