Communitygithub.com

manim-motion-studio

引導 AI 代理規劃、製作或剪輯「Manim Motion Studio」專案,產出節拍表與分鏡表。適用於需要此類動畫製作的新任務。

manim-motion-studio 是什麼?

此技能為 AI 代理(如 Claude Code、Cursor 等)提供一套完整的程序化動畫與影片製作工作流程,基於 Manim Community 引擎、ffmpeg 及模組化 Python 套件。它不僅包含可依需求選擇的安裝腳本(`scripts/setup_manim.sh`),避免相依性衝突,還涵蓋從 Notion 讀取腳本、選擇場景類別、使用模板快速預覽、最終渲染與 AI 後製(如自動字幕、鏡頭重構、節拍偵測)的完整流程。技能文件詳細列出了多個領域的能力矩陣(如動態圖形、角色骨架、3D 場景、資料視覺化),並提供兩個關鍵腳本 `scripts/render.py` 和 `scripts/video_edit.py` 的具體命令範例,以及與 Notion 生產力工具的同步指令(`scripts/notion_sync.py`)。最後,它還強調了常見的陷阱與注意事項,幫助使用者繞過容易出錯的配置,確保渲染品質與工作流程穩定。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Japheth234-14/animatedVidEd-skill/tree/HEAD/manim-motion-studio

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Manim Motion Studio

使用 Manim Community、ffmpeg 和模組化 Python 媒體套件,建立清晰流暢的 60fps 程序化動畫、執行 AI 輔助影片編輯管線,並將影片製作與 Notion 同步。

模組化安裝 (scripts/setup_manim.sh)

僅安裝您需要的設定檔,以避免不相容的 GUI、CV 或 3D 相依性衝突:

bash scripts/setup_manim.sh core     # manim + imageio-ffmpeg + pillow + numpy + scipy
bash scripts/setup_manim.sh editing  # + av, moviepy, scenedetect, opencv-headless, faster-whisper, pydub
bash scripts/setup_manim.sh plugins  # + manim-slides, manim-physics, manim-voiceover
bash scripts/setup_manim.sh vision   # + opencv-python-headless, mediapipe, scikit-image
bash scripts/setup_manim.sh audio    # + librosa, pydub, soundfile, faster-whisper
bash scripts/setup_manim.sh notion   # + notion-client
bash scripts/setup_manim.sh full     # 完整無衝突堆疊 (Manim + AI 編輯 + 外掛 + Notion)

如果系統缺少 ffmpeg,scripts/setup_manim.sh 會將 imageio_ffmpeg 的內建二進位檔建立符號連結到 /tmp/bin/ffmpeg,而 scripts/render.py 和 scripts/video_edit.py 都會自動將其加入 PATH。

無 LaTeX 可攜性規則: 最小化 pip install manim 環境不包含 pdflatex。請務必在標籤中使用 Text / MarkupText,並在 Axes、BarChart 和 ThreeDAxes 中傳遞 label_constructor=Text(在 axis_config={"label_constructor": Text} 內),除非您已確認安裝了 latex 和 dvisvgm 以使用 MathTex/Tex。

工作流程

  1. 從 Notion 提取摘要、腳本或資料(透過已連接的 Notion 應用程式或 scripts/notion_sync.py),當您從工作區的分鏡腳本或 KPI 表格開始工作時。
  2. 從下方能力矩陣選擇正確的 Scene 類別與套件(快速堆疊請參考 references/python-motion-ecosystem.md,完整 18 節目錄請參考 references/python-animation-library-catalogue.md)。
  3. 從 templates/ 中的驗證模板開始,或結合 references/ 中的模式。
  4. 以草稿品質快速預覽(--quality draft),在進行完整 60fps 渲染前確認時間軸、佈局、相機追蹤及構圖。
  5. 使用 scripts/render.py 以目標長寬比渲染(切勿同時使用 -qh 與自訂 -r 尺寸)。
  6. 使用 scripts/video_edit.py 進行編輯、字幕、重構、混音與匯出(combine, detect-scenes, auto-captions, burn-subtitles, smart-reframe, beat-markers, duck-audio, mux-audio, overlay, trim, speed, gif, probe)。
  7. 透過 ffmpeg 視覺檢查萃取影格,然後交付最終的 .mp4 或 .gif,並將渲染記錄回 Notion。

能力矩陣

領域核心類別、動畫與工具參考 / 模板
動態圖形與相機MovingCameraScene, ZoomedScene, self.camera.frame, LaggedStart, MarkupText, rate_functions, 分層發光描邊references/motion-graphics-camera.mdtemplates/motion_graphics_camera.py
描邊繪製與變形Create, DrawBorderThenFill, Write, ShowPassingFlash, VMobject 貝茲路徑, SVGMobject, TransformMatchingShapes, Homotopyreferences/stroke-drawing-morphing.mdtemplates/stroke_drawing_morphing.py
UI 載入器、微互動與展示影片20 種 UI 載入器(彈跳球、液體填充、骨架/文字微光、軌道、輪幅/漸層轉圈、追逐方塊、電池),macOS 瀏覽器 chrome,漸進式檢查清單,5×4 同時 Bento 網格references/loaders-and-ui-microinteractions.mdtemplates/loaders_and_microinteractions.py
關節角色與自訂背景2 關節 FK/IK 角色骨架、擠壓與拉伸、眨眼/表情、多幕 ValueTracker 時間軸、dt 安全的相機追蹤、ImageMobject 紙張/桌面場景、背景人物去除references/character-rigging-and-backgrounds.mdtemplates/character_rig_scene.py
3D 場景與曲面ThreeDScene, ThreeDAxes, Surface, move_camera, begin_ambient_camera_rotation, add_fixed_in_frame_mobjectsreferences/3d-charts-physics-hybrid.mdtemplates/three_d_showcase.py
資料視覺化與圖表Axes, BarChart, NumberPlane, AnnularSector, get_riemann_rectangles, ValueTracker + always_redraw 即時計數器references/3d-charts-physics-hybrid.mdtemplates/data_viz_dashboard.py
程式碼、數學、物理與圖論Code, Table, Brace, SurroundingRectangle, apply_matrix, ComplexPlane, ArrowVectorField, StreamLines, Graph/DiGraph, add_updater(mob, dt)references/3d-charts-physics-hybrid.mdtemplates/math_code_and_diagrams.py
混合照片 / CV 影片ImageMobject + OpenCV (cv2.inpaint, cv2.remap float32) + MediaPipe FaceLandmarker/HandLandmarkerreferences/3d-charts-physics-hybrid.md
更廣泛的 Python 動畫生態系manim-slides, manim-physics, manim-voiceover, av, moviepy, lottie, cairosvg, pytweening, pymunk, transitions, bpy/pyvista, 相容性矩陣references/python-motion-ecosystem.md
完整動畫函式庫目錄18 節目錄:數學/解說、2D/遊戲、創意程式設計、向量/SVG、影片編輯、CV/AI、3D、物理、圖表、GUI、說故事、緩動、音訊、輔助工具、pip 索引、警告、目標組合、核心堆疊references/python-animation-library-catalogue.md
影片編輯與 AI 後期製作scripts/video_edit.py, detect-scenes (PySceneDetect), auto-captions (faster-whisper), burn-subtitles, smart-reframe (OpenCV 追蹤), beat-markers (librosa), duck-audio, xfade 合併, 混合長寬比模糊填充, 透明 .mov 疊層, GIFreferences/video-editing-postprod.mdscripts/video_edit.py
Notion 製作工作流程已連接的 Notion 應用程式 + scripts/notion_sync.py:搜尋、讀取摘要/分鏡腳本、將資料庫指標匯出為 JSON 以用於 Manim 圖表、建立分鏡腳本頁面、更新狀態、記錄渲染的 MP4 中繼資料、附加區塊與留言references/notion-video-workflows.mdscripts/notion_sync.py

基本渲染、影片編輯與 Notion 指令

渲染 Manim 場景 (scripts/render.py)

# 快速草稿預覽(半解析度 15fps)
python3 scripts/render.py templates/character_rig_scene.py CharacterRigShowcase --quality draft

# 完整 1080p60 16:9 渲染
python3 scripts/render.py templates/stroke_drawing_morphing.py StrokeMorphShowcase --quality high

# 直式 9:16 (1080x1920), 3:4 (1080x1440), 或方形 1:1 (1080x1080) 60fps
python3 scripts/render.py my_scene.py MyScene --preset portrait --quality high
python3 scripts/render.py my_scene.py MyScene --preset square --quality high

# 透明疊層(含 Alpha 通道的 .mov,用於合成至影片上)
python3 scripts/render.py lower_third.py LowerThird --transparent --quality high

編輯、字幕、重構與組合影片 (scripts/video_edit.py)

# 檢查任何影片片段
python3 scripts/video_edit.py probe clip1.mp4 clip2.mp4

# 混合長寬比片段,使用 0.5 秒淡入淡出與模糊環繞寬螢幕填充
python3 scripts/video_edit.py combine clip1.mp4 square_clip.mp4 -o Combined.mp4 --preset landscape --xfade 0.5 --bg-mode blur

# AI 編輯:鏡頭偵測、Whisper 自動字幕、字幕燒錄、智慧 9:16 重構、節拍同步、音訊閃避
python3 scripts/video_edit.py detect-scenes raw.mp4 --out scenes.json --split-dir shots/
python3 scripts/video_edit.py auto-captions talk.mp4 -o captions.srt --json-out words.json --words
python3 scripts/video_edit.py burn-subtitles talk.mp4 --srt captions.srt -o captioned.mp4
python3 scripts/video_edit.py smart-reframe wide.mp4 -o reel_9x16.mp4 --preset portrait
python3 scripts/video_edit.py beat-markers music.mp3 --out beats.json
python3 scripts/video_edit.py duck-audio video.mp4 --voice narration.mp3 --music bgm.mp3 -o mixed.mp4

# 修剪、速度曲線、合成透明 Manim 疊層、混入音訊、或匯出 GIF
python3 scripts/video_edit.py trim in.mp4 -o cut.mp4 --start 2.0 --end 14.5
python3 scripts/video_edit.py speed in.mp4 -o fast.mp4 --factor 1.5
python3 scripts/video_edit.py overlay base.mp4 overlay.mov -o out.mp4
python3 scripts/video_edit.py mux-audio video.mp4 music.mp3 -o final.mp4 --volume 0.35 --fade-out 1.5
python3 scripts/video_edit.py gif final.mp4 -o preview.gif --fps 24 --width 720

與 Notion 同步 (scripts/notion_sync.py 或已連接的 Notion 應用程式)

export NOTION_TOKEN="ntn_..."
python3 scripts/notion_sync.py search "Video Roadmap"
python3 scripts/notion_sync.py read-page <PAGE_ID> --out brief.md
python3 scripts/notion_sync.py query-db <DB_ID> --out metrics.json
python3 scripts/notion_sync.py create-page --parent-db <DB_ID> --title "Launch Reel" --status "Draft" --body-file storyboard.md
python3 scripts/notion_sync.py update-status <PAGE_ID> --prop Status --value "Rendered"
python3 scripts/notion_sync.py log-render <PAGE_ID> --video out.mp4 --notes "1080p60 final"

關鍵陷阱

  • -qh 會重設自訂尺寸: 渲染直式(1080x1920、1080x1440)或方形(1080x1080)場景時,切勿傳遞 -qh;請使用 scripts/render.py --preset ... 或 -r WIDTH,HEIGHT --fps 60,並在 construct() 中將 self.camera.frame_width / frame_height 設為與目標長寬比相符。
  • 僅使用無衝突安裝: 切勿混合 opencv-python + opencv-python-headless、pygame + pygame-ce、manim + manimgl,或 pip install ffmpeg(請使用 imageio-ffmpeg / 系統二進位檔)。
  • faster-whisper 音訊解碼: 在傳遞給 WhisperModel.transcribe(...) 之前,務必先透過 ffmpeg 將音訊預先解碼為 16 kHz 單聲道 float32(video_edit.py auto-captions 會自動處理此步驟)。
  • MovingCameraScene 相機更新器: 務必在 self.camera.frame.add_updater(track_cam) 之前呼叫 self.add(self.camera.frame),並使用基於 dt 的平滑處理(1.0 - np.exp(-k * dt)),以便 15fps 草稿與 60fps 渲染的追蹤行為一致。
  • 旋轉角色臀部錨點: 當 abs(body_spin) > 0.02 時,切勿計算 hip_h = -min(l_foot_y, r_foot_y);在 360°/720° 翻轉期間保持固定的直立 hip_h,以免頭部陷入地板。
  • AnnularSector 中心放置: 直接傳遞 arc_center=center,而不是使用 .move_to(center)(後者會對齊邊界框中心)。
  • ffmpeg xfade 時間基準: 在鏈結 xfade 之前,將 fps=60,settb=1/60,format=yuv420p 放置在每個輸入分支的末端(特別是在 overlay 之後)。
  • 3D HUD 與零 LaTeX 軸: 在 ThreeDScene 中,對 2D HUD 元素呼叫 self.add_fixed_in_frame_mobjects(...);在 Axes、BarChart 和 ThreeDAxes 中傳遞 axis_config={"label_constructor": Text}。

相關技能