@topy-ai/maggie 0.8.9 → 0.8.10

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-zh-TW.md CHANGED
@@ -143,7 +143,7 @@ structure drift 或重複 treatment product 時 fail closed。
143
143
  deployment、memory、feedback 和 MaggieDash。內容先 draft/review,外部寫入、
144
144
  publish 與 production deployment 需要明確確認。
145
145
 
146
- 目前 npm 版本為 `0.8.9`,為 `maggie_video.py` 新增 `compile` 子命令(把宣告式 timeline JSON 編譯成單一 ffmpeg 命令,已實測)。先前 0.8.8 新增 `maggie-video`(製作與處理行銷影片:剪輯、字幕、裁切成各渠道比例、浮水印、轉碼、響度正規化、clip 組裝、程式化動畫),附一個實測可用的 ffmpeg 配方 CLI(`maggie_video.py`),從參考庫的影片專案(moviepy/editly/ffmpeg 命令層、Revideo/Motion Canvas/CCapture 程式化渲染、MLT/OpenShot/Olive 的 timeline 資料形狀)提煉而來;另加 `ffmpeg-recipes`、`programmatic-video`、`video-timeline-model` 三個 reference。先前 0.8.7 把 redesign 稽核併入 `maggie-design`(改編自 MIT 的 `elayadesign/redesign-skill`):掃描 + 診斷 AI 通病/缺失狀態/雜亂程式碼,再經 in-place/verify 流程就地修正,因此「稽核/打磨/升級既有站點」會路由到 maggie-design。先前 0.8.6 補齊兩個設計技能:加入完整的生產 reference,並把設計來源明確為 Figma 非必需(實時 URL、既有程式碼、Figma、或純截圖)。先前 0.8.5 採納兩個設計技能(改編自 MIT 的 `elayadesign/ai-design-skills`):maggie-landing-page(轉化策略 + 視覺系統紀律,具體數值為可被專案 DESIGN.md 覆蓋的預設值;由 maggie-design 生產與驗證)與 maggie-design-motion(靜態設計→像素級動畫 HTML 複刻→匯出 MP4 + GIF)。先前 0.8.4 將技能庫擴展成完整的「一人用 AI 跑一家公司」C-suite,新增八條職能線:maggie-sales(CRM 中立的銷售管線)、maggie-finance(只解釋的 CFO 指標,含確定性 maggie_finance.py 計算器)、maggie-support(面向客戶的客戶成功)、maggie-product(路線圖 + 預註冊實驗)、maggie-fundraising(pitch deck、data room、投資人更新)、maggie-legal(ToS/隱私/DPA/SOC2 readiness)、maggie-monetization(定價/paywall/dunning,金錢操作需人工批准)、maggie-orchestrator(CEO 編排層:將目標拆成帶審批門的 mission 分派到各職能線,含 maggie_orchestrator.py 規劃器)。先前 0.8.3 將 cmo.so/www 開發經驗沉澱進技能庫:新增兩個技能 maggie-skill-authoring(依 catalog 與 MCP 工具白名單撰寫/校驗社區營銷 playbook 技能)與 maggie-feedback-triage(反饋的團隊接收端:決策/定級/分派、PRD + issue 流程、24/7 隊列守護);新增多個 reference(OAuth PKCE 登入、Expo 約定與 Router 骨架、MCP evals 測試框架、conversation cards、WordPress→Firebase 認證遷移手冊);並增補 maggie-assistant-tools(tool≤user 每輪工具過濾、agent loop 安全不變量、preview-only 橋接代理、MCP resources/prompts、注解加固、CLI 與 ChatGPT 插件打包)、maggie-auth-reference(自清理登入測試套件、自簽單次令牌)、maggie-mobile-app(OTA 開機拉取、live==built 部署守衛)、maggie-deployment(pm2 單包發布、live-hash 校驗)與 maggie-ops(template-as-code 郵件同步)。先前 0.8.2 新增 maggie-spirit(為 AI 品牌生成平面像素 spirit/sprite 系統)與 goal-led AI agent 設計參考;0.8.0 為安全優化 roadmap(scan、image-patch、標頭評分、SSVC、GDPR 日誌規則、新 MCP 工具)。先前 0.8.0 為安全優化 roadmap(scan、image-patch、標頭評分、SSVC、GDPR 日誌規則、新 MCP 工具),含 fix-plan 修補風險分級 T1–T4(判斷補丁是否安全套用)與 host-impact 補丁影響面量測(哪些服務需重啟、是否需重開機)、public-check、Maggie Security、batch 31 排程 agent routines、報告收件匣與無人值守 agent 限制、PHP runtime 盤點與主機鎖、pull 網站改寫、query 點子與社群佇列檢查,batch 30 MaggieDash 先裝核心、release privacy gate、feedback 備援、社群連結與圖片檢查、大量頁面產生與 app 檢查,batch 29 預約規則、部署、app QA、助理與社群功能,以及 batch 28 產品 app、assistant tools、mobile、product release、skills catalog 與 bridge host 功能、batch 26、27 feedback 修正與 idempotent `maggie update`與 Booking email-template 合約/CLI validator 同步。本版完成 2026-09-24 booking feedback batch:Calendar grid/free-slot entry 與 host modal focus-restoration evidence。本版新增 Starter marketplace provisioning plan;本版完成 feedback batches 22、23:加入 declarative browser interaction evidence、design markup/style/content-key gate、compiler source anchoring、entity double-escape protection、`update --help` read-only、noindex hypothetical indexability、可過期 baseline acknowledgement、DOM-only link extraction regression,以及 MaggieDash 0.2.10 的 content override、短期 browser session、CDN-safe public-session cache contracts。authentication 和 isolated dev server 仍由 host 負責。`maggie-booking` workflow、傳統 email/password、Stripe、Resend、public booking flow 及既有安全邊界維持不變;provider-bound video generation 與 transactional delivery 仍記錄在 issue #39,前一批延後功能仍在 issue #38,不會直接成為 active memory。0.7.33 記錄並審查一筆更正回饋;確認 0.7.32 已正確處理 batch index,沒有修改已驗證的 shared behavior。0.7.32 加入 feedback 一基索引支援、MaggieDash panel 的 source/freshness/error evidence、Consent Mode 與實際 write/no-op reconciliation、SEO baseline recapture、sitemap origin rebasing、content-diff scope、migration ledger reconciliation、deployment credential preflight、release provenance/runtime preflight、icon release gate、opt-in blog auto-publish gate,以及 least-privilege VPS deployer。也修復 top-level `maggie feedback` dispatcher parity。0.7.31 加入 update 差異摘要、atomic installer copy、subset install manifest merge,以及 inventory drift 時 doctor non-zero。0.7.30 補上 feedback tracking issue closeout gate 與 batch 14/15 audit ledger。0.7.29 修正 npm package landing page 使用英文 README;0.7.28 加入 versioned Gemini model policy、明確 fallback 與 provenance、bundled-first CLI
146
+ 目前 npm 版本為 `0.8.10`,`maggie_video.py compile` 新增 ken-burns(圖片 zoompan)與文字透明度關鍵幀編譯,並新增 `captions` 子命令(本地 whisper 語音轉 SRT),打通「配音→自動字幕→燒錄」。先前 0.8.9 新增 `compile`(宣告式 timeline JSON→單一 ffmpeg 命令)。先前 0.8.8 新增 `maggie-video`(製作與處理行銷影片:剪輯、字幕、裁切成各渠道比例、浮水印、轉碼、響度正規化、clip 組裝、程式化動畫),附一個實測可用的 ffmpeg 配方 CLI(`maggie_video.py`),從參考庫的影片專案(moviepy/editly/ffmpeg 命令層、Revideo/Motion Canvas/CCapture 程式化渲染、MLT/OpenShot/Olive 的 timeline 資料形狀)提煉而來;另加 `ffmpeg-recipes`、`programmatic-video`、`video-timeline-model` 三個 reference。先前 0.8.7 把 redesign 稽核併入 `maggie-design`(改編自 MIT 的 `elayadesign/redesign-skill`):掃描 + 診斷 AI 通病/缺失狀態/雜亂程式碼,再經 in-place/verify 流程就地修正,因此「稽核/打磨/升級既有站點」會路由到 maggie-design。先前 0.8.6 補齊兩個設計技能:加入完整的生產 reference,並把設計來源明確為 Figma 非必需(實時 URL、既有程式碼、Figma、或純截圖)。先前 0.8.5 採納兩個設計技能(改編自 MIT 的 `elayadesign/ai-design-skills`):maggie-landing-page(轉化策略 + 視覺系統紀律,具體數值為可被專案 DESIGN.md 覆蓋的預設值;由 maggie-design 生產與驗證)與 maggie-design-motion(靜態設計→像素級動畫 HTML 複刻→匯出 MP4 + GIF)。先前 0.8.4 將技能庫擴展成完整的「一人用 AI 跑一家公司」C-suite,新增八條職能線:maggie-sales(CRM 中立的銷售管線)、maggie-finance(只解釋的 CFO 指標,含確定性 maggie_finance.py 計算器)、maggie-support(面向客戶的客戶成功)、maggie-product(路線圖 + 預註冊實驗)、maggie-fundraising(pitch deck、data room、投資人更新)、maggie-legal(ToS/隱私/DPA/SOC2 readiness)、maggie-monetization(定價/paywall/dunning,金錢操作需人工批准)、maggie-orchestrator(CEO 編排層:將目標拆成帶審批門的 mission 分派到各職能線,含 maggie_orchestrator.py 規劃器)。先前 0.8.3 將 cmo.so/www 開發經驗沉澱進技能庫:新增兩個技能 maggie-skill-authoring(依 catalog 與 MCP 工具白名單撰寫/校驗社區營銷 playbook 技能)與 maggie-feedback-triage(反饋的團隊接收端:決策/定級/分派、PRD + issue 流程、24/7 隊列守護);新增多個 reference(OAuth PKCE 登入、Expo 約定與 Router 骨架、MCP evals 測試框架、conversation cards、WordPress→Firebase 認證遷移手冊);並增補 maggie-assistant-tools(tool≤user 每輪工具過濾、agent loop 安全不變量、preview-only 橋接代理、MCP resources/prompts、注解加固、CLI 與 ChatGPT 插件打包)、maggie-auth-reference(自清理登入測試套件、自簽單次令牌)、maggie-mobile-app(OTA 開機拉取、live==built 部署守衛)、maggie-deployment(pm2 單包發布、live-hash 校驗)與 maggie-ops(template-as-code 郵件同步)。先前 0.8.2 新增 maggie-spirit(為 AI 品牌生成平面像素 spirit/sprite 系統)與 goal-led AI agent 設計參考;0.8.0 為安全優化 roadmap(scan、image-patch、標頭評分、SSVC、GDPR 日誌規則、新 MCP 工具)。先前 0.8.0 為安全優化 roadmap(scan、image-patch、標頭評分、SSVC、GDPR 日誌規則、新 MCP 工具),含 fix-plan 修補風險分級 T1–T4(判斷補丁是否安全套用)與 host-impact 補丁影響面量測(哪些服務需重啟、是否需重開機)、public-check、Maggie Security、batch 31 排程 agent routines、報告收件匣與無人值守 agent 限制、PHP runtime 盤點與主機鎖、pull 網站改寫、query 點子與社群佇列檢查,batch 30 MaggieDash 先裝核心、release privacy gate、feedback 備援、社群連結與圖片檢查、大量頁面產生與 app 檢查,batch 29 預約規則、部署、app QA、助理與社群功能,以及 batch 28 產品 app、assistant tools、mobile、product release、skills catalog 與 bridge host 功能、batch 26、27 feedback 修正與 idempotent `maggie update`與 Booking email-template 合約/CLI validator 同步。本版完成 2026-09-24 booking feedback batch:Calendar grid/free-slot entry 與 host modal focus-restoration evidence。本版新增 Starter marketplace provisioning plan;本版完成 feedback batches 22、23:加入 declarative browser interaction evidence、design markup/style/content-key gate、compiler source anchoring、entity double-escape protection、`update --help` read-only、noindex hypothetical indexability、可過期 baseline acknowledgement、DOM-only link extraction regression,以及 MaggieDash 0.2.10 的 content override、短期 browser session、CDN-safe public-session cache contracts。authentication 和 isolated dev server 仍由 host 負責。`maggie-booking` workflow、傳統 email/password、Stripe、Resend、public booking flow 及既有安全邊界維持不變;provider-bound video generation 與 transactional delivery 仍記錄在 issue #39,前一批延後功能仍在 issue #38,不會直接成為 active memory。0.7.33 記錄並審查一筆更正回饋;確認 0.7.32 已正確處理 batch index,沒有修改已驗證的 shared behavior。0.7.32 加入 feedback 一基索引支援、MaggieDash panel 的 source/freshness/error evidence、Consent Mode 與實際 write/no-op reconciliation、SEO baseline recapture、sitemap origin rebasing、content-diff scope、migration ledger reconciliation、deployment credential preflight、release provenance/runtime preflight、icon release gate、opt-in blog auto-publish gate,以及 least-privilege VPS deployer。也修復 top-level `maggie feedback` dispatcher parity。0.7.31 加入 update 差異摘要、atomic installer copy、subset install manifest merge,以及 inventory drift 時 doctor non-zero。0.7.30 補上 feedback tracking issue closeout gate 與 batch 14/15 audit ledger。0.7.29 修正 npm package landing page 使用英文 README;0.7.28 加入 versioned Gemini model policy、明確 fallback 與 provenance、bundled-first CLI
147
147
  dispatch、`maggie --version`、feedback batch review 聚合與重複偵測、marketplace enrichment evidence、booking
148
148
  worker/resolver evidence,以及 read-only migration preflight。它也包含 host-owned mobile app surface contract、signed-in
149
149
  camera-state QA、直接 Astro route resolution、correlated feedback batch,以及
package/README.md CHANGED
@@ -89,7 +89,7 @@ Maggie keeps the existing project foundation and asks for decisions before
89
89
  shared routes, analytics, or publishing boundaries change. The current
90
90
  package ships 37 installable skills and a local-first MaggieDash foundation.
91
91
 
92
- This package is `0.8.9` — it adds a `compile` subcommand to `maggie_video.py` (declarative timeline JSON -> one ffmpeg command, tested end-to-end). `0.8.8` added `maggie-video` (produce and process marketing video: cut, caption, resize to channel aspects, watermark, transcode, normalize loudness, assemble clips, render code-drawn animation) with a tested ffmpeg-recipe CLI, distilled from the reference library's video projects; plus references `ffmpeg-recipes`, `programmatic-video`, `video-timeline-model`. `0.8.7` folded a redesign audit into `maggie-design` (from the MIT `elayadesign/redesign-skill`): scan + diagnose generic AI-design patterns/weak states/sloppy code, then fix in place via the in-place/verify flow, so "audit/polish/upgrade an existing site" routes to maggie-design. `0.8.6` completed the two adopted design skills with full production references and made the design source Figma-optional (live URL, existing code, Figma, or a screenshot). `0.8.5` adopted the two design skills (adapted, MIT, from `elayadesign/ai-design-skills`): `maggie-landing-page` (conversion strategy + a visual-system discipline whose values defer to the project's DESIGN.md) and `maggie-design-motion` (static design → pixel-exact animated HTML replica → MP4 + GIF export). `0.8.4` expanded the library into a full "one person runs a company with AI" C-suite with eight new function lanes: `maggie-sales` (CRM-neutral pipeline), `maggie-finance` (explain-only CFO metrics + a deterministic `maggie_finance.py` calculator), `maggie-support` (customer success), `maggie-product` (roadmap + pre-registered experiments), `maggie-fundraising` (deck, data room, investor updates), `maggie-legal` (ToS/privacy/DPA/SOC2 readiness), `maggie-monetization` (pricing/paywalls/dunning; money actions human-approved), and `maggie-orchestrator` (the CEO layer that decomposes a goal into gated missions across the lanes, with a `maggie_orchestrator.py` planner). `0.8.3` folded cmo.so/www development learnings in (maggie-skill-authoring, maggie-feedback-triage, and mobile/MCP/auth references); `0.8.2` added `maggie-spirit`; `0.8.0` was the security optimization roadmap.
92
+ This package is `0.8.10` — `maggie_video.py compile` now does ken-burns + text opacity keyframes, and a new `captions` subcommand does local whisper speech-to-SRT (voiceover -> auto-captions -> burn-in). `0.8.9` added `compile` (declarative timeline JSON -> one ffmpeg command). `0.8.8` added `maggie-video` (produce and process marketing video: cut, caption, resize to channel aspects, watermark, transcode, normalize loudness, assemble clips, render code-drawn animation) with a tested ffmpeg-recipe CLI, distilled from the reference library's video projects; plus references `ffmpeg-recipes`, `programmatic-video`, `video-timeline-model`. `0.8.7` folded a redesign audit into `maggie-design` (from the MIT `elayadesign/redesign-skill`): scan + diagnose generic AI-design patterns/weak states/sloppy code, then fix in place via the in-place/verify flow, so "audit/polish/upgrade an existing site" routes to maggie-design. `0.8.6` completed the two adopted design skills with full production references and made the design source Figma-optional (live URL, existing code, Figma, or a screenshot). `0.8.5` adopted the two design skills (adapted, MIT, from `elayadesign/ai-design-skills`): `maggie-landing-page` (conversion strategy + a visual-system discipline whose values defer to the project's DESIGN.md) and `maggie-design-motion` (static design → pixel-exact animated HTML replica → MP4 + GIF export). `0.8.4` expanded the library into a full "one person runs a company with AI" C-suite with eight new function lanes: `maggie-sales` (CRM-neutral pipeline), `maggie-finance` (explain-only CFO metrics + a deterministic `maggie_finance.py` calculator), `maggie-support` (customer success), `maggie-product` (roadmap + pre-registered experiments), `maggie-fundraising` (deck, data room, investor updates), `maggie-legal` (ToS/privacy/DPA/SOC2 readiness), `maggie-monetization` (pricing/paywalls/dunning; money actions human-approved), and `maggie-orchestrator` (the CEO layer that decomposes a goal into gated missions across the lanes, with a `maggie_orchestrator.py` planner). `0.8.3` folded cmo.so/www development learnings in (maggie-skill-authoring, maggie-feedback-triage, and mobile/MCP/auth references); `0.8.2` added `maggie-spirit`; `0.8.0` was the security optimization roadmap.
93
93
 
94
94
  The 0.7.59 release made `maggie security host-audit` (the deep
95
95
  lynis audit over SSH) robust on hosts where a storage test can stall: lynis runs
@@ -98,12 +98,15 @@ shape renders through ffmpeg without any GPL engine.
98
98
  `maggie_video.py compile --spec timeline.json` compiles this model into one ffmpeg
99
99
  `filter_complex` command (printed; run with `--run`). Supported today: a main video
100
100
  track of clips (video/image) fit `cover`/`contain` to the canvas, hard-cut `concat`
101
- or sequential `crossfade` (from `transitions`), image/text/caption overlays with
102
- `position`+`duration` timing and `rect` placement, and an `audio[]` mix with
103
- per-track `position`/`gain` plus `loudnorm`. Output is bounded to the computed video
104
- duration and uses the shared web-safe profile. Not compiled yet (emitted as
105
- `# NOTE:` lines): keyframes, ken-burns, and sidechain ducking - set static values or
106
- use a programmatic engine for those.
101
+ or sequential `crossfade` (from `transitions`), **ken-burns on image clips**
102
+ (`"kenBurns":{"zoom":"in"|"out","amount":0.12}` or a `zoom` effect, via `zoompan`),
103
+ image/text/caption overlays with `position`+`duration` timing and `rect` placement,
104
+ **text opacity keyframes** (`effects:[{"type":"opacity","keyframes":[{"t","v"}...]}]`,
105
+ via a drawtext `alpha` expression), and an `audio[]` mix with per-track
106
+ `position`/`gain` plus `loudnorm`. Output is bounded to the computed video duration
107
+ and uses the shared web-safe profile. Not compiled yet (emitted as `# NOTE:` lines):
108
+ ken-burns on *video* clips, non-opacity overlay effects, and sidechain ducking - set
109
+ static values or use a programmatic engine for those.
107
110
 
108
111
  ```bash
109
112
  maggie tool maggie_video.py compile --spec timeline.json # print the command
@@ -2,7 +2,7 @@
2
2
  name: maggie-video
3
3
  description: Produce and process marketing video - render a composition to MP4/GIF/WebM, assemble clips/images/text/captions/audio on a timeline, cut to channel aspects (reel/square/youtube), burn in captions, normalize loudness, watermark, transcode, and make social cuts. Engine-neutral over the renderer (ffmpeg for assembly/transcode, a programmatic engine for code-drawn animation). Use when the user wants to make, edit, cut, caption, resize, or export a video for marketing.
4
4
  metadata:
5
- version: 0.1.1
5
+ version: 0.1.2
6
6
  ---
7
7
 
8
8
  # Maggie Video
@@ -65,14 +65,31 @@ maggie tool maggie_video.py trim --input in.mp4 --output cut.mp4 --start 5 --dur
65
65
  maggie tool maggie_video.py concat --inputs a.mp4 b.mp4 --output all.mp4 --reencode
66
66
  maggie tool maggie_video.py thumb --input in.mp4 --output poster.jpg --at 00:00:03
67
67
  maggie tool maggie_video.py compile --spec timeline.json # declarative -> one command
68
+ maggie tool maggie_video.py captions --input vo.mp3 --output vo.srt # local whisper -> SRT
68
69
  maggie tool maggie_video.py --run encode --input in.mov --output out.mp4 # actually runs
69
70
  maggie tool maggie_video.py presets
70
71
  ```
71
72
 
72
73
  Subcommands: `encode` (web-safe MP4 / VP9 WebM), `gif`, `trim`, `concat`, `social`,
73
74
  `overlay`, `subtitle` (burn or soft-mux), `loudnorm`, `thumb`, `compile` (timeline
74
- JSON -> ffmpeg), `presets`. `--run` (before the subcommand) executes when ffmpeg is
75
- on PATH; otherwise the command is printed for review.
75
+ JSON -> ffmpeg, incl. image ken-burns and text opacity keyframes), `captions`
76
+ (local whisper speech-to-SRT), `presets`. `--run` (before the subcommand) executes
77
+ when the tool is on PATH; otherwise the command is printed for review.
78
+
79
+ ## Auto-captions workflow (voiceover -> subtitles -> burned-in)
80
+
81
+ Captions lift watch time and work with sound off. Pipeline, all local/offline (no
82
+ paid API):
83
+
84
+ 1. **Transcribe** the voiceover or the video's audio to SRT with a local engine
85
+ (`captions`, default `openai-whisper`; `whispercpp` or `whisperx` also supported;
86
+ a larger `--model` is slower but more accurate). A human reviews/edits the SRT.
87
+ 2. **Burn in** (`subtitle --input video.mp4 --srt vo.srt --output out.mp4`) or add a
88
+ `captions` layer in a `compile` timeline, or soft-mux (`subtitle --soft`) for a
89
+ toggleable track.
90
+
91
+ Never fabricate a transcript; generate it from the real audio and have a human
92
+ review before publishing.
76
93
 
77
94
  ## Channel presets and safe areas
78
95
 
@@ -9,7 +9,7 @@ LGPL/GPL use); it links no libav and vendors no GPL code. Output is always force
9
9
  to a web-safe, platform-correct profile.
10
10
 
11
11
  Subcommands: encode, gif, trim, concat, social, overlay, subtitle, loudnorm,
12
- thumb, compile, presets.
12
+ thumb, compile, captions, presets.
13
13
  """
14
14
  import argparse
15
15
  import json
@@ -29,13 +29,13 @@ OVERLAY_POS = {"br": "W-w-{m}:H-h-{m}", "bl": "{m}:H-h-{m}",
29
29
  "tr": "W-w-{m}:{m}", "tl": "{m}:{m}"}
30
30
 
31
31
 
32
- def emit(args, run):
32
+ def emit(args, run, tool="ffmpeg"):
33
33
  printable = " ".join(shlex.quote(a) for a in args)
34
34
  print(printable)
35
35
  if not run:
36
36
  return 0
37
- if not shutil.which("ffmpeg"):
38
- sys.stderr.write("ffmpeg not found on PATH; printed the command only.\n")
37
+ if not shutil.which(args[0] if tool == "argv0" else tool):
38
+ sys.stderr.write(f"{tool} not found on PATH; printed the command only.\n")
39
39
  return 3
40
40
  return subprocess.run(args).returncode
41
41
 
@@ -161,6 +161,49 @@ def _clip_dur(clip, default):
161
161
  return float(default)
162
162
 
163
163
 
164
+ def _kenburns(w, h, fps, dur, direction="in", amount=0.12):
165
+ """A ken-burns (slow zoom) filter chain for an image clip, fit to WxH.
166
+ Prescales with headroom so the zoom stays sharp; animates over the clip."""
167
+ bw, bh = int(w * 1.6), int(h * 1.6)
168
+ n = max(1, round(dur * fps))
169
+ if direction == "out":
170
+ z = f"(1+{amount})-{amount}*in/{n}"
171
+ else:
172
+ z = f"1+{amount}*in/{n}"
173
+ return (f"scale={bw}:{bh}:force_original_aspect_ratio=increase,crop={bw}:{bh},"
174
+ f"zoompan=z='{z}':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)':"
175
+ f"s={w}x{h}:fps={fps},setsar=1,format=yuv420p")
176
+
177
+
178
+ def _kf_alpha_expr(keyframes, offset):
179
+ """A piecewise-linear ffmpeg expression (in t, seconds) for an opacity track."""
180
+ pts = [(offset + float(k["t"]), float(k["v"])) for k in keyframes]
181
+ expr = f"{pts[-1][1]}"
182
+ for (ta, va), (tb, vb) in reversed(list(zip(pts, pts[1:]))):
183
+ seg = f"({va}+({vb}-{va})*(t-{ta})/({tb - ta}))"
184
+ expr = f"if(lt(t,{tb}),{seg},{expr})"
185
+ return f"if(lt(t,{pts[0][0]}),{pts[0][1]},{expr})"
186
+
187
+
188
+ def _opacity_kfs(clip):
189
+ for e in clip.get("effects", []) or []:
190
+ if e.get("type") == "opacity" and e.get("keyframes"):
191
+ return e["keyframes"]
192
+ return None
193
+
194
+
195
+ def _kenburns_cfg(clip):
196
+ kb = clip.get("kenBurns")
197
+ if isinstance(kb, dict):
198
+ return kb.get("zoom", "in"), float(kb.get("amount", 0.12))
199
+ for e in clip.get("effects", []) or []:
200
+ if e.get("type") == "zoom" and e.get("keyframes"):
201
+ vs = [float(k["v"]) for k in e["keyframes"]]
202
+ amt = abs(vs[-1] - vs[0]) or 0.12
203
+ return ("out" if vs[-1] < vs[0] else "in"), amt
204
+ return None
205
+
206
+
164
207
  def _px(val, total):
165
208
  """Resolve '80%' / 0.8 / 120 against a total dimension to an int pixel value."""
166
209
  if isinstance(val, str) and val.strip().endswith("%"):
@@ -204,14 +247,22 @@ def c_compile(a):
204
247
  asset = assets.get(aid, {})
205
248
  dur = _clip_dur(clip, def_dur)
206
249
  fit = clip.get("fit", "cover")
250
+ kb = _kenburns_cfg(clip)
207
251
  if asset.get("type") == "image" or clip.get("type") == "image":
208
- idx = add_input(["-loop", "1", "-t", f"{dur}"], asset.get("src", clip.get("src", "")))
209
- filters.append(f"[{idx}:v]{_fit(W, H, fit, FPS)}[v{i}]")
252
+ idx = add_input(["-loop", "1", "-framerate", f"{FPS}", "-t", f"{dur}"],
253
+ asset.get("src", clip.get("src", "")))
254
+ if kb:
255
+ chain = _kenburns(W, H, FPS, dur, kb[0], kb[1])
256
+ else:
257
+ chain = _fit(W, H, fit, FPS)
258
+ filters.append(f"[{idx}:v]{chain}[v{i}]")
210
259
  elif asset.get("type") == "video":
211
260
  idx = add_input([], asset.get("src", ""))
212
261
  s = clip.get("start", 0)
213
262
  trim = f"trim=start={s}:end={s + dur},setpts=PTS-STARTPTS,"
214
263
  filters.append(f"[{idx}:v]{trim}{_fit(W, H, fit, FPS)}[v{i}]")
264
+ if kb:
265
+ notes.append(f"clip {i}: ken-burns on a video clip not compiled (image clips only); shown as plain fit")
215
266
  else:
216
267
  notes.append(f"clip {i}: unsupported type (need asset of type image/video)")
217
268
  continue
@@ -248,8 +299,9 @@ def c_compile(a):
248
299
  pos = float(clip.get("position", 0))
249
300
  dur = _clip_dur(clip, def_dur)
250
301
  en = f"enable='between(t,{pos},{pos + dur})'"
251
- if clip.get("effects"):
252
- notes.append("overlay effects/keyframes (opacity/zoom) not compiled; shown at full opacity")
302
+ op_kfs = _opacity_kfs(clip)
303
+ if clip.get("effects") and not op_kfs:
304
+ notes.append("overlay effect other than opacity (e.g. zoom) not compiled on this overlay")
253
305
  ctype = clip.get("type")
254
306
  if ctype == "text":
255
307
  st = clip.get("style", {})
@@ -258,8 +310,9 @@ def c_compile(a):
258
310
  y = _px(rect.get("y", "80%"), H)
259
311
  txt = str(clip.get("text", "")).replace(":", r"\:").replace("'", "’")
260
312
  box = f":box=1:boxcolor={st['box']}:boxborderw=12" if st.get("box") else ""
313
+ alpha = f":alpha='{_kf_alpha_expr(op_kfs, pos)}'" if op_kfs else ""
261
314
  dt = (f"drawtext=text='{txt}':x={x}:y={y}:fontsize={st.get('size',48)}:"
262
- f"fontcolor={st.get('color','#FFFFFF')}{box}:{en}")
315
+ f"fontcolor={st.get('color','#FFFFFF')}{box}{alpha}:{en}")
263
316
  filters.append(f"{cur}{dt}{nxt}")
264
317
  elif ctype == "captions":
265
318
  src = clip.get("src", "")
@@ -321,6 +374,34 @@ def c_compile(a):
321
374
  return emit(cmd, a.run)
322
375
 
323
376
 
377
+ def c_captions(a):
378
+ """Transcribe speech to an SRT with a local, offline engine (no paid API).
379
+ Pairs with `subtitle` (burn in) and `compile` (a captions overlay)."""
380
+ import os
381
+ out_dir = os.path.dirname(os.path.abspath(a.output)) or "."
382
+ base = os.path.splitext(os.path.basename(a.output))[0]
383
+ lang = [] if a.lang == "auto" else (["--language", a.lang])
384
+ if a.engine == "whispercpp":
385
+ # whisper.cpp: -m <model.bin> -f IN -osrt -of OUTBASE (writes OUTBASE.srt)
386
+ tool = "whisper-cli"
387
+ cmd = [tool, "-m", a.model, "-f", a.input, "-osrt", "-of",
388
+ os.path.join(out_dir, base)]
389
+ print(f"# whisper.cpp writes {os.path.join(out_dir, base)}.srt; --model is the .bin path")
390
+ elif a.engine == "whisperx":
391
+ tool = "whisperx"
392
+ cmd = [tool, a.input, "--model", a.model, "--output_format", "srt",
393
+ "--output_dir", out_dir] + lang
394
+ print(f"# whisperx writes {os.path.join(out_dir, base)}.srt in --output_dir")
395
+ else: # openai-whisper (local, pip install openai-whisper)
396
+ tool = "whisper"
397
+ cmd = [tool, a.input, "--model", a.model, "--output_format", "srt",
398
+ "--output_dir", out_dir] + lang
399
+ print(f"# openai-whisper writes {os.path.join(out_dir, base)}.srt in --output_dir")
400
+ print("# transcription is local/offline (no paid API); a large model is slower but better.")
401
+ print("# then: maggie_video.py subtitle --input video.mp4 --srt <that>.srt --output out.mp4 (burn in)")
402
+ return emit(cmd, a.run, tool=tool)
403
+
404
+
324
405
  def c_presets(a):
325
406
  print("Channel aspect presets (use with `social --aspect <name>`):")
326
407
  for name, (w, h) in SOCIAL.items():
@@ -389,6 +470,12 @@ def main(argv=None):
389
470
  cp.add_argument("--output", help="override the output path from the spec")
390
471
  cp.set_defaults(fn=c_compile)
391
472
 
473
+ ca = sub.add_parser("captions", help="transcribe speech to SRT (local whisper)")
474
+ ca.add_argument("--input", required=True); ca.add_argument("--output", required=True, help="target .srt")
475
+ ca.add_argument("--engine", choices=["whisper", "whispercpp", "whisperx"], default="whisper")
476
+ ca.add_argument("--model", default="base", help="model name, or the .bin path for whispercpp")
477
+ ca.add_argument("--lang", default="auto"); ca.set_defaults(fn=c_captions)
478
+
392
479
  sub.add_parser("presets", help="list channel aspect presets").set_defaults(fn=c_presets)
393
480
 
394
481
  a = ap.parse_args(argv)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topy-ai/maggie",
3
- "version": "0.8.9",
3
+ "version": "0.8.10",
4
4
  "description": "Install and manage Maggie Skills for AI coding agents",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -98,12 +98,15 @@ shape renders through ffmpeg without any GPL engine.
98
98
  `maggie_video.py compile --spec timeline.json` compiles this model into one ffmpeg
99
99
  `filter_complex` command (printed; run with `--run`). Supported today: a main video
100
100
  track of clips (video/image) fit `cover`/`contain` to the canvas, hard-cut `concat`
101
- or sequential `crossfade` (from `transitions`), image/text/caption overlays with
102
- `position`+`duration` timing and `rect` placement, and an `audio[]` mix with
103
- per-track `position`/`gain` plus `loudnorm`. Output is bounded to the computed video
104
- duration and uses the shared web-safe profile. Not compiled yet (emitted as
105
- `# NOTE:` lines): keyframes, ken-burns, and sidechain ducking - set static values or
106
- use a programmatic engine for those.
101
+ or sequential `crossfade` (from `transitions`), **ken-burns on image clips**
102
+ (`"kenBurns":{"zoom":"in"|"out","amount":0.12}` or a `zoom` effect, via `zoompan`),
103
+ image/text/caption overlays with `position`+`duration` timing and `rect` placement,
104
+ **text opacity keyframes** (`effects:[{"type":"opacity","keyframes":[{"t","v"}...]}]`,
105
+ via a drawtext `alpha` expression), and an `audio[]` mix with per-track
106
+ `position`/`gain` plus `loudnorm`. Output is bounded to the computed video duration
107
+ and uses the shared web-safe profile. Not compiled yet (emitted as `# NOTE:` lines):
108
+ ken-burns on *video* clips, non-opacity overlay effects, and sidechain ducking - set
109
+ static values or use a programmatic engine for those.
107
110
 
108
111
  ```bash
109
112
  maggie tool maggie_video.py compile --spec timeline.json # print the command