remotion-ffmpeg-skill 0.14.3 → 0.14.4
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/package.json +1 -1
- package/scripts/_contract.py +3 -2
- package/scripts/deliver.py +45 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "remotion-ffmpeg-skill",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.4",
|
|
4
4
|
"description": "Agent Skill: ffmpeg-skill measures the footage, Remotion draws the motion graphics from those measurements, ffmpeg-skill checks and delivers the result. Timeline-driven captions, silence jump cuts and audio-peak motion with probe-first / verify-last rendering. Local, no API keys.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"remotion",
|
package/scripts/_contract.py
CHANGED
|
@@ -299,8 +299,9 @@ def tool_spec(name: str) -> Dict[str, Any]:
|
|
|
299
299
|
# The AI Video Production OS registry's keys (skill_id, provides[], dependencies[]): one capability
|
|
300
300
|
# per public tool except doctor, all EXPERIMENTAL; ffmpeg-skill is the only Skill this one calls.
|
|
301
301
|
PROVIDES_EXCLUDE = {"doctor"}
|
|
302
|
-
# 3.x accepted (docs/design-decisions.md): 3.0.0 removed nothing this skill calls, and
|
|
303
|
-
|
|
302
|
+
# 3.x and 4.x accepted (docs/design-decisions.md): 3.0.0 and 4.0.0 removed nothing this skill calls, and their
|
|
303
|
+
# behaviour changes (cut.py in 3.0; export loudness, fit --method, join --copy in 4.0) do not reach the calls made here
|
|
304
|
+
FFMPEG_SKILL_RANGE = ">=2.0.0 <5.0.0"
|
|
304
305
|
|
|
305
306
|
|
|
306
307
|
def provides() -> List[Dict[str, str]]:
|
package/scripts/deliver.py
CHANGED
|
@@ -11,14 +11,16 @@ Examples:
|
|
|
11
11
|
"""
|
|
12
12
|
import argparse
|
|
13
13
|
import json
|
|
14
|
+
import shutil
|
|
14
15
|
import sys
|
|
16
|
+
import tempfile
|
|
15
17
|
from pathlib import Path
|
|
16
|
-
from typing import Optional
|
|
18
|
+
from typing import List, Optional
|
|
17
19
|
|
|
18
20
|
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
19
21
|
from _captions import parse_chapters
|
|
20
|
-
from _common import (STATE, add_common, apply_common, default_output, die, emit,
|
|
21
|
-
refuse_existing, require_ffmpeg_skill, shell_join)
|
|
22
|
+
from _common import (STATE, add_common, apply_common, default_output, die, emit, ffmpeg_skill_version, ffskill,
|
|
23
|
+
ffskill_cmd, info, refuse_existing, require_ffmpeg_skill, shell_join)
|
|
22
24
|
|
|
23
25
|
# ffmpeg-skill's templates/*.json names (render.py --list-templates).
|
|
24
26
|
PLATFORMS = ["youtube", "youtube-shorts", "shorts", "reels", "tiktok", "x", "facebook", "linkedin", "podcast", "audiogram"]
|
|
@@ -39,6 +41,37 @@ def brand_logo(brand: Optional[str]) -> Optional[Path]:
|
|
|
39
41
|
return lp if lp.is_absolute() else bp.resolve().parent / lp
|
|
40
42
|
|
|
41
43
|
|
|
44
|
+
def template_runs_content_check() -> bool:
|
|
45
|
+
"""ffmpeg-skill 4.0.0 (#575) made a delivery template's check stage also run check.py --content (black frames,
|
|
46
|
+
freezes, flashes, silence), and a failed row fails the render. A Remotion deliverable often holds a still picture
|
|
47
|
+
on purpose (a title card, a slide), which 4.0 reads as `frozen`. deliver keeps 3.x's template (platform rows
|
|
48
|
+
only); its own check.py --platform still runs on the result (docs/design-decisions.md)."""
|
|
49
|
+
version = ffmpeg_skill_version(require_ffmpeg_skill()) or ""
|
|
50
|
+
try:
|
|
51
|
+
return int(version.split(".")[0]) >= 4
|
|
52
|
+
except ValueError:
|
|
53
|
+
return False
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def render_template(args: List[str], commands: List[str]) -> None:
|
|
57
|
+
"""render.py --template with args; on ffmpeg-skill 4.x through --write-project with the check stage's
|
|
58
|
+
`content` set to false (the migration ffmpeg-skill's docs/contract.md gives), so only the platform rows run."""
|
|
59
|
+
if not template_runs_content_check():
|
|
60
|
+
commands.append(ffskill("render", args)["_command"])
|
|
61
|
+
return
|
|
62
|
+
work = Path(tempfile.mkdtemp(prefix="rfs-deliver-"))
|
|
63
|
+
try:
|
|
64
|
+
project = work / "project.json"
|
|
65
|
+
commands.append(ffskill("render", [*args, "--write-project", str(project)])["_command"])
|
|
66
|
+
proj = json.loads(project.read_text(encoding="utf-8"))
|
|
67
|
+
if isinstance(proj.get("check"), dict):
|
|
68
|
+
proj["check"]["content"] = False
|
|
69
|
+
project.write_text(json.dumps(proj, indent=2) + "\n", encoding="utf-8")
|
|
70
|
+
commands.append(ffskill("render", [str(project)] + (["--overwrite"] if "--overwrite" in args else []))["_command"])
|
|
71
|
+
finally:
|
|
72
|
+
shutil.rmtree(work, ignore_errors=True)
|
|
73
|
+
|
|
74
|
+
|
|
42
75
|
def youtube_description(chapters_file: Path) -> str:
|
|
43
76
|
"""The chapter list as YouTube reads it from a description: `00:00 Title` per line."""
|
|
44
77
|
chapters = parse_chapters(chapters_file.read_text(encoding="utf-8-sig"), 0)
|
|
@@ -86,7 +119,8 @@ def main() -> None:
|
|
|
86
119
|
out = Path(a.output).expanduser() if a.output else default_output(src, f"_{a.platform}", ".mp4")
|
|
87
120
|
refuse_existing(out)
|
|
88
121
|
templated = out.with_name(out.stem + ".nochapters" + out.suffix) if a.chapters else out
|
|
89
|
-
|
|
122
|
+
# absolute paths: on ffmpeg-skill 4.x the filled project is rendered from a temporary directory
|
|
123
|
+
args = ["--template", a.platform, str(src.resolve()), "-o", str(templated.resolve())]
|
|
90
124
|
if a.brand:
|
|
91
125
|
bp = Path(a.brand).expanduser().resolve()
|
|
92
126
|
if not bp.is_file():
|
|
@@ -103,14 +137,18 @@ def main() -> None:
|
|
|
103
137
|
meta_args = ([str(templated), "--chapters", str(Path(a.chapters).expanduser()), "-o", str(out)]
|
|
104
138
|
+ (["--overwrite"] if STATE.overwrite else [])) if a.chapters else []
|
|
105
139
|
if STATE.dry_run:
|
|
106
|
-
|
|
140
|
+
if template_runs_content_check():
|
|
141
|
+
project = "<tmp>/project.json"
|
|
142
|
+
commands.append(shell_join(ffskill_cmd("render", [*args, "--write-project", project])))
|
|
143
|
+
commands.append(shell_join(ffskill_cmd("render", [project] + (["--overwrite"] if "--overwrite" in args else []))))
|
|
144
|
+
else:
|
|
145
|
+
commands.append(shell_join(ffskill_cmd("render", args)))
|
|
107
146
|
if a.chapters:
|
|
108
147
|
commands.append(shell_join(ffskill_cmd("metadata", meta_args)))
|
|
109
148
|
commands.append(shell_join(ffskill_cmd("check", [str(out), "--platform", a.platform])))
|
|
110
149
|
emit({"output": str(out), "commands": commands}, f"would deliver {out}")
|
|
111
150
|
return
|
|
112
|
-
|
|
113
|
-
commands.append(r["_command"])
|
|
151
|
+
render_template(args, commands)
|
|
114
152
|
if a.chapters:
|
|
115
153
|
m = ffskill("metadata", meta_args)
|
|
116
154
|
commands.append(m["_command"])
|