ffmpeg-skill 2.3.2 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/contract.md +3 -3
- package/package.json +1 -1
- package/references/scripts.md +6 -4
- package/scripts/_contract.py +1 -1
- package/scripts/join.py +36 -2
package/docs/contract.md
CHANGED
|
@@ -21,7 +21,7 @@ The contract is derived from the code that runs, not maintained beside it:
|
|
|
21
21
|
| Field | Meaning | Changes when |
|
|
22
22
|
|---|---|---|
|
|
23
23
|
| `contract_version` | shape of this document (`1.0`) | a key is renamed, removed or changes meaning |
|
|
24
|
-
| `skill.version` | the npm / package.json version (`2.
|
|
24
|
+
| `skill.version` | the npm / package.json version (`2.4.0`) | any release |
|
|
25
25
|
|
|
26
26
|
A release that adds a tool or a flag keeps `contract_version`; a breaking change to the
|
|
27
27
|
ToolSpec shape bumps it. Consumers pin on `contract_version` and read `skill.version`
|
|
@@ -119,7 +119,7 @@ JSON would have been rewritten for that. The flat keys, typed per tool in `outpu
|
|
|
119
119
|
"contract_version": "1.0",
|
|
120
120
|
"deprecated": [],
|
|
121
121
|
"removed": [{"what": "...", "since": "1.10.0", "replacement": "...", "removed_in": "2.0.0", "where": "cli | json | mcp | behaviour"}],
|
|
122
|
-
"skill": {"id": "ffmpeg-skill", "version": "2.
|
|
122
|
+
"skill": {"id": "ffmpeg-skill", "version": "2.4.0", "execution_mode": "local", "kind": "execution",
|
|
123
123
|
"entrypoints": {"cli": "...", "mcp": "...", "contract": "...", "doctor": "..."},
|
|
124
124
|
"not_provided": ["AI reasoning", "decisions", "production plans", "project IR", "approvals", "network access", "transcription engine"]},
|
|
125
125
|
"requirements": {"python": ">=3.9 (standard library only)", "ffmpeg": ">=5.0", "ffprobe": ">=5.0"},
|
|
@@ -521,7 +521,7 @@ Per-tool keys added after 2.2.2, all additive:
|
|
|
521
521
|
| key | tool | what it holds |
|
|
522
522
|
|---|---|---|
|
|
523
523
|
| `sdr_path`, `notes` | `color.py --to-sdr` | `sdr_path` is `"tonemap"` for PQ / HLG / Dolby Vision input (and `--force` on an untagged file) or `"gamut"` for BT.2020 primaries on an SDR transfer, which is converted to BT.709 without a tone map (`--tonemap`/`--peak`/`--desat` do not apply); `notes` says which path was taken and why |
|
|
524
|
-
| `silent` | `join.py` (every run) | `[{index, path, peak_db}]`: inputs whose whole-file audio peak (volumedetect) is at or below `--silence-threshold` (default -50 dBFS) and that `--on-silent warn` (default) joined anyway, with a `notes` line; `[]` otherwise. `--on-silent fail` names them in the `kind: input` refusal's `problems` (reason `silent (peak -91.0 dBFS)`), `skip` lists them under `skipped`. An input with no audio stream is never silent; `verified` is unaffected |
|
|
524
|
+
| `silent` | `join.py` (every run) | `[{index, path, peak_db, at, end}]`: inputs whose whole-file audio peak (volumedetect) is at or below `--silence-threshold` (default -50 dBFS) and that `--on-silent warn` (default) joined anyway, with a `notes` line; `at`/`end` are where the input sits in the output, in seconds (a transition overlaps its neighbours). An input named by `--allow-silent N[,N]` (1-based) is a planned pause: always joined, listed with `intended: true`, no warning or note, whatever `--on-silent` says. `[]` otherwise. `--on-silent fail` names them in the `kind: input` refusal's `problems` (reason `silent (peak -91.0 dBFS)`), `skip` lists them under `skipped`. An input with no audio stream is never silent; `verified` is unaffected |
|
|
525
525
|
| `short_segments`, `duplicates` | `join.py` (every run) | warnings, never refusals, and the join command is unchanged: `short_segments: [{index, path, duration}]` names each measured input shorter than 2 frames at the join's fps (an audio-only join: shorter than 0.05 s); `duplicates: [{path, indices}]` names a path (compared resolved) listed more than once — repeating a clip can be intended. `[]` when none; each non-empty one adds a `notes` line |
|
|
526
526
|
| `silent` | `waveform.py` (every run) | `true` when the input audio's whole-file peak is at or below `--silence-threshold` (default -50 dBFS), which draws a flat line; `--on-silent warn` (default) renders it anyway with a `notes` line, `fail` refuses (`kind: input`) before ffmpeg runs. `false` when audible, `null` under `--dry-run` (nothing measured). `verified` is unaffected |
|
|
527
527
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ffmpeg-skill",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Agent Skill that gives coding agents (Claude Code, Cursor, Codex) a local video editor: 42 FFmpeg tools with a machine-readable contract, contract-derived MCP server, FFmpeg capability detection, probe-first / verify-last workflow. Cut, join, silence removal, fit, captions and karaoke, overlays, motion graphics, HDR to SDR, LUTs, audio clean-up and typed dynamics, sync with drift correction, multicam, loudness, delivery checks, project rendering, batch. No API keys, no cloud, no dependencies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ffmpeg",
|
package/references/scripts.md
CHANGED
|
@@ -560,7 +560,7 @@ writes the resulting cut list exactly as it does today.
|
|
|
560
560
|
```
|
|
561
561
|
join.py CLIP1 CLIP2 [...] [--transition fade|dissolve|wipeleft|slideleft|fadeblack|fadewhite|circleopen|none]
|
|
562
562
|
[--duration 0.5] [--width W --height H] [--fps N] [--fit pad|crop] [-o OUT]
|
|
563
|
-
join.py --list parts.txt [--on-missing fail|skip] [--on-silent warn|fail|skip] [--silence-threshold -50] [...]
|
|
563
|
+
join.py --list parts.txt [--on-missing fail|skip] [--on-silent warn|fail|skip] [--allow-silent N[,N]] [--silence-threshold -50] [...]
|
|
564
564
|
```
|
|
565
565
|
`--list FILE` (2.2) reads the clips from a file, one per line in order, paths relative to the
|
|
566
566
|
file (blank lines and `#` comments ignored; ffmpeg's `file 'x.wav'` lines accepted), for the
|
|
@@ -579,9 +579,11 @@ frame, rate or xfade offsets that rest on a pending input's unmeasured placehold
|
|
|
579
579
|
Every existing input with an audio stream is also measured (one volumedetect pass; not under `--dry-run`
|
|
580
580
|
too): a peak at or below `--silence-threshold` (default -50 dBFS) is silent, the trace of a TTS
|
|
581
581
|
call that wrote a valid but empty file. `--on-silent warn` (default) joins it and names it under
|
|
582
|
-
`silent: [{index, path, peak_db}]`
|
|
583
|
-
document (`silent (peak -91.0 dBFS)`);
|
|
584
|
-
|
|
582
|
+
`silent: [{index, path, peak_db, at, end}]` (`at`/`end`: where it sits in the output, seconds)
|
|
583
|
+
and in `notes`; `fail` refuses it in the same `kind: input` document (`silent (peak -91.0 dBFS)`);
|
|
584
|
+
`skip` leaves it out under `skipped`. A pause that is meant to be silent: `--allow-silent 3,7`
|
|
585
|
+
(1-based) joins those inputs whatever `--on-silent` says and lists them with `intended: true`,
|
|
586
|
+
no warning. A clip without an audio stream is never silent.
|
|
585
587
|
Two warnings never refuse or change the command: `short_segments: [{index, path, duration}]`
|
|
586
588
|
names a clip shorter than 2 frames at the join's fps (audio-only: 0.05 s), and
|
|
587
589
|
`duplicates: [{path, indices}]` a path listed more than once (a repeat can be intended); both
|
package/scripts/_contract.py
CHANGED
|
@@ -464,7 +464,7 @@ def output_schema(name: str, meta: Dict[str, Any]) -> Dict[str, Any]:
|
|
|
464
464
|
"sample_rate": {"type": "integer", "description": "audio mode only"}, "channels": {"type": "integer", "description": "audio mode only"},
|
|
465
465
|
"video": {"type": "boolean", "description": "false in audio mode: the output has no video stream"},
|
|
466
466
|
"skipped": {"type": "array", "description": "inputs --on-missing skip left out: [{index, path, reason}] ([] when none were)"},
|
|
467
|
-
"silent": {"type": "array", "description": "inputs whose audio peak is at or below --silence-threshold (default -50 dBFS) and that --on-silent warn (default) joined anyway: [{index, path, peak_db}] ([] otherwise; fail refuses
|
|
467
|
+
"silent": {"type": "array", "description": "inputs whose audio peak is at or below --silence-threshold (default -50 dBFS) and that --on-silent warn (default) joined anyway, plus every --allow-silent input that was silent: [{index, path, peak_db, at, end, intended?}]; at/end are the input's start and end in output seconds (a transition overlaps neighbours), intended: true marks an --allow-silent input (joined whatever --on-silent says, no warning). [] otherwise; fail refuses unallowed ones under problems, skip lists them under skipped; an input with no audio stream is never silent"},
|
|
468
468
|
"short_segments": {"type": "array", "description": "warning, never a refusal: measured inputs shorter than 2 frames at the join's fps (audio-only join: shorter than 0.05 s), [{index, path, duration}] ([] when none), each also in notes; a pending --dry-run input is not measured"},
|
|
469
469
|
"duplicates": {"type": "array", "description": "warning, never a refusal (a repeat can be intended): a path (compared resolved) listed more than once and joined each time, [{path, indices}] with 0-based list positions ([] when none), also in notes"},
|
|
470
470
|
"pending": {"type": "array", "description": "--dry-run: inputs that do not exist yet, planned on as an earlier step's output and never also under skipped: [{index, path}] ([] otherwise)"},
|
package/scripts/join.py
CHANGED
|
@@ -127,6 +127,7 @@ def join_audio(args: argparse.Namespace, metas: List[dict]) -> int:
|
|
|
127
127
|
n = len(args.inputs)
|
|
128
128
|
durs = [m.get("duration") or 0.0 for m in metas]
|
|
129
129
|
d = args.duration if args.transition != "none" else 0.0
|
|
130
|
+
place_silent(durs, d)
|
|
130
131
|
note_short_segments(args.inputs, metas, MIN_AUDIO_SEGMENT, f"{MIN_AUDIO_SEGMENT:g}s")
|
|
131
132
|
for p, dur in zip(args.inputs, durs):
|
|
132
133
|
if d and dur <= d * 2 and not STATE.dry_run:
|
|
@@ -258,6 +259,32 @@ def find_silent(paths: List[str], audible: List[int], threshold: float) -> List[
|
|
|
258
259
|
return silent
|
|
259
260
|
|
|
260
261
|
|
|
262
|
+
def place_silent(lens: List[float], d: float) -> None:
|
|
263
|
+
"""Where each joined silent input sits in the output: `at`/`end` in output seconds. Input k
|
|
264
|
+
(in kept order) starts after the kept inputs before it, each overlapped by the transition d."""
|
|
265
|
+
for sil in STATE_SILENT:
|
|
266
|
+
if sil["index"] not in STATE_KEPT:
|
|
267
|
+
continue
|
|
268
|
+
k = STATE_KEPT.index(sil["index"])
|
|
269
|
+
if k >= len(lens):
|
|
270
|
+
continue
|
|
271
|
+
at = sum(lens[:k]) - k * d
|
|
272
|
+
sil["at"], sil["end"] = round(at, 3), round(at + lens[k], 3)
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
def parse_allow_silent(value: Optional[str], n: int) -> List[int]:
|
|
276
|
+
"""--allow-silent 3,7 -> 0-based indices; each must name an input (1..n)."""
|
|
277
|
+
if not value:
|
|
278
|
+
return []
|
|
279
|
+
out = []
|
|
280
|
+
for tok in value.split(","):
|
|
281
|
+
tok = tok.strip()
|
|
282
|
+
if not tok.isdigit() or not 1 <= int(tok) <= n:
|
|
283
|
+
die(f"--allow-silent takes input numbers 1..{n} separated by commas, got {tok!r}")
|
|
284
|
+
out.append(int(tok) - 1)
|
|
285
|
+
return out
|
|
286
|
+
|
|
287
|
+
|
|
261
288
|
def main() -> int:
|
|
262
289
|
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
|
263
290
|
ap.add_argument("inputs", nargs="*", help="two or more clips in order (or --list FILE)")
|
|
@@ -270,6 +297,9 @@ def main() -> int:
|
|
|
270
297
|
help="an input whose audio peak is at or below --silence-threshold: warn (default; join it, "
|
|
271
298
|
"name it under `silent`), fail (refuse with the other input problems) or skip (leave it out, "
|
|
272
299
|
"under `skipped`); a clip with no audio stream is never silent")
|
|
300
|
+
ap.add_argument("--allow-silent", metavar="N[,N...]",
|
|
301
|
+
help="input numbers (1-based) whose silence is intended, e.g. a planned pause: always joined, "
|
|
302
|
+
"listed under `silent` with intended: true, no warning, whatever --on-silent says")
|
|
273
303
|
ap.add_argument("--silence-threshold", type=float, default=-50.0, metavar="DB",
|
|
274
304
|
help="peak level in dBFS at or below which an input counts as silent (default -50)")
|
|
275
305
|
ap.add_argument("-o", "--output", help="output file (default: <first>_joined.mp4)")
|
|
@@ -303,7 +333,10 @@ def main() -> int:
|
|
|
303
333
|
orig_inputs = list(args.inputs)
|
|
304
334
|
audible: List[int] = []
|
|
305
335
|
problems, pending = preflight(args.inputs, audible)
|
|
306
|
-
|
|
336
|
+
allowed = parse_allow_silent(args.allow_silent, len(args.inputs))
|
|
337
|
+
found = find_silent(args.inputs, audible, args.silence_threshold)
|
|
338
|
+
intended = [dict(s, intended=True) for s in found if s["index"] in allowed]
|
|
339
|
+
silent = [s for s in found if s["index"] not in allowed]
|
|
307
340
|
silent_problems = [{"index": s["index"], "path": s["path"], "reason": f"silent (peak {s['peak_db']:.1f} dBFS)"}
|
|
308
341
|
for s in silent]
|
|
309
342
|
refused = sorted((problems if args.on_missing == "fail" else [])
|
|
@@ -325,8 +358,8 @@ def main() -> int:
|
|
|
325
358
|
args.inputs = [p for i, p in enumerate(args.inputs) if i not in bad]
|
|
326
359
|
for p in dropped:
|
|
327
360
|
info(f"skipping #{p['index'] + 1} {p['path']}: {p['reason']}")
|
|
361
|
+
STATE_SILENT[:] = sorted(intended + (silent if args.on_silent == "warn" else []), key=lambda s: s["index"])
|
|
328
362
|
if silent and args.on_silent == "warn":
|
|
329
|
-
STATE_SILENT[:] = silent
|
|
330
363
|
listing = ", ".join(f"#{s['index'] + 1} {s['path']} (peak {s['peak_db']:.1f} dBFS)" for s in silent)
|
|
331
364
|
info(f"warning: {len(silent)} input(s) silent at or below {args.silence_threshold:g} dBFS, joined anyway: {listing}")
|
|
332
365
|
STATE_NOTES.append(f"{len(silent)} input(s) have no audible sound (peak at or below {args.silence_threshold:g} dBFS) "
|
|
@@ -413,6 +446,7 @@ def main() -> int:
|
|
|
413
446
|
# a crossfaded join gives each clip one length for both streams, so the offsets that place
|
|
414
447
|
# every picture also place its sound; the plain cut (concat) keeps the streams paired itself
|
|
415
448
|
lens = [clip_length(m, fps) for m in metas] if d else durs
|
|
449
|
+
place_silent(lens, d)
|
|
416
450
|
for p, dur in zip(args.inputs, lens):
|
|
417
451
|
if d and dur <= d * 2 and not STATE.dry_run:
|
|
418
452
|
die(f"{p} is only {dur:.2f}s, too short for a {d:.2f}s transition; shorten --duration")
|