remotion-ffmpeg-skill 0.14.4 → 0.14.5
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/deliver.py +52 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "remotion-ffmpeg-skill",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.5",
|
|
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/deliver.py
CHANGED
|
@@ -41,6 +41,45 @@ def brand_logo(brand: Optional[str]) -> Optional[Path]:
|
|
|
41
41
|
return lp if lp.is_absolute() else bp.resolve().parent / lp
|
|
42
42
|
|
|
43
43
|
|
|
44
|
+
def kit_projection(path: Path) -> Optional[dict]:
|
|
45
|
+
"""Project a Velisa kit for delivery (ADR-030); native brand files go to the engine unchanged."""
|
|
46
|
+
try:
|
|
47
|
+
data = json.loads(path.read_text(encoding="utf-8"))
|
|
48
|
+
except (ValueError, OSError) as exc:
|
|
49
|
+
die(f"cannot read brand file {path}: {exc}", "input")
|
|
50
|
+
if not isinstance(data, dict):
|
|
51
|
+
die(f"{path} must hold a JSON object", "input")
|
|
52
|
+
if "colours" not in data and data.get("schema") != "velisa/kit@1":
|
|
53
|
+
return None
|
|
54
|
+
if "colors" in data and "colours" in data:
|
|
55
|
+
die(f"{path} defines both colors and colours", "input")
|
|
56
|
+
|
|
57
|
+
def subset(obj, keys):
|
|
58
|
+
if not isinstance(obj, dict):
|
|
59
|
+
die(f"expected an object in brand file {path}", "input")
|
|
60
|
+
return {key: obj[key] for key in keys if key in obj}
|
|
61
|
+
|
|
62
|
+
brand = subset(data, ("font", "font_file", "logo", "logo_position", "logo_scale", "logo_opacity",
|
|
63
|
+
"safe_margin", "lang"))
|
|
64
|
+
for key in ("logo", "font_file"):
|
|
65
|
+
if key in brand:
|
|
66
|
+
if not isinstance(brand[key], str) or not brand[key]:
|
|
67
|
+
die(f"{path}: {key} must be a non-empty path", "input")
|
|
68
|
+
brand[key] = str((path.parent / Path(brand[key]).expanduser()).resolve())
|
|
69
|
+
colors = "colors" if "colors" in data else "colours"
|
|
70
|
+
if colors in data:
|
|
71
|
+
brand["colors"] = subset(data[colors], ("primary", "text", "outline", "background", "accent"))
|
|
72
|
+
if "caption" in data:
|
|
73
|
+
brand["caption"] = subset(data["caption"], ("size", "position", "animate", "karaoke", "bold", "outline"))
|
|
74
|
+
if "styles" in data:
|
|
75
|
+
styles = subset(data["styles"], ("caption",))
|
|
76
|
+
if "caption" in styles:
|
|
77
|
+
brand["styles"] = {"caption": subset(styles["caption"], ("font", "size", "colour", "color", "box", "position"))}
|
|
78
|
+
if "loudness" in data:
|
|
79
|
+
brand["loudness"] = subset(data["loudness"], ("lufs", "tp"))
|
|
80
|
+
return brand
|
|
81
|
+
|
|
82
|
+
|
|
44
83
|
def template_runs_content_check() -> bool:
|
|
45
84
|
"""ffmpeg-skill 4.0.0 (#575) made a delivery template's check stage also run check.py --content (black frames,
|
|
46
85
|
freezes, flashes, silence), and a failed row fails the render. A Remotion deliverable often holds a still picture
|
|
@@ -121,11 +160,14 @@ def main() -> None:
|
|
|
121
160
|
templated = out.with_name(out.stem + ".nochapters" + out.suffix) if a.chapters else out
|
|
122
161
|
# absolute paths: on ffmpeg-skill 4.x the filled project is rendered from a temporary directory
|
|
123
162
|
args = ["--template", a.platform, str(src.resolve()), "-o", str(templated.resolve())]
|
|
163
|
+
projection = None
|
|
124
164
|
if a.brand:
|
|
125
165
|
bp = Path(a.brand).expanduser().resolve()
|
|
126
166
|
if not bp.is_file():
|
|
127
167
|
die(f"brand file not found: {a.brand}", "input")
|
|
128
|
-
|
|
168
|
+
projection = kit_projection(bp)
|
|
169
|
+
if projection is None:
|
|
170
|
+
args += ["--brand", str(bp)]
|
|
129
171
|
logo = Path(a.logo).expanduser() if a.logo else brand_logo(a.brand)
|
|
130
172
|
if logo:
|
|
131
173
|
if not logo.is_file():
|
|
@@ -137,6 +179,8 @@ def main() -> None:
|
|
|
137
179
|
meta_args = ([str(templated), "--chapters", str(Path(a.chapters).expanduser()), "-o", str(out)]
|
|
138
180
|
+ (["--overwrite"] if STATE.overwrite else [])) if a.chapters else []
|
|
139
181
|
if STATE.dry_run:
|
|
182
|
+
if projection is not None:
|
|
183
|
+
args += ["--brand", "<tmp>/brand.json"]
|
|
140
184
|
if template_runs_content_check():
|
|
141
185
|
project = "<tmp>/project.json"
|
|
142
186
|
commands.append(shell_join(ffskill_cmd("render", [*args, "--write-project", project])))
|
|
@@ -148,7 +192,13 @@ def main() -> None:
|
|
|
148
192
|
commands.append(shell_join(ffskill_cmd("check", [str(out), "--platform", a.platform])))
|
|
149
193
|
emit({"output": str(out), "commands": commands}, f"would deliver {out}")
|
|
150
194
|
return
|
|
151
|
-
|
|
195
|
+
if projection is None:
|
|
196
|
+
render_template(args, commands)
|
|
197
|
+
else:
|
|
198
|
+
with tempfile.TemporaryDirectory(prefix="rfs-kit-") as directory:
|
|
199
|
+
projected = Path(directory) / "brand.json"
|
|
200
|
+
projected.write_text(json.dumps(projection) + "\n", encoding="utf-8")
|
|
201
|
+
render_template([*args, "--brand", str(projected)], commands)
|
|
152
202
|
if a.chapters:
|
|
153
203
|
m = ffskill("metadata", meta_args)
|
|
154
204
|
commands.append(m["_command"])
|