@auscera/cleoedits 0.0.0-stage → 0.1.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.
Files changed (230) hide show
  1. package/README.md +62 -2
  2. package/cli.mjs +149 -0
  3. package/lib/dependencies.mjs +384 -0
  4. package/lib/run.mjs +114 -0
  5. package/lib/workspace.mjs +167 -0
  6. package/package.json +240 -3
  7. package/workspace/.agents/skills/cleoedits/SKILL.md +29 -0
  8. package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/audiogram.json +41 -0
  9. package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/facebook.json +48 -0
  10. package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/linkedin.json +48 -0
  11. package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/podcast.json +23 -0
  12. package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/reels.json +48 -0
  13. package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/shorts.json +48 -0
  14. package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/tiktok.json +48 -0
  15. package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/x.json +48 -0
  16. package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/youtube-shorts.json +48 -0
  17. package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/youtube.json +48 -0
  18. package/workspace/.agents/skills/cleoedits/assets/reel_effects/assets/LICENSE-SimpleIcons +30 -0
  19. package/workspace/.agents/skills/cleoedits/assets/reel_effects/assets/logos.json +1 -0
  20. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/Anton-Regular.ttf +0 -0
  21. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/ArchivoBlack-Regular.ttf +0 -0
  22. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/InstrumentSerif-Italic.ttf +0 -0
  23. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/Inter.ttf +0 -0
  24. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/LICENSE-PermanentMarker.txt +202 -0
  25. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/Montserrat.ttf +0 -0
  26. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-Anton.txt +93 -0
  27. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-ArchivoBlack.txt +93 -0
  28. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-InstrumentSerif.txt +93 -0
  29. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-Inter.txt +93 -0
  30. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-Montserrat.txt +93 -0
  31. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-PlayfairDisplay.txt +93 -0
  32. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-Poppins.txt +93 -0
  33. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-SpaceMono.txt +93 -0
  34. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/PermanentMarker-Regular.ttf +0 -0
  35. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/PlayfairDisplay-Italic.ttf +0 -0
  36. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/PlayfairDisplay.ttf +0 -0
  37. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/Poppins-Black.ttf +0 -0
  38. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/Poppins-Bold.ttf +0 -0
  39. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/Poppins-ExtraBold.ttf +0 -0
  40. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/SpaceMono-Bold.ttf +0 -0
  41. package/workspace/.agents/skills/cleoedits/assets/reel_effects/models/LICENSE-MediaPipe +218 -0
  42. package/workspace/.agents/skills/cleoedits/assets/reel_effects/models/LICENSE-YuNet +21 -0
  43. package/workspace/.agents/skills/cleoedits/assets/reel_effects/models/NOTICE.md +4 -0
  44. package/workspace/.agents/skills/cleoedits/assets/reel_effects/models/selfie_segmenter.tflite +0 -0
  45. package/workspace/.agents/skills/cleoedits/assets/reel_effects/models/yunet.onnx +0 -0
  46. package/workspace/.agents/skills/cleoedits/assets/video_styles/LICENSE +21 -0
  47. package/workspace/.agents/skills/cleoedits/assets/video_styles/audio-app-ui/STYLE.md +65 -0
  48. package/workspace/.agents/skills/cleoedits/assets/video_styles/blueprint/STYLE.md +53 -0
  49. package/workspace/.agents/skills/cleoedits/assets/video_styles/blueprint/index.html +328 -0
  50. package/workspace/.agents/skills/cleoedits/assets/video_styles/blueprint/studio.js +57 -0
  51. package/workspace/.agents/skills/cleoedits/assets/video_styles/data-story/STYLE.md +65 -0
  52. package/workspace/.agents/skills/cleoedits/assets/video_styles/data-story/index.html +575 -0
  53. package/workspace/.agents/skills/cleoedits/assets/video_styles/design-app-ui/STYLE.md +68 -0
  54. package/workspace/.agents/skills/cleoedits/assets/video_styles/editor-ui/STYLE.md +73 -0
  55. package/workspace/.agents/skills/cleoedits/assets/video_styles/editorial-paper/STYLE.md +54 -0
  56. package/workspace/.agents/skills/cleoedits/assets/video_styles/editorial-paper/index.html +189 -0
  57. package/workspace/.agents/skills/cleoedits/assets/video_styles/editorial-paper/studio.js +57 -0
  58. package/workspace/.agents/skills/cleoedits/assets/video_styles/explainer-diagram/STYLE.md +64 -0
  59. package/workspace/.agents/skills/cleoedits/assets/video_styles/explainer-diagram/index.html +620 -0
  60. package/workspace/.agents/skills/cleoedits/assets/video_styles/graphite-ui/STYLE.md +55 -0
  61. package/workspace/.agents/skills/cleoedits/assets/video_styles/graphite-ui/index.html +238 -0
  62. package/workspace/.agents/skills/cleoedits/assets/video_styles/graphite-ui/studio.js +57 -0
  63. package/workspace/.agents/skills/cleoedits/assets/video_styles/growing-city/STYLE.md +66 -0
  64. package/workspace/.agents/skills/cleoedits/assets/video_styles/growing-city/index.html +602 -0
  65. package/workspace/.agents/skills/cleoedits/assets/video_styles/ink-line/STYLE.md +66 -0
  66. package/workspace/.agents/skills/cleoedits/assets/video_styles/ink-line/index.html +777 -0
  67. package/workspace/.agents/skills/cleoedits/assets/video_styles/midnight-grid/STYLE.md +56 -0
  68. package/workspace/.agents/skills/cleoedits/assets/video_styles/midnight-grid/index.html +186 -0
  69. package/workspace/.agents/skills/cleoedits/assets/video_styles/midnight-grid/studio.js +57 -0
  70. package/workspace/.agents/skills/cleoedits/assets/video_styles/motion-app-ui/STYLE.md +68 -0
  71. package/workspace/.agents/skills/cleoedits/assets/video_styles/paper-cut/STYLE.md +56 -0
  72. package/workspace/.agents/skills/cleoedits/assets/video_styles/paper-cut/index.html +244 -0
  73. package/workspace/.agents/skills/cleoedits/assets/video_styles/paper-cut/studio.js +57 -0
  74. package/workspace/.agents/skills/cleoedits/assets/video_styles/paper-world/STYLE.md +67 -0
  75. package/workspace/.agents/skills/cleoedits/assets/video_styles/paper-world/index.html +663 -0
  76. package/workspace/.agents/skills/cleoedits/assets/video_styles/particle-field/STYLE.md +59 -0
  77. package/workspace/.agents/skills/cleoedits/assets/video_styles/particle-field/index.html +395 -0
  78. package/workspace/.agents/skills/cleoedits/assets/video_styles/poster-pop/STYLE.md +52 -0
  79. package/workspace/.agents/skills/cleoedits/assets/video_styles/poster-pop/index.html +194 -0
  80. package/workspace/.agents/skills/cleoedits/assets/video_styles/poster-pop/studio.js +57 -0
  81. package/workspace/.agents/skills/cleoedits/assets/video_styles/risograph/STYLE.md +58 -0
  82. package/workspace/.agents/skills/cleoedits/assets/video_styles/risograph/index.html +242 -0
  83. package/workspace/.agents/skills/cleoedits/assets/video_styles/risograph/studio.js +57 -0
  84. package/workspace/.agents/skills/cleoedits/assets/video_styles/swiss-grid/STYLE.md +53 -0
  85. package/workspace/.agents/skills/cleoedits/assets/video_styles/swiss-grid/index.html +138 -0
  86. package/workspace/.agents/skills/cleoedits/assets/video_styles/swiss-grid/studio.js +57 -0
  87. package/workspace/.agents/skills/cleoedits/assets/video_styles/swiss-kinetic/STYLE.md +63 -0
  88. package/workspace/.agents/skills/cleoedits/assets/video_styles/swiss-kinetic/index.html +599 -0
  89. package/workspace/.agents/skills/cleoedits/assets/video_styles/time-travel/STYLE.md +65 -0
  90. package/workspace/.agents/skills/cleoedits/assets/video_styles/time-travel/index.html +1297 -0
  91. package/workspace/.agents/skills/cleoedits/assets/video_styles/weather-widget/STYLE.md +69 -0
  92. package/workspace/.agents/skills/cleoedits/assets/video_styles/weather-widget/index.html +674 -0
  93. package/workspace/.agents/skills/cleoedits/references/audio-clearervoice-elevenlabs.md +11 -0
  94. package/workspace/.agents/skills/cleoedits/references/ffmpeg-and-reels.md +15 -0
  95. package/workspace/.agents/skills/cleoedits/references/hyperframes-workflows.md +13 -0
  96. package/workspace/.agents/skills/cleoedits/references/kdenlive-cli-and-mcp.md +12 -0
  97. package/workspace/.agents/skills/cleoedits/references/motion-design-pipeline.md +7 -0
  98. package/workspace/.agents/skills/cleoedits/references/motion-taste-emil.md +5 -0
  99. package/workspace/.agents/skills/cleoedits/references/playwright-demo-capture.md +9 -0
  100. package/workspace/.agents/skills/cleoedits/references/remotion-workflows.md +13 -0
  101. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/LICENSE +21 -0
  102. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_ass_overlay.py +399 -0
  103. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/__init__.py +235 -0
  104. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/alpha.py +560 -0
  105. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/asr.py +1237 -0
  106. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/color.py +540 -0
  107. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/decision.py +2452 -0
  108. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/drawtext.py +290 -0
  109. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/emit.py +1309 -0
  110. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/emoji.py +518 -0
  111. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/fonts.py +875 -0
  112. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/pacing.py +263 -0
  113. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/pacing_edit.py +432 -0
  114. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/probe.py +1613 -0
  115. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/runner.py +3994 -0
  116. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/text.py +73 -0
  117. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/timeline.py +721 -0
  118. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/wrap.py +981 -0
  119. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_contract.py +2454 -0
  120. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_platforms.py +258 -0
  121. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_review.html +754 -0
  122. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_review.py +258 -0
  123. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_smartcut.py +450 -0
  124. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/audio.py +867 -0
  125. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/background.py +136 -0
  126. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/batch.py +1409 -0
  127. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/broll.py +282 -0
  128. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/caption.py +2207 -0
  129. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/check.py +815 -0
  130. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/color.py +695 -0
  131. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/crop.py +91 -0
  132. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/cropdetect.py +214 -0
  133. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/cut.py +2076 -0
  134. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/deinterlace.py +90 -0
  135. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/denoise.py +94 -0
  136. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/export.py +1033 -0
  137. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/fit.py +729 -0
  138. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/freeze.py +197 -0
  139. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/graphics.py +920 -0
  140. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/grid.py +235 -0
  141. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/insert.py +142 -0
  142. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/join.py +1083 -0
  143. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/look.py +475 -0
  144. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/loop.py +395 -0
  145. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/loudness.py +397 -0
  146. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/metadata.py +416 -0
  147. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/multicam.py +414 -0
  148. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/overlay.py +766 -0
  149. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/pad.py +121 -0
  150. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/probe.py +145 -0
  151. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/proxy.py +93 -0
  152. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/redact.py +162 -0
  153. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/render.py +2424 -0
  154. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/report.py +354 -0
  155. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/reverse.py +114 -0
  156. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/scenes.py +439 -0
  157. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/sequence.py +285 -0
  158. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/silence.py +945 -0
  159. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/speedramp.py +193 -0
  160. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/sphere.py +137 -0
  161. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/stabilize.py +141 -0
  162. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/straighten.py +120 -0
  163. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/sync.py +500 -0
  164. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/verify.py +411 -0
  165. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/waveform.py +502 -0
  166. package/workspace/.agents/skills/cleoedits/scripts/kdenlive_builder.py +284 -0
  167. package/workspace/.agents/skills/cleoedits/scripts/motion/LICENSE-claude-motion +21 -0
  168. package/workspace/.agents/skills/cleoedits/scripts/motion/LICENSE-motion-design +21 -0
  169. package/workspace/.agents/skills/cleoedits/scripts/motion/_media.py +43 -0
  170. package/workspace/.agents/skills/cleoedits/scripts/motion/pacing_check.py +90 -0
  171. package/workspace/.agents/skills/cleoedits/scripts/motion/storyboard.py +77 -0
  172. package/workspace/.agents/skills/cleoedits/scripts/reel_effects/LICENSE +26 -0
  173. package/workspace/.agents/skills/cleoedits/scripts/reel_effects/fx.py +2717 -0
  174. package/workspace/.agents/skills/cleoedits/scripts/reel_effects/logos.py +194 -0
  175. package/workspace/.agents/skills/cleoedits/scripts/reel_effects/sfx.py +105 -0
  176. package/workspace/.agents/skills/cleoedits/scripts/reel_effects/trim.py +99 -0
  177. package/workspace/.agents/skills/cleoedits/scripts/reel_effects/words.py +60 -0
  178. package/workspace/.claude/commands/blender-3d.md +12 -0
  179. package/workspace/.claude/commands/business-short-form-reels.md +12 -0
  180. package/workspace/.claude/commands/color-grade.md +12 -0
  181. package/workspace/.claude/commands/cutout-grid-reel.md +12 -0
  182. package/workspace/.claude/commands/depth-ui-reel.md +12 -0
  183. package/workspace/.claude/commands/explainer-panel-reel.md +12 -0
  184. package/workspace/.claude/commands/freeze-frame.md +12 -0
  185. package/workspace/.claude/commands/glass-graph.md +12 -0
  186. package/workspace/.claude/commands/over-the-shoulder.md +12 -0
  187. package/workspace/.claude/commands/personal-short-form-reels.md +12 -0
  188. package/workspace/.claude/commands/ranking-format.md +12 -0
  189. package/workspace/.claude/commands/relight.md +12 -0
  190. package/workspace/.claude/commands/reverse-engineer.md +12 -0
  191. package/workspace/.claude/commands/text-behind.md +12 -0
  192. package/workspace/.claude/commands/tier-list.md +12 -0
  193. package/workspace/.claude-plugin/plugin.json +8 -0
  194. package/workspace/.npmignore +15 -0
  195. package/workspace/AGENTS.md +30 -0
  196. package/workspace/README.md +63 -0
  197. package/workspace/assets/fonts/TikTokSans-OFL.txt +93 -0
  198. package/workspace/assets/fonts/TikTokSans-Variable.ttf +0 -0
  199. package/workspace/assets/luts/clean_warm.cube +4917 -0
  200. package/workspace/assets/luts/golden_hour.cube +4917 -0
  201. package/workspace/assets/luts/moody_dark.cube +4917 -0
  202. package/workspace/assets/luts/teal_orange.cube +4917 -0
  203. package/workspace/assets/sfx/NOTICE.txt +1 -0
  204. package/workspace/assets/sfx/click.wav +0 -0
  205. package/workspace/assets/sfx/pop.wav +0 -0
  206. package/workspace/assets/sfx/riser.wav +0 -0
  207. package/workspace/assets/sfx/whoosh.wav +0 -0
  208. package/workspace/generators/hyperframes/index.html +39 -0
  209. package/workspace/generators/hyperframes/package.json +15 -0
  210. package/workspace/generators/hyperframes/pnpm-lock.yaml +1181 -0
  211. package/workspace/generators/hyperframes/pnpm-workspace.yaml +10 -0
  212. package/workspace/generators/remotion/eslint.config.mjs +3 -0
  213. package/workspace/generators/remotion/package.json +36 -0
  214. package/workspace/generators/remotion/pnpm-lock.yaml +4179 -0
  215. package/workspace/generators/remotion/pnpm-workspace.yaml +10 -0
  216. package/workspace/generators/remotion/remotion.config.ts +13 -0
  217. package/workspace/generators/remotion/src/Root.tsx +52 -0
  218. package/workspace/generators/remotion/src/index.css +1 -0
  219. package/workspace/generators/remotion/src/index.ts +4 -0
  220. package/workspace/generators/remotion/tsconfig.json +15 -0
  221. package/workspace/pipeline/scripts/_codec.py +28 -0
  222. package/workspace/pipeline/scripts/ai_media_api.py +109 -0
  223. package/workspace/pipeline/scripts/blender_render.py +166 -0
  224. package/workspace/pipeline/scripts/composite.py +49 -0
  225. package/workspace/pipeline/scripts/melt.sh +68 -0
  226. package/workspace/pipeline/scripts/normalize_audio.py +39 -0
  227. package/workspace/pipeline/scripts/person_matte.py +216 -0
  228. package/workspace/pipeline/scripts/record_demo.py +69 -0
  229. package/workspace/pipeline/scripts/whisper_cut.py +98 -0
  230. package/workspace-manifest.json +908 -0
@@ -0,0 +1,284 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ kdenlive_builder.py — write an editable Kdenlive (24.02+ / 26.x) project.
4
+
5
+ Layout (bottom → top), the way Kdenlive shows it:
6
+ A1 music / voice (--music)
7
+ V1 main footage / A-roll (--aroll)
8
+ V2 transparent overlay (--overlay, e.g. a HyperFrames/Remotion .mov with alpha)
9
+
10
+ Media is referenced by ABSOLUTE path (Kdenlive never copies it), so keep the files where they are.
11
+
12
+ Examples
13
+ # Vertical reel (Instagram/TikTok/Shorts)
14
+ kdenlive_builder.py --aroll bg.mov --overlay caption.mov --music song.mp3 \
15
+ --width 1080 --height 1920 --out pipeline/work/job/job.kdenlive
16
+
17
+ # Landscape (default 1920x1080, 30 fps) — same flags as the original script
18
+ kdenlive_builder.py --aroll a_roll.mp4 --out edit.kdenlive
19
+
20
+ # Several V1 clips back to back: repeat --aroll, optionally with a frame range PATH@IN-OUT
21
+ # (inclusive, timeline-fps frames). The same file can be used twice (e.g. camera / insert / camera);
22
+ # Kdenlive keeps the unused footage as handles, so the creator can drag each cut point.
23
+ kdenlive_builder.py --aroll cam.mov@0-143 --aroll screen.mov --aroll cam.mov@195-293 ...
24
+ """
25
+
26
+ import argparse
27
+ import json
28
+ import os
29
+ import subprocess
30
+ import uuid
31
+
32
+ from lxml import etree
33
+
34
+ KDENLIVE_VERSION = "26.08.3"
35
+ MLT_VERSION = "7.43.0"
36
+
37
+
38
+ def probe(path: str) -> dict:
39
+ res = subprocess.run(
40
+ ["ffprobe", "-v", "quiet", "-print_format", "json", "-show_format", "-show_streams", path],
41
+ capture_output=True, text=True, check=True,
42
+ )
43
+ return json.loads(res.stdout)
44
+
45
+
46
+ def frames_for(path: str, fps: float) -> int:
47
+ dur = float(probe(path).get("format", {}).get("duration", 10.0))
48
+ return max(1, int(round(dur * fps)))
49
+
50
+
51
+ def clip_type(path: str) -> int:
52
+ """Kdenlive clip types: 0 = audio+video, 1 = audio only, 2 = video only."""
53
+ kinds = {s.get("codec_type") for s in probe(path).get("streams", [])}
54
+ if "video" in kinds and "audio" in kinds:
55
+ return 0
56
+ return 1 if "audio" in kinds else 2
57
+
58
+
59
+ def new_uuid() -> str:
60
+ return "{" + str(uuid.uuid4()) + "}"
61
+
62
+
63
+ def prop(parent, name: str, value) -> None:
64
+ etree.SubElement(parent, "property", name=name).text = str(value)
65
+
66
+
67
+ def parse_segment(spec: str):
68
+ """'path' or 'path@IN-OUT' (inclusive frame range) -> (abs_path, in or None, out or None)."""
69
+ if "@" in spec:
70
+ path, rng = spec.rsplit("@", 1)
71
+ a, b = rng.split("-")
72
+ return os.path.abspath(path), int(a), int(b)
73
+ return os.path.abspath(spec), None, None
74
+
75
+
76
+ def build(aroll, overlay, music, out_path, fps=30.0, width=1920, height=1080) -> None:
77
+ out_abs = os.path.abspath(out_path)
78
+ os.makedirs(os.path.dirname(out_abs), exist_ok=True)
79
+ fps_num = int(round(fps))
80
+ if isinstance(aroll, str):
81
+ aroll = [aroll]
82
+ segments = [parse_segment(s) for s in aroll]
83
+
84
+ # One bin clip per distinct file: (key, abs_path, kind, frames, kdenlive_id)
85
+ clips = []
86
+ next_id = 2
87
+ sources = [(f"aroll{i}", p) for i, p in enumerate(dict.fromkeys(s[0] for s in segments))]
88
+ sources += [("overlay", overlay and os.path.abspath(overlay)), ("music", music and os.path.abspath(music))]
89
+ for key, p in sources:
90
+ if p:
91
+ clips.append((key, p, clip_type(p), frames_for(p, fps), next_id))
92
+ next_id += 1
93
+ seq_kid = next_id
94
+ clip_by_path = {c[1]: c for c in clips if c[0].startswith("aroll")}
95
+
96
+ # V1 entries back to back: (clip, in, out)
97
+ v1 = []
98
+ for path, a, b in segments:
99
+ c = clip_by_path[path]
100
+ a = 0 if a is None else a
101
+ b = c[3] - 1 if b is None else min(b, c[3] - 1)
102
+ if not 0 <= a <= b:
103
+ raise SystemExit(f"bad frame range {a}-{b} for {path} ({c[3]} frames)")
104
+ v1.append((c, a, b))
105
+
106
+ # Timeline length = the footage (V1). Overlays/music are trimmed to it, so a 1-frame-longer
107
+ # overlay render or MP3 padding can never make the export longer than the edit.
108
+ total = sum(b - a + 1 for _, a, b in v1)
109
+ out_f = total - 1
110
+
111
+ mlt = etree.Element("mlt", LC_NUMERIC="C", producer="main_bin", version=MLT_VERSION,
112
+ root=os.path.dirname(out_abs))
113
+ gcd = __import__("math").gcd(width, height)
114
+ etree.SubElement(
115
+ mlt, "profile",
116
+ description=f"{width}x{height} {fps_num} fps", width=str(width), height=str(height),
117
+ progressive="1", sample_aspect_num="1", sample_aspect_den="1",
118
+ display_aspect_num=str(width // gcd), display_aspect_den=str(height // gcd),
119
+ frame_rate_num=str(fps_num), frame_rate_den="1", colorspace="709",
120
+ )
121
+
122
+ def media_producer(pid, c, timeline_audio_only=False):
123
+ key, path, ctype, frames, kid = c
124
+ el = etree.SubElement(mlt, "chain", id=pid, out=str(frames - 1))
125
+ prop(el, "length", frames)
126
+ prop(el, "eof", "pause")
127
+ prop(el, "resource", path)
128
+ prop(el, "mlt_service", "avformat-novalidate")
129
+ prop(el, "seekable", 1)
130
+ prop(el, "kdenlive:clipname", os.path.basename(path))
131
+ prop(el, "kdenlive:id", kid)
132
+ prop(el, "kdenlive:clip_type", ctype)
133
+ prop(el, "kdenlive:folderid", -1)
134
+ if timeline_audio_only:
135
+ prop(el, "set.test_audio", 0)
136
+ prop(el, "set.test_image", 1)
137
+ return el
138
+
139
+ # Bin copies (what the Project Bin shows)
140
+ bin_ids = {}
141
+ for c in clips:
142
+ bin_ids[c[0]] = f"bin_{c[0]}"
143
+ media_producer(bin_ids[c[0]], c)
144
+
145
+ # Black background track (Kdenlive always has one)
146
+ black = etree.SubElement(mlt, "producer", id="black_track", out=str(out_f))
147
+ prop(black, "length", total)
148
+ prop(black, "eof", "continue")
149
+ prop(black, "resource", "black")
150
+ prop(black, "aspect_ratio", 1)
151
+ prop(black, "mlt_service", "color")
152
+ prop(black, "kdenlive:playlistid", "black_track")
153
+ prop(black, "mlt_image_format", "rgba")
154
+ prop(black, "set.test_audio", 0)
155
+
156
+ track_tractors = [] # (tractor_id, is_audio)
157
+
158
+ def add_track(idx, name, is_audio, clip, entries=None):
159
+ """entries: [(clip, in, out)] placed back to back; default = `clip` from frame 0, cut to the timeline."""
160
+ if entries is None:
161
+ entries = [(clip, 0, min(clip[3], total) - 1)] if clip is not None else []
162
+ # MLT XML resolves references in document order: define each clip BEFORE the playlist using it.
163
+ # One timeline chain per entry (what Kdenlive itself writes), all sharing the bin clip's kdenlive:id.
164
+ tl_ids = []
165
+ for n, (c, _, _) in enumerate(entries):
166
+ tl_id = f"tl_{c[0]}" if len(entries) == 1 else f"tl_{c[0]}_{n}"
167
+ media_producer(tl_id, c, timeline_audio_only=is_audio)
168
+ tl_ids.append(tl_id)
169
+ pl_a = etree.SubElement(mlt, "playlist", id=f"playlist{idx}a")
170
+ pl_b = etree.SubElement(mlt, "playlist", id=f"playlist{idx}b")
171
+ if is_audio:
172
+ prop(pl_a, "kdenlive:audio_track", 1)
173
+ prop(pl_b, "kdenlive:audio_track", 1)
174
+ for tl_id, (_, a, b) in zip(tl_ids, entries):
175
+ etree.SubElement(pl_a, "entry", producer=tl_id, **{"in": str(a), "out": str(b)})
176
+ clip = entries[0][0] if entries else None
177
+ tr = etree.SubElement(mlt, "tractor", id=f"track{idx}", out=str(out_f))
178
+ if is_audio:
179
+ prop(tr, "kdenlive:audio_track", 1)
180
+ prop(tr, "kdenlive:track_name", name)
181
+ prop(tr, "kdenlive:trackheight", 69)
182
+ prop(tr, "kdenlive:timeline_active", 1)
183
+ prop(tr, "kdenlive:collapsed", 0)
184
+ prop(tr, "kdenlive:thumbs_format", "")
185
+ prop(tr, "kdenlive:audio_rec", "")
186
+ hide = ({"hide": "video"} if is_audio
187
+ else {"hide": "audio"} if entries and all(e[0][2] == 2 for e in entries) else {})
188
+ etree.SubElement(tr, "track", producer=pl_a.get("id"), **hide)
189
+ etree.SubElement(tr, "track", producer=pl_b.get("id"), **hide)
190
+ track_tractors.append((tr.get("id"), is_audio))
191
+
192
+ by_key = {c[0]: c for c in clips}
193
+ idx = 1
194
+ # Audio tracks first (Kdenlive order), then video bottom→top
195
+ add_track(idx, "Music", True, by_key.get("music")); idx += 1
196
+ add_track(idx, "Footage", False, None, entries=v1); idx += 1
197
+ add_track(idx, "Overlay", False, by_key.get("overlay")); idx += 1
198
+
199
+ seq_uuid = new_uuid()
200
+ seq = etree.SubElement(mlt, "tractor", id=seq_uuid, out=str(out_f))
201
+ prop(seq, "kdenlive:uuid", seq_uuid)
202
+ prop(seq, "kdenlive:clipname", "Sequence 1")
203
+ prop(seq, "kdenlive:sequenceproperties.hasAudio", 1)
204
+ prop(seq, "kdenlive:sequenceproperties.hasVideo", 1)
205
+ prop(seq, "kdenlive:sequenceproperties.activeTrack", 2)
206
+ prop(seq, "kdenlive:sequenceproperties.tracksCount", len(track_tractors))
207
+ prop(seq, "kdenlive:sequenceproperties.zoom", 8)
208
+ prop(seq, "kdenlive:sequenceproperties.verticalzoom", 1)
209
+ prop(seq, "kdenlive:sequenceproperties.position", 0)
210
+ prop(seq, "kdenlive:sequenceproperties.scrollPos", 0)
211
+ prop(seq, "kdenlive:sequenceproperties.disablepreview", 0)
212
+ prop(seq, "kdenlive:sequenceproperties.documentuuid", seq_uuid)
213
+ prop(seq, "kdenlive:sequenceproperties.groups", "[]")
214
+ prop(seq, "kdenlive:sequenceproperties.guides", "[]")
215
+ prop(seq, "kdenlive:duration", f"{total}")
216
+ prop(seq, "kdenlive:maxduration", total)
217
+ prop(seq, "kdenlive:producer_type", 17)
218
+ prop(seq, "kdenlive:id", seq_kid)
219
+ prop(seq, "kdenlive:clip_type", 0)
220
+ prop(seq, "kdenlive:folderid", -1)
221
+ etree.SubElement(seq, "track", producer="black_track")
222
+ for tid, _ in track_tractors:
223
+ etree.SubElement(seq, "track", producer=tid)
224
+ # Internal compositing / mixing, exactly what Kdenlive adds itself
225
+ for i, (_, is_audio) in enumerate(track_tractors, start=1):
226
+ tr = etree.SubElement(seq, "transition", id=f"transition{i}")
227
+ prop(tr, "a_track", 0)
228
+ prop(tr, "b_track", i)
229
+ prop(tr, "internal_added", 237)
230
+ prop(tr, "always_active", 1)
231
+ if is_audio:
232
+ prop(tr, "mlt_service", "mix")
233
+ prop(tr, "kdenlive_id", "mix")
234
+ prop(tr, "sum", 1)
235
+ else:
236
+ prop(tr, "mlt_service", "qtblend")
237
+ prop(tr, "kdenlive_id", "qtblend")
238
+ prop(tr, "compositing", 0)
239
+ prop(tr, "distort", 0)
240
+ prop(tr, "rotate_center", 0)
241
+
242
+ main_bin = etree.SubElement(mlt, "playlist", id="main_bin")
243
+ prop(main_bin, "kdenlive:folder.-1.2", "")
244
+ prop(main_bin, "kdenlive:docproperties.version", "1.1")
245
+ prop(main_bin, "kdenlive:docproperties.kdenliveversion", KDENLIVE_VERSION)
246
+ prop(main_bin, "kdenlive:docproperties.uuid", new_uuid())
247
+ prop(main_bin, "kdenlive:docproperties.opensequences", seq_uuid)
248
+ prop(main_bin, "kdenlive:docproperties.activetimeline", seq_uuid)
249
+ prop(main_bin, "kdenlive:docproperties.audioChannels", 2)
250
+ prop(main_bin, "kdenlive:docproperties.enableproxy", 0)
251
+ prop(main_bin, "kdenlive:docproperties.seekOffset", 30000)
252
+ prop(main_bin, "kdenlive:docproperties.projectfolder", os.path.dirname(out_abs))
253
+ prop(main_bin, "kdenlive:docproperties.rendercategory", "")
254
+ prop(main_bin, "kdenlive:docproperties.renderurl",
255
+ os.path.join(os.path.dirname(out_abs), os.path.splitext(os.path.basename(out_abs))[0] + ".mp4"))
256
+ prop(main_bin, "xml_retain", 1)
257
+ etree.SubElement(main_bin, "entry", producer=seq_uuid, **{"in": "0", "out": str(out_f)})
258
+ for c in clips:
259
+ etree.SubElement(main_bin, "entry", producer=bin_ids[c[0]], **{"in": "0", "out": str(c[3] - 1)})
260
+
261
+ project = etree.SubElement(mlt, "tractor", id="tractor_project", out=str(out_f))
262
+ prop(project, "kdenlive:projectTractor", 1)
263
+ etree.SubElement(project, "track", producer=seq_uuid, **{"in": "0", "out": str(out_f)})
264
+
265
+ etree.ElementTree(mlt).write(out_abs, pretty_print=True, xml_declaration=True, encoding="UTF-8")
266
+ print(f"[OK] Kdenlive project written to: {out_abs}")
267
+
268
+
269
+ def main():
270
+ ap = argparse.ArgumentParser(description="Build an editable .kdenlive project (Kdenlive 24.02+)")
271
+ ap.add_argument("--aroll", required=True, action="append",
272
+ help="Main footage (V1). Repeat to place clips back to back; PATH@IN-OUT uses frames IN..OUT")
273
+ ap.add_argument("--overlay", default=None, help="Transparent overlay .mov/.webm (V2)")
274
+ ap.add_argument("--music", default=None, help="Music / voice track (A1), trimmed to the footage length")
275
+ ap.add_argument("--out", required=True, help="Output .kdenlive path")
276
+ ap.add_argument("--fps", type=float, default=30.0, help="Timeline fps (default 30)")
277
+ ap.add_argument("--width", type=int, default=1920, help="Canvas width (1080 for vertical reels)")
278
+ ap.add_argument("--height", type=int, default=1080, help="Canvas height (1920 for vertical reels)")
279
+ a = ap.parse_args()
280
+ build(a.aroll, a.overlay, a.music, a.out, a.fps, a.width, a.height)
281
+
282
+
283
+ if __name__ == "__main__":
284
+ main()
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 whaleyxbt
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Howseen AI (Raphaël Aubry)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,43 @@
1
+ """Small helpers shared by the checks. Standard library only, plus ffmpeg on the PATH."""
2
+ import json, subprocess
3
+
4
+
5
+ def probe(path):
6
+ out = subprocess.check_output(['ffprobe', '-v', 'error', '-select_streams', 'v:0', '-show_entries',
7
+ 'stream=width,height,r_frame_rate:format=duration', '-of', 'json', path])
8
+ info = json.loads(out)
9
+ s = info['streams'][0]
10
+ num, den = s.get('r_frame_rate', '30/1').split('/')
11
+ return {'w': s['width'], 'h': s['height'], 'dur': float(info.get('format', {}).get('duration', 0) or 0),
12
+ 'fps': float(num) / float(den or 1)}
13
+
14
+
15
+ def gray_frames(path, fps, width, start=None, frames=None):
16
+ """Yield (w, h, bytes) gray frames. Each byte is one pixel, 0 to 255."""
17
+ info = probe(path)
18
+ h = int(round(width * info['h'] / info['w'] / 2) * 2)
19
+ cmd = ['ffmpeg', '-v', 'error']
20
+ if start is not None:
21
+ cmd += ['-ss', str(start)]
22
+ cmd += ['-i', path]
23
+ vf = f'scale={width}:{h},format=gray' if fps is None else f'fps={fps},scale={width}:{h},format=gray'
24
+ cmd += ['-vf', vf]
25
+ if frames:
26
+ cmd += ['-frames:v', str(frames)]
27
+ cmd += ['-f', 'rawvideo', '-']
28
+ raw = subprocess.check_output(cmd)
29
+ n = width * h
30
+ return [raw[i:i + n] for i in range(0, len(raw) - n + 1, n)], width, h
31
+
32
+
33
+ def diff_stats(a, b, thr=14):
34
+ """Return (mean abs difference, share of pixels that moved more than thr levels)."""
35
+ total = 0
36
+ moved = 0
37
+ for x, y in zip(a, b):
38
+ d = x - y if x > y else y - x
39
+ total += d
40
+ if d > thr:
41
+ moved += 1
42
+ n = len(a) or 1
43
+ return total / n, moved / n
@@ -0,0 +1,90 @@
1
+ """pacing_check.py: hack 5, part two. Measures pacing from the pixels of a rendered video.
2
+
3
+ usage: python3 scripts/pacing_check.py <video.mp4> [--loop] [--max-gap 1.0] [--min-hold 0.3] [--end-hold 0]
4
+
5
+ Checks:
6
+ 1. No dead gaps: something visibly changes at least every --max-gap seconds.
7
+ A 'change' is a 0.1 s step where more than 0.4% of pixels move by more than 14 levels.
8
+ 2. Nothing flashes: no shot shorter than --min-hold seconds between two hard cuts,
9
+ and no element that pops in and out again inside --min-hold seconds.
10
+ Writes <video>-contact.jpg (one frame per second from 0 s, left to right) and <video>-pacing.json.
11
+ What counts as a change: big things moving. A small label sliding, or a slow colour fade, may not count,
12
+ so near a loop seam keep one big move going every second. Flicker faster than about 3 per second reads as a flash.
13
+ Exit code 0 = pass, 1 = fail."""
14
+ import argparse, json, os, subprocess, sys
15
+ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
16
+ from _media import probe, gray_frames, diff_stats
17
+
18
+ ap = argparse.ArgumentParser()
19
+ ap.add_argument('video')
20
+ ap.add_argument('--max-gap', type=float, default=1.0)
21
+ ap.add_argument('--min-hold', type=float, default=0.3)
22
+ ap.add_argument('--end-hold', type=float, default=0.0, help='a final hold this long is allowed')
23
+ ap.add_argument('--loop', action='store_true', help='it loops: also measure the gap across the loop point')
24
+ a = ap.parse_args()
25
+ info = probe(a.video)
26
+ dur = info['dur']
27
+
28
+ # 1. dead gaps, at 10 steps per second
29
+ f10, w, h = gray_frames(a.video, 10, 240)
30
+ events = []
31
+ for i in range(1, len(f10)):
32
+ _, moved = diff_stats(f10[i - 1], f10[i])
33
+ if moved > 0.004:
34
+ events.append(round(i / 10, 2))
35
+ pts = [0.0] + events + [round(dur, 2)]
36
+ gaps = [(pts[i], pts[i + 1], round(pts[i + 1] - pts[i], 2)) for i in range(len(pts) - 1)]
37
+ if a.loop and len(pts) > 2: # the quiet time at the end runs straight into the quiet time at the start
38
+ wrap = round((pts[-1] - pts[-2]) + (pts[1] - pts[0]), 2)
39
+ gaps.append((pts[-2], pts[1], wrap))
40
+ dead = [g for g in gaps if g[2] > a.max_gap + 0.05]
41
+ if a.end_hold:
42
+ dead = [g for g in dead if not (g[1] >= dur - 0.05 and g[2] <= a.end_hold + 0.05)]
43
+
44
+ # 2. flashes, at 30 steps per second
45
+ f30, _, _ = gray_frames(a.video, 30, 160)
46
+ k = max(1, int(round(a.min_hold / 2 * 30))) # look this many frames either side
47
+ cuts, flashes = [], []
48
+ for i in range(1, len(f30)):
49
+ _, moved = diff_stats(f30[i - 1], f30[i], 30)
50
+ if moved > 0.35:
51
+ cuts.append(i / 30)
52
+ for i in range(k, len(f30) - k, 2):
53
+ _, ac = diff_stats(f30[i - k], f30[i], 30)
54
+ _, ab = diff_stats(f30[i - k], f30[i + k], 30)
55
+ if ac > 0.01 and ab < 0.25 * ac:
56
+ flashes.append(round(i / 30, 2))
57
+ shots = [0.0] + cuts + [dur]
58
+ short_shots = [(round(shots[i], 2), round(shots[i + 1], 2)) for i in range(len(shots) - 1)
59
+ if shots[i + 1] - shots[i] < a.min_hold - 0.01]
60
+ # merge flash frames that sit next to each other
61
+ merged = []
62
+ for t in flashes:
63
+ if merged and t - merged[-1][1] <= 0.1:
64
+ merged[-1][1] = t
65
+ else:
66
+ merged.append([t, t])
67
+
68
+ # contact sheet, one frame per second
69
+ base = os.path.splitext(a.video)[0]
70
+ cols = 6 if info['w'] >= info['h'] else 8
71
+ rows = max(1, int((dur + cols - 1) // cols))
72
+ subprocess.run(['ffmpeg', '-v', 'error', '-y', '-i', a.video, '-vf',
73
+ f'fps=1:round=down,scale={320 if info["w"] >= info["h"] else 180}:-2,tile={cols}x{rows}:padding=8:margin=8:color=white',
74
+ '-frames:v', '1', '-q:v', '4', base + '-contact.jpg'], check=False)
75
+
76
+ rep = {'video': a.video, 'duration': round(dur, 2), 'change_steps': len(events),
77
+ 'longest_gap_s': max(g[2] for g in gaps), 'dead_gaps': dead,
78
+ 'hard_cuts': [round(c, 2) for c in cuts], 'too_short_shots': short_shots,
79
+ 'flashes': [m for m in merged], 'pass': not dead and not short_shots and not merged}
80
+ json.dump(rep, open(base + '-pacing.json', 'w'), indent=1)
81
+ print(f"pacing: longest gap {rep['longest_gap_s']} s (limit {a.max_gap}), {len(events)} change steps, "
82
+ f"{len(cuts)} hard cuts")
83
+ for g in dead:
84
+ print(f" FAIL dead gap {g[0]} to {g[1]} s ({g[2]} s with nothing moving)")
85
+ for s in short_shots:
86
+ print(f" FAIL shot {s[0]} to {s[1]} s is shorter than {a.min_hold} s")
87
+ for m in merged:
88
+ print(f" FAIL something pops in and out around {m[0]} to {m[1]} s (on screen under {a.min_hold} s)")
89
+ print('PASS' if rep['pass'] else 'FAIL', '| contact sheet:', base + '-contact.jpg')
90
+ sys.exit(0 if rep['pass'] else 1)
@@ -0,0 +1,77 @@
1
+ """storyboard.py: show the Media-mode plan and what it will cost, before anything is spent.
2
+
3
+ usage: python3 scripts/storyboard.py <storyboard.json>
4
+
5
+ storyboard.json (Claude writes it; see examples/storyboard.json):
6
+ {"title": "...", "format": "16:9", "seconds": 12,
7
+ "shots": [{"time": "0.0-3.0", "graphic": "what the graphic does",
8
+ "asset": {"kind": "code"}}, # pure code, free
9
+ {"time": "3.0-8.0", "graphic": "...",
10
+ "asset": {"kind": "user_photo", "path": "media/me.jpg"}}, # their photo, free
11
+ {"time": "...", "graphic": "...",
12
+ "asset": {"kind": "user_clip", "path": "media/demo.mp4"}}, # their clip, free
13
+ {"time": "...", "graphic": "...",
14
+ "asset": {"kind": "generate", "from": "media/me.jpg", "model": "seedance-2.0",
15
+ "prompt": "...", "duration": 5, "resolution": "720p"}}]} # costs credits
16
+ Prints a table, the credit estimate for every 'generate' shot, and the total. Writes storyboard.md.
17
+ It never generates anything."""
18
+ import json, os, subprocess, sys
19
+
20
+ HERE = os.path.dirname(os.path.abspath(__file__))
21
+ sb = json.load(open(sys.argv[1]))
22
+ root = os.path.dirname(os.path.abspath(sys.argv[1]))
23
+ rows, total, unknown, sources, missing = [], 0.0, 0, set(), []
24
+ for n, s in enumerate(sb['shots'], 1):
25
+ a = s.get('asset', {'kind': 'code'})
26
+ kind = a.get('kind', 'code')
27
+ cost = '0'
28
+ if kind in ('user_photo', 'user_clip'):
29
+ p = a.get('path', '')
30
+ if not os.path.exists(os.path.join(root, p)) and not os.path.exists(p):
31
+ missing.append(p)
32
+ what = f"your {'photo' if kind == 'user_photo' else 'clip'}: {os.path.basename(p)}"
33
+ elif kind == 'generate':
34
+ frm = a.get('from')
35
+ what = (f"Higgsfield {a.get('model', 'seedance-2.0')} clip "
36
+ + (f"from {os.path.basename(frm)}" if frm else 'from text') + f", {a.get('duration', 5)} s, "
37
+ f"{a.get('resolution', '720p')}. Prompt: \"{a.get('prompt', '')}\"")
38
+ cmd = [sys.executable, os.path.join(HERE, 'higgsfield.py'), 'estimate', '--model', a.get('model', 'seedance-2.0'),
39
+ '--duration', str(a.get('duration', 5)), '--resolution', a.get('resolution', '720p'),
40
+ '--prompt', a.get('prompt', '')]
41
+ if not frm:
42
+ cmd.append('--text')
43
+ r = subprocess.run(cmd, capture_output=True, text=True, cwd=root)
44
+ try:
45
+ est = json.loads(r.stdout.strip().splitlines()[-1])
46
+ except Exception:
47
+ est = {'credits': None, 'source': (r.stderr or r.stdout)[-200:]}
48
+ sources.add(est['source'])
49
+ if est['credits'] is None:
50
+ cost, unknown = '?', unknown + 1
51
+ else:
52
+ cost = f"{est['credits']:g}"
53
+ total += est['credits']
54
+ else:
55
+ what = 'code only (no media)'
56
+ rows.append((n, s.get('time', ''), s.get('graphic', ''), what, cost))
57
+
58
+ gen = sum(1 for s in sb['shots'] if s.get('asset', {}).get('kind') == 'generate')
59
+ lines = [f"# Storyboard: {sb.get('title', 'untitled')}", '',
60
+ f"{sb.get('format', '16:9')}, {sb.get('seconds', '?')} s. Nothing has been generated or spent yet.", '',
61
+ '| Shot | Time (s) | What the graphic does | Asset | Credits |', '|---|---|---|---|---|']
62
+ lines += [f'| {n} | {t} | {g} | {w} | {c} |' for n, t, g, w, c in rows]
63
+ lines.append('')
64
+ if gen:
65
+ tot = f'{total:g}' + (f' + {unknown} unknown' if unknown else '')
66
+ lines.append(f"Total to generate {gen} clip{'s' if gen > 1 else ''}: about {tot} credits "
67
+ f"({'; '.join(sorted(sources))}). Failed jobs are not charged.")
68
+ lines.append('')
69
+ lines.append('Reply "yes" to generate. Anything else and I change the plan first.')
70
+ else:
71
+ lines.append('No AI clips in this plan, so it costs 0 credits.')
72
+ if missing:
73
+ lines.append('')
74
+ lines.append('Missing files: ' + ', '.join(missing))
75
+ md = '\n'.join(lines)
76
+ open(os.path.join(root, 'storyboard.md'), 'w').write(md + '\n')
77
+ print(md)
@@ -0,0 +1,26 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vibha Ramprakash
4
+ Copyright (c) 2026 Adam Digital Pte Ltd (additions and changes)
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
23
+
24
+ The fonts in fonts/, the models in models/ and the brand logos in assets/logos.json keep their own
25
+ licences (see README.md, fonts/*.txt, models/NOTICE.md and assets/logos.json). The logos are
26
+ trademarks of their respective owners.