Communitygithub.com

manim-motion-studio

指导智能体如何规划、构建或剪辑 "Manim Motion Studio" 动画,最终输出节拍表和镜头列表。工作流程涵盖 Manim Motion Studio、模块化安装脚本 (`scripts/setup_manim.sh`) 以及工作流。适合在需要进行此类创作的新任务时使用。

manim-motion-studio 是什么?

Manim Motion Studio 是一个为 AI 智能体设计的技能,专门用于构建 60fps 的程序化动画、运行 AI 辅助视频编辑流水线,并将视频制作与 Notion 同步。它基于 Manim Community、ffmpeg 和模块化的 Python 媒体包。 该技能通过 `scripts/setup_manim.sh` 提供了一整套模块化安装选项,可根据需要选择安装核心库、编辑工具、插件、计算机视觉、音频或 Notion 同步等不同模块,从而避免依赖冲突。工作流程从 Notion 拉取简报,选择合适的场景类和包,基于模板开始制作,然后通过 `scripts/render.py` 渲染视频,最后使用 `scripts/video_edit.py` 进行剪辑、添加字幕、智能重构图等后期处理。同时,`scripts/notion_sync.py` 可以将整个制作流程与 Notion 深度集成,实现任务跟踪和元数据记录。 本技能支持多种平台,包括 Claude Code、Cursor、Codex 等 AI 编码工具,开发者或 AI 智能体可以按照清晰的步骤和命令快速上手。它提供了一份全面的能力矩阵,覆盖运动图形、角色绑定、3D 场景、数据可视化、代码/数学演示、计算机视觉、视频剪辑与 AI 后期等多个领域,并附有参考文档和可运行模板。通过详细的“关键陷阱”说明,它帮助用户避免常见错误,确保渲染和剪辑流程的可靠性。总而言之,它是一个端到端的、面向 AI 智能体的专业动画与视频制作套件。

兼容平台~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 以了解快速堆栈,references/python-animation-library-catalogue.md 以了解完整的 18 个部分目录)。
  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 浏览器框架、渐进式检查清单、5×4 同时 Bento 网格references/loaders-and-ui-microinteractions.mdtemplates/loaders_and_microinteractions.py
关节角色动画与自定义背景双关节 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 中,调用 self.add_fixed_in_frame_mobjects(...) 来添加 2D HUD 元素;向 Axes、BarChart 和 ThreeDAxes 传递 axis_config={"label_constructor": Text}。

相关技能