remotion-ffmpeg-skill 0.6.0 → 0.7.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/README.md CHANGED
@@ -116,7 +116,7 @@ This skill is MIT. **Remotion itself has its own licence**: free for individuals
116
116
 
117
117
  Remotion renders in a headless browser. Measured on a 2-core Linux machine: a 30 s 1080p30 render takes about 80 s (≈ 2.6× the clip length) with render.py's default of all CPU cores — Remotion's own default (half the cores) took 170 s. More cores scale it further. Check with `still.py` and `--fast` before a full render of long footage.
118
118
 
119
- **`--sparse`** (Captioned, Karaoke): only the frames that show a caption are drawn; ffmpeg-skill places each stretch back at its time over the untouched source. Same picture frame for frame (checked by an integration test), and the render time follows the captioned share of the footage: 60 s with 7 s of captions took 46 s instead of 152 s. Needs an ffmpeg-skill whose `overlay.py` has `--place`; otherwise it draws the full layer and says why.
119
+ **`--sparse`** (Captioned, Karaoke, Titled): only the frames that show a caption, lower third or scene title are drawn; ffmpeg-skill places each stretch back at its time over the untouched source. Same picture frame for frame (checked by an integration test), and the render time follows the captioned share of the footage: 60 s with 7 s of captions took 46 s instead of 152 s; 40 s with two scene titles and a lower third, 39 s instead of 104 s. Needs an ffmpeg-skill whose `overlay.py` has `--place`; otherwise it draws the full layer and says why.
120
120
 
121
121
  ## Agent evals
122
122
 
package/SKILL.md CHANGED
@@ -20,7 +20,7 @@ Shared flags (every script): `--json` (one JSON object on stdout; prefer it), `-
20
20
  - **Shape:** draw in the shape it will be delivered in. `--aspect 9:16` for Reels / TikTok / Shorts (`1:1`, `4:5`, `16:9` too); `--fit blur` (default when the shape changes: contained over a blurred copy), `contain` (bars) or `cover` (crop — check the subject in the still first). Never render 16:9 and let a 9:16 template crop it: captions lose their edges. `pipeline.py --platform` picks the aspect from ffmpeg-skill's template for you.
21
21
  - **Fonts:** Japanese / Chinese / Korean captions get the CJK font ffmpeg-skill finds on the machine automatically (staged into the project, so no tofu); `--font-file F.ttf` uses a specific font; the report line `font:` says which was used, or that none was found.
22
22
  - **Editing-app layer:** `--overlay --keep-graphics` (Captioned / PeakPulse, source shape) draws the graphics alone as a transparent ProRes 4444 `.graphics.mov` and composites it over the untouched source with ffmpeg-skill `overlay.py`; hand the `.mov` to someone finishing in Premiere / Resolve / Final Cut. It is not faster than a normal render.
23
- - **Long footage with gaps between captions:** `--sparse` (Captioned / Karaoke) draws only the frames where a caption shows and places each stretch back at its time with ffmpeg-skill `overlay.py --place` — same picture, frame for frame. It needs an ffmpeg-skill with `--place`; without it (or when the source does not start at 0) it draws the full layer and says why in `sparse.reason`.
23
+ - **Long footage with gaps between captions:** `--sparse` (Captioned / Karaoke / Titled) draws only the frames where a caption, lower third or scene title shows and places each stretch back at its time with ffmpeg-skill `overlay.py --place` — same picture, frame for frame. It needs an ffmpeg-skill with `--place`; without it (or when the source does not start at 0) it draws the full layer and says why in `sparse.reason`.
24
24
  5. **Deliver.** `deliver.py OUT.mp4 --platform youtube|reels|tiktok|shorts|x|...` runs ffmpeg-skill's delivery template and its `check.py` table. Format rows are safe to fix; judgement rows (duration, aspect) change content — ask. Mention WARNs, don't chase them. No destination named: skip this step and say so.
25
25
  6. **Look.** Not finished until the reply names the contact sheet render.py wrote (`Look: PATH`) and says what it shows. Mechanical (check and report): text is where it was asked, cues appear at their times, nothing is cut off by the frame. Judgement (say what you see, the user decides): text over a face, a jump that lands badly. No image view: `Look: PATH (pixels not inspected)` — never claim you looked. No contact sheet (`look_error` in the result, e.g. an FFmpeg without `drawtext`): look at `still.py` frames instead and pass on the fix the error names.
26
26
 
@@ -35,11 +35,10 @@ Everything in one go: `pipeline.py SOURCE --project ./motion --comp NAME [--capt
35
35
  ffmpeg-skill by itself already does silence cuts, burned-in (also pop / karaoke) captions, title and lower-third templates, joins and platform templates, without a browser render. For a request that fits those, ffmpeg-skill alone is a valid and faster answer. Choose this skill when the request needs something ffmpeg-skill does not draw:
36
36
 
37
37
  - motion tied to measurements: punch-in zooms on jump cuts, pulses on peaks or beats, picture cuts on a beat grid, a highlight counter;
38
- - a different shape **without losing picture**: ffmpeg-skill's Reels / TikTok / Shorts templates centre-crop a 16:9 source (`fit: crop`), so the sides are cut off; `--aspect 9:16 --fit blur` keeps the whole frame;
39
38
  - the graphics as a separate transparent layer for an editor (`--overlay --keep-graphics`);
40
39
  - a custom React composition, or the user asks for Remotion.
41
40
 
42
- Whichever you choose, say which one and the trade-off that matters (for example "centre-cropped: the left and right edges are gone").
41
+ Changing the shape alone is not a reason: ffmpeg-skill's Reels / TikTok / Shorts templates centre-crop by default, but ffmpeg-skill can also keep the whole frame on a blurred fill. Whichever you choose, say which one and the trade-off that matters (for example "centre-cropped: the left and right edges are gone").
43
42
 
44
43
  ## Request → script / composition
45
44
 
@@ -56,7 +55,7 @@ Whichever you choose, say which one and the trade-off that matters (for example
56
55
  | "vertical / 9:16 / square" | `render.py --aspect 9:16` (or `1:1`, `4:5`) |
57
56
  | "Japanese captions" / a specific font | nothing extra for CJK (auto font); `--font-file` for a chosen font |
58
57
  | "give me the graphics as a separate layer" | `render.py --overlay --keep-graphics` |
59
- | captions on long footage (a talk, a lecture) | `render.py --comp Captioned --sparse` (or `Karaoke`): only the captioned stretches are drawn |
58
+ | captions or name titles on long footage (a talk, a lecture) | `render.py --comp Captioned --sparse` (or `Karaoke`, `Titled`): only the stretches where something shows are drawn |
60
59
  | "change colour / font / caption size / zoom" | an `--options` JSON (`references/timeline.md`), re-render |
61
60
  | several clips ("intro + talk + outro") | `analyze.py A.mp4 B.mov C.mp4` (or `pipeline.py` with several inputs): ffmpeg-skill join.py normalises and joins them, then everything is measured on the joined file |
62
61
  | "preview" / "show me a frame" | `still.py` |
@@ -75,6 +74,6 @@ Whichever you choose, say which one and the trade-off that matters (for example
75
74
  - Remotion licence: free for individuals and for-profit organisations with up to 3 employees; larger companies need a Remotion company licence (https://www.remotion.dev/license). If the user is plainly a larger company, say so once.
76
75
  - Keep the user's originals: sources are linked into `public/media/` of the project, never modified; outputs never overwrite an existing file without `--overwrite`.
77
76
  - CJK captions: the auto font comes from ffmpeg-skill's font detection; when the report says no font was found, install one (Noto Sans CJK) or pass `--font-file` — tofu in the contact sheet is a failed job. Japanese lines break between phrases, not inside words.
78
- - Speed (measured on a 2-core Linux machine, all cores — render.py's default): about 2.6× the clip length for 1080p30 (30 s took 80 s). Preview with `still.py` and `--fast` before a full render of long footage; tell the user the expected time before starting a long render. `--sparse` cuts that to the captioned share: 60 s with 7 s of captions went from 152 s to 46 s. `--concurrency` above the core count is refused by Remotion.
77
+ - Speed (measured on a 2-core Linux machine, all cores — render.py's default): about 2.6× the clip length for 1080p30 (30 s took 80 s). Preview with `still.py` and `--fast` before a full render of long footage; tell the user the expected time before starting a long render. `--sparse` cuts that to the share that shows graphics: 60 s with 7 s of captions went from 152 s to 46 s; 40 s with two scene titles and one lower third from 104 s to 39 s. `--concurrency` above the core count is refused by Remotion.
79
78
  - Remotion packages in a project must all be the same version; the template pins them. Don't mix in a different `remotion` version.
80
79
  - A render that fails verification is a failure: report the failed rows from `--json`, don't ship it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remotion-ffmpeg-skill",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
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",
@@ -112,8 +112,8 @@ Render a composition from a timeline, verify it (frames, fps, size, audio) and w
112
112
  | `--no-look` | boolean | | skip the contact sheet |
113
113
  | `--overlay` | boolean | | draw the graphics only as a transparent ProRes 4444 layer and composite it over the untouched source with ffmpeg-skill overlay.py (Captioned / PeakPulse, source frame only); with --keep-graphics the layer is kept for an editing app (Premiere, Resolve, Final Cut) |
114
114
  | `--keep-graphics` | boolean | | with --overlay: keep the transparent graphics .mov |
115
- | `--sparse` | boolean | | overlay mode that draws only the frames where captions show (Captioned / Karaoke) and places each stretch at its time with ffmpeg-skill overlay.py --place: much faster on long footage with gaps between captions. Falls back to the full-length layer (and says why) when this ffmpeg-skill has no --place or the source does not start at 0 |
116
- | `--merge-gap` | number | `2.0` | with --sparse: captions closer than this many seconds are drawn as one stretch (default 2) |
115
+ | `--sparse` | boolean | | overlay mode that draws only the frames where something shows (Captioned / Karaoke / Titled) and places each stretch at its time with ffmpeg-skill overlay.py --place: much faster on long footage with gaps between captions. Falls back to the full-length layer (and says why) when this ffmpeg-skill has no --place or the source does not start at 0 |
116
+ | `--merge-gap` | number | `2.0` | with --sparse: graphics closer than this many seconds are drawn as one stretch (default 2) |
117
117
  | `--aspect` | string: source / 16:9 / 9:16 / 1:1 / 4:5 / 4:3 | | output shape (default: the source's own). 9:16 for Reels/TikTok/Shorts, 1:1, 4:5, 16:9 |
118
118
  | `--width` | integer | | output width in px (default: keep the source's short side) |
119
119
  | `--fit` | string: blur / contain / cover | | how the source fills another shape: blur (default when the shape changes), contain (bars) or cover (crop) |
@@ -1,50 +1,86 @@
1
- """Sparse overlay rendering: draw only the frames where captions show, then lay each drawn stretch
1
+ """Sparse overlay rendering: draw only the frames where something shows, then lay each drawn stretch
2
2
  back at its own time with ffmpeg-skill `overlay.py --place`.
3
3
 
4
4
  Remotion renders every frame in a browser, so a 30-minute talk with captions on a third of it spends
5
- two thirds of the render on empty transparent frames. Here the caption cues are grouped into
6
- stretches (cues closer than `merge_gap` seconds share one), the stretches are packed back to back
7
- in a short timeline, Remotion draws that, and overlay.py places each stretch over the untouched
8
- source. Frame numbers stay integers end to end, so the result matches the full-length overlay.
5
+ two thirds of the render on empty transparent frames. Here the shown intervals (caption cues, or
6
+ Titled's lower thirds and scene cards) are grouped into stretches (intervals closer than `merge_gap`
7
+ seconds share one), the stretches are packed back to back in a short timeline, Remotion draws that,
8
+ and overlay.py places each stretch over the untouched source. Everything moves by whole frames, so
9
+ the result matches the full-length overlay frame for frame.
9
10
  """
10
11
  import copy
11
12
  from typing import Any, Dict, List, Optional, Tuple
12
13
 
13
14
  from _common import sec_to_frames
14
15
 
15
- SPARSE_COMPOSITIONS = ("Captioned", "Karaoke")
16
+ SPARSE_COMPOSITIONS = ("Captioned", "Karaoke", "Titled")
16
17
  # One overlay filter per stretch: past this many, the filter chain costs more than it saves.
17
18
  MAX_STRETCHES = 400
19
+ # Titled.tsx: a scene card lasts until the scene ends, at most this long.
20
+ SCENE_CARD_SECONDS = 2.5
18
21
 
22
+ Layout = List[Tuple[int, int, int]] # (packed_first_frame, length_frames, source_first_frame)
19
23
 
20
- def caption_stretches(timeline: Dict[str, Any], merge_gap: float) -> List[Tuple[int, int]]:
21
- """[(first_frame, end_frame)] of the frames that show a caption, cues closer than merge_gap merged."""
24
+
25
+ def _scene_card(sc: Dict[str, Any], fps: float) -> Tuple[int, int]:
26
+ """[from, end) frames of a scene card, as Titled.tsx computes them."""
27
+ s = sec_to_frames(sc["start"], fps)
28
+ return s, s + max(1, min(sec_to_frames(sc["end"], fps), s + sec_to_frames(SCENE_CARD_SECONDS, fps)) - s)
29
+
30
+
31
+ def drawn_intervals(comp: str, timeline: Dict[str, Any], options: Optional[Dict[str, Any]] = None) -> List[Tuple[int, int]]:
32
+ """[from, end) frames in which the composition draws anything (its Sequences)."""
22
33
  fps = float(timeline["source"]["fps"])
23
- total = sec_to_frames(float(timeline["source"]["duration"]), fps)
24
- gap = sec_to_frames(merge_gap, fps)
25
- cues = sorted((sec_to_frames(c["start"], fps), sec_to_frames(c["end"], fps)) for c in timeline.get("captions") or [])
34
+ o = options or {}
35
+ out: List[Tuple[int, int]] = []
36
+ if comp in ("Captioned", "Karaoke"):
37
+ for c in timeline.get("captions") or []:
38
+ s = sec_to_frames(c["start"], fps)
39
+ out.append((s, s + max(1, sec_to_frames(c["end"], fps) - s)))
40
+ elif comp == "Titled":
41
+ titles = o.get("sceneTitles") or []
42
+ for i, sc in enumerate(timeline.get("scenes") or []):
43
+ if i < len(titles) and titles[i]:
44
+ out.append(_scene_card(sc, fps))
45
+ for lt in o.get("lowerThirds") or []:
46
+ s = sec_to_frames(lt["start"], fps)
47
+ out.append((s, s + max(1, sec_to_frames(lt["end"], fps) - s)))
48
+ return out
49
+
50
+
51
+ def stretches(intervals: List[Tuple[int, int]], total: int, merge_gap_frames: int) -> List[Tuple[int, int]]:
52
+ """Sorted, merged [from, end) stretches inside [0, total); intervals closer than the gap merge."""
26
53
  out: List[List[int]] = []
27
- for s, e in cues:
28
- # the same rule as the compositions: a cue lasts at least one frame, inside the source
54
+ for s, e in sorted(intervals):
29
55
  s = max(0, min(s, total - 1))
30
56
  e = min(total, max(e, s + 1))
31
- if out and s <= out[-1][1] + gap:
57
+ if out and s <= out[-1][1] + merge_gap_frames:
32
58
  out[-1][1] = max(out[-1][1], e)
33
59
  else:
34
60
  out.append([s, e])
35
61
  return [(s, e) for s, e in out]
36
62
 
37
63
 
38
- def pack(timeline: Dict[str, Any], stretches: List[Tuple[int, int]]) -> Tuple[Dict[str, Any], List[Tuple[int, int, int]]]:
39
- """A timeline with the stretches back to back (one blank frame between them) and, per stretch,
40
- (packed_first_frame, length_frames, source_first_frame)."""
64
+ def plan_stretches(comp: str, timeline: Dict[str, Any], options: Optional[Dict[str, Any]], merge_gap: float) -> List[Tuple[int, int]]:
65
+ fps = float(timeline["source"]["fps"])
66
+ total = sec_to_frames(float(timeline["source"]["duration"]), fps)
67
+ return stretches(drawn_intervals(comp, timeline, options), total, sec_to_frames(merge_gap, fps))
68
+
69
+
70
+ def caption_stretches(timeline: Dict[str, Any], merge_gap: float) -> List[Tuple[int, int]]:
71
+ return plan_stretches("Captioned", timeline, None, merge_gap)
72
+
73
+
74
+ def pack(timeline: Dict[str, Any], spans: List[Tuple[int, int]],
75
+ options: Optional[Dict[str, Any]] = None) -> Tuple[Dict[str, Any], Dict[str, Any], Layout]:
76
+ """The timeline and options with the stretches back to back (one blank frame between them), and
77
+ the layout that puts each stretch back."""
41
78
  fps = float(timeline["source"]["fps"])
42
- layout: List[Tuple[int, int, int]] = []
79
+ layout: Layout = []
43
80
  p = 0
44
- for s, e in stretches:
81
+ for s, e in spans:
45
82
  layout.append((p, e - s, s))
46
83
  p += (e - s) + 1
47
- packed_frames = max(1, p - 1)
48
84
 
49
85
  def offset(t: float) -> Optional[int]:
50
86
  """Whole frames to move a time by: its stretch's source start minus its packed start. Only
@@ -55,24 +91,43 @@ def pack(timeline: Dict[str, Any], stretches: List[Tuple[int, int]]) -> Tuple[Di
55
91
  return s - pp
56
92
  return None
57
93
 
58
- out = copy.deepcopy(timeline)
59
- out["source"]["duration"] = packed_frames / fps
60
- for key in ("captions", "words"):
61
- moved = []
62
- for c in timeline.get(key) or []:
63
- # a word belongs where Karaoke puts it: by its midpoint
64
- k = offset(c["start"] if key == "captions" else (c["start"] + c["end"]) / 2)
94
+ def moved(items: List[Dict[str, Any]], anchor) -> List[Dict[str, Any]]:
95
+ out = []
96
+ for c in items:
97
+ k = offset(anchor(c))
98
+ if k is not None:
99
+ out.append({**c, "start": c["start"] - k / fps, "end": c["end"] - k / fps})
100
+ return out
101
+
102
+ tl = copy.deepcopy(timeline)
103
+ tl["source"]["duration"] = packed_frames(layout) / fps
104
+ tl["captions"] = moved(timeline.get("captions") or [], lambda c: c["start"])
105
+ # a word belongs where Karaoke puts it: by its midpoint
106
+ tl["words"] = moved(timeline.get("words") or [], lambda w: (w["start"] + w["end"]) / 2)
107
+ opts = copy.deepcopy(options or {})
108
+ if opts.get("lowerThirds"):
109
+ opts["lowerThirds"] = moved(opts["lowerThirds"], lambda lt: lt["start"])
110
+ # Scene cards are matched to sceneTitles by index, so every scene keeps its place in the list:
111
+ # a titled one moves with its stretch and keeps its card length; the rest draw nothing anyway.
112
+ titles = opts.get("sceneTitles") or []
113
+ scenes = []
114
+ for i, sc in enumerate(timeline.get("scenes") or []):
115
+ if i < len(titles) and titles[i]:
116
+ s, e = _scene_card(sc, fps)
117
+ k = offset(sc["start"])
65
118
  if k is not None:
66
- moved.append({**c, "start": c["start"] - k / fps, "end": c["end"] - k / fps})
67
- out[key] = moved
68
- # Captioned and Karaoke draw nothing else; measurements on the source clock would only mislead.
69
- for k in ("scenes", "silences", "speech", "peaks", "highlights", "clips"):
70
- out[k] = []
71
- out["beats"] = None
72
- return out, layout
119
+ scenes.append({"start": (s - k) / fps, "end": (e - k) / fps})
120
+ continue
121
+ scenes.append({"start": 0.0, "end": 1.0 / fps})
122
+ tl["scenes"] = scenes if any(titles) else []
123
+ # nothing else is drawn; measurements on the source clock would only mislead
124
+ for key in ("silences", "speech", "peaks", "highlights", "clips"):
125
+ tl[key] = []
126
+ tl["beats"] = None
127
+ return tl, opts, layout
73
128
 
74
129
 
75
- def place_args(layout: List[Tuple[int, int, int]], fps: float) -> List[str]:
130
+ def place_args(layout: Layout, fps: float) -> List[str]:
76
131
  """overlay.py --place arguments. Range edges sit half a frame inside the stretch, so the blank
77
132
  frame between stretches is never picked up whatever the float rounding of a timestamp."""
78
133
  args: List[str] = []
@@ -83,5 +138,5 @@ def place_args(layout: List[Tuple[int, int, int]], fps: float) -> List[str]:
83
138
  return args
84
139
 
85
140
 
86
- def packed_frames(layout: List[Tuple[int, int, int]]) -> int:
141
+ def packed_frames(layout: Layout) -> int:
87
142
  return max(1, sum(n for _, n, _ in layout) + len(layout) - 1)
package/scripts/render.py CHANGED
@@ -45,12 +45,13 @@ def build_parser() -> argparse.ArgumentParser:
45
45
  "with --keep-graphics the layer is kept for an editing app (Premiere, Resolve, Final Cut)")
46
46
  p.add_argument("--keep-graphics", action="store_true", help="with --overlay: keep the transparent graphics .mov")
47
47
  p.add_argument("--sparse", action="store_true",
48
- help="overlay mode that draws only the frames where captions show (Captioned / Karaoke) and "
48
+ help="overlay mode that draws only the frames where something shows (Captioned / Karaoke / "
49
+ "Titled) and "
49
50
  "places each stretch at its time with ffmpeg-skill overlay.py --place: much faster on long "
50
51
  "footage with gaps between captions. Falls back to the full-length layer (and says why) "
51
52
  "when this ffmpeg-skill has no --place or the source does not start at 0")
52
53
  p.add_argument("--merge-gap", type=float, default=2.0,
53
- help="with --sparse: captions closer than this many seconds are drawn as one stretch (default 2)")
54
+ help="with --sparse: graphics closer than this many seconds are drawn as one stretch (default 2)")
54
55
  add_frame_args(p)
55
56
  add_common(p)
56
57
  return p
@@ -144,34 +145,34 @@ def ffskill_can_place() -> bool:
144
145
  return "--place" in (proc.stdout or "")
145
146
 
146
147
 
147
- def sparse_plan(timeline: Dict[str, Any], a: argparse.Namespace) -> Dict[str, Any]:
148
+ def sparse_plan(timeline: Dict[str, Any], options: Dict[str, Any], a: argparse.Namespace) -> Dict[str, Any]:
148
149
  """What --sparse will draw, or why it falls back to the full-length layer."""
149
150
  src = timeline["source"]
150
151
  fps = float(src["fps"])
151
152
  total = expected_frames(a.comp, timeline) or 1
152
153
  plan: Dict[str, Any] = {"used": False, "reason": None, "stretches": 0, "drawn_frames": total,
153
- "source_frames": total, "timeline": None, "place": []}
154
- stretches = _sparse.caption_stretches(timeline, a.merge_gap)
154
+ "source_frames": total, "timeline": None, "options": None, "place": []}
155
+ stretches = _sparse.plan_stretches(a.comp, timeline, options, a.merge_gap)
155
156
  start = None
156
157
  if stretches and src.get("path") and not STATE.dry_run:
157
158
  # the source as it is now (older timelines do not record where its first picture sits)
158
159
  start = (ffskill("probe", [str(src["path"])], allow_fail=True).get("video") or {}).get("start_time")
159
160
  if not stretches:
160
- plan["reason"] = "no captions to draw"
161
+ plan["reason"] = "nothing to draw (no captions, lower thirds or scene titles)"
161
162
  elif len(stretches) > _sparse.MAX_STRETCHES:
162
- plan["reason"] = (f"{len(stretches)} caption stretches (over {_sparse.MAX_STRETCHES}); raise --merge-gap")
163
+ plan["reason"] = (f"{len(stretches)} stretches (over {_sparse.MAX_STRETCHES}); raise --merge-gap")
163
164
  elif isinstance(start, (int, float)) and abs(start) > 0.5 / fps:
164
165
  plan["reason"] = (f"the source's first picture is at {start:.3f} s, not 0: placed stretches would be "
165
166
  "shifted by that much")
166
167
  elif not ffskill_can_place():
167
168
  plan["reason"] = "this ffmpeg-skill's overlay.py has no --place yet (update ffmpeg-skill)"
168
169
  else:
169
- packed, layout = _sparse.pack(timeline, stretches)
170
+ packed, packed_options, layout = _sparse.pack(timeline, stretches, options)
170
171
  drawn = _sparse.packed_frames(layout)
171
172
  if drawn >= total:
172
- plan["reason"] = "captions cover the whole source: nothing to skip"
173
+ plan["reason"] = "the graphics cover the whole source: nothing to skip"
173
174
  else:
174
- plan.update(used=True, stretches=len(layout), drawn_frames=drawn, timeline=packed,
175
+ plan.update(used=True, stretches=len(layout), drawn_frames=drawn, timeline=packed, options=packed_options,
175
176
  place=_sparse.place_args(layout, fps))
176
177
  if plan["reason"]:
177
178
  info(f"--sparse: drawing the full length instead ({plan['reason']})")
@@ -203,7 +204,7 @@ def main() -> None:
203
204
 
204
205
  if a.sparse:
205
206
  if a.comp not in _sparse.SPARSE_COMPOSITIONS:
206
- die(f"--sparse draws caption stretches only: {a.comp} is not one of "
207
+ die(f"--sparse draws only the stretches where graphics show: {a.comp} is not one of "
207
208
  f"{', '.join(_sparse.SPARSE_COMPOSITIONS)} (use --overlay for the full-length layer)", "input")
208
209
  if a.merge_gap < 0:
209
210
  die("--merge-gap cannot be negative", "input")
@@ -219,9 +220,10 @@ def main() -> None:
219
220
  if not timeline["source"].get("has_video"):
220
221
  die("--overlay needs a video source to composite onto", "input")
221
222
 
222
- sparse = sparse_plan(timeline, a) if a.sparse else None
223
- drawn = sparse["timeline"] if sparse and sparse["used"] else timeline
224
- props_path, frame, font_note = prepare_props(project, a.comp, drawn, options, a)
223
+ sparse = sparse_plan(timeline, options, a) if a.sparse else None
224
+ used = bool(sparse and sparse["used"])
225
+ props_path, frame, font_note = prepare_props(project, a.comp, sparse["timeline"] if used else timeline,
226
+ sparse["options"] if used else options, a)
225
227
  if font_note:
226
228
  info(font_note)
227
229
  graphics = output.with_name(output.stem + ".graphics.mov") if a.overlay else output