基于Remotion的AI视频生成工具——一种以设计系统优先的方法来创建专业多平台视频
chuk-motion 是一个基于MCP(模型上下文协议)的服务器,它将Remotion的视频生成能力带给了像Claude这样的AI助手。它提供了一种设计系统优先的方法,通过全面的设计令牌,使AI能够创建优化用于YouTube、TikTok、LinkedIn、Instagram Stories等平台的专业动画视频。
颜色 (tokens/colors.py)
on_dark, on_light)字体 (tokens/typography.py)
间距 (tokens/spacing.py) ⭐ 新增
运动 (tokens/motion.py)
确保您的内容不会被平台UI裁剪:
| 平台 | 上 | 下 | 左 | 右 | 备注 |
|---|---|---|---|---|---|
| LinkedIn Feed | 40px | 40px | 24px | 24px | 推荐8-24px安全区 |
| Instagram Stories | 100px | 120px | 24px | 24px | 上下有UI覆盖 |
| TikTok | 100px | 180px | 24px | 80px | 右侧有按钮 |
| YouTube | 20px | 20px | 20px | 20px | 标准边距 |
| 移动垂直 | 80px | 100px | - | - | 9:16格式 |
| 移动水平 | - | - | 24px | 24px | 16:9格式 |
| Instagram Square | 32px(四边) | - | - | - | 1:1格式 |
所有图表都支持设计令牌和流畅动画:
适用于多平台内容的专业视频布局:
受ReactBits启发的动态文本效果:
真实的UI模拟和演示:
总计:51个生产就绪组件 - 所有组件均使用设计令牌,并具有全面的测试覆盖率!
# 克隆仓库
git clone https://github.com/chrishayuk/chuk-motion.git
cd chuk-motion
# 使用uv安装依赖(推荐)
uv pip install -e .
# 或使用pip
pip install -e .
# Remotion会根据项目自动安装
# MCP服务器在生成项目时处理此操作
STDIO模式(用于Claude Desktop):
python -m chuk_motion.server stdio
HTTP模式(用于测试/开发):
python -m chuk_motion.server http --port 8000
# 通过MCP工具
remotion_create_project(
name="my_video",
theme="tech",
fps=30,
width=1920,
height=1080
)
# 添加标题场景
remotion_add_title_scene(
text="欢迎来到AI视频",
subtitle="使用设计令牌创建",
variant="bold",
animation="fade_zoom",
duration="3s"
)
# 添加带有安全边距的图表
remotion_add_pie_chart(
data='[{"label": "AI", "value": 40}, {"label": "ML", "value": 30}]',
title="技术分布",
duration="4s",
gap_before="1s" # 支持时间字符串!
)
# 添加带有打字动画的代码
remotion_add_typing_code(
code="console.log('Hello, World!');",
language="javascript",
title="示例代码",
typing_speed="medium",
duration="5s"
)
# 添加图像
remotion_add_image_content(
src="https://picsum.photos/1920/1080",
fit="cover",
duration="3s"
)
cd remotion-projects/my_video
npm install
npm start # 浏览器预览
npm run build # 渲染为MP4
examples/ 目录包含生产就绪的演示:
# 完整设计系统展示(90秒)
python examples/design_system_showcase.py
# 平台安全边距演示(60秒)
python examples/safe_margins_demo.py
# 探索所有设计令牌
python examples/explore_design_system.py
# 完整文本动画展示(52.5秒)
python examples/all_text_animations_demo.py
# 图像布局展示 - 17个示例(127秒)
python examples/image_layouts_showcase.py
# 内容展示 - 所有5个内容组件
python examples/content_showcase.py
# 斐波那契代码打字演示
python examples/fibonacci_demo.py
所有示例均使用ProjectManager API和基于轨道的时间轴系统。
remotion_create_project(name, theme, fps, width, height) - 创建新项目remotion_get_project_info() - 获取当前项目信息remotion_list_projects() - 列出所有项目remotion_add_pie_chart(data, title, duration, track, gap_before)remotion_add_bar_chart(data, title, duration, track, gap_before)remotion_add_horizontal_bar_chart(data, title, duration, track, gap_before)remotion_add_line_chart(data, title, xlabel, ylabel, duration, track, gap_before)remotion_add_area_chart(data, title, duration, track, gap_before)remotion_add_donut_chart(data, title, duration, track, gap_before)remotion_add_title_scene(text, subtitle, variant, animation, duration, track, gap_before)remotion_add_end_screen(cta_text, variant, duration, track, gap_before)remotion_add_lower_third(name, title, variant, position, duration, track, gap_before)remotion_add_text_overlay(text, style, animation, position, duration, track, gap_before)remotion_add_subscribe_button(animation, position, duration, track, gap_before)remotion_add_code_block(code, language, title, variant, animation, show_line_numbers, duration, track, gap_before)remotion_add_typing_code(code, language, title, variant, cursor_style, typing_speed, show_line_numbers, duration, track, gap_before)remotion_add_grid(children, layout, duration, track, gap_before)remotion_add_container(content, border, duration, track, gap_before)remotion_add_split_screen(left, right, variant, duration, track, gap_before)remotion_add_counter(start_value, end_value, prefix, suffix, decimals, animation, duration, track, gap_before)remotion_add_typewriter_text(text, font_size, font_weight, text_color, cursor_color, show_cursor, type_speed, position, align, duration, track, gap_before)remotion_add_stagger_text(text, font_size, font_weight, text_color, stagger_by, stagger_delay, animation_type, position, align, duration, track, gap_before)remotion_add_wavy_text(text, font_size, font_weight, text_color, wave_amplitude, wave_speed, wave_frequency, position, align, duration, track, gap_before)remotion_add_true_focus(text, font_size, font_weight, text_color, word_duration, position, duration, track, gap_before)remotion_add_decrypted_text(text, font_size, font_weight, text_color, reveal_direction, scramble_speed, position, duration, track, gap_before)remotion_add_fuzzy_text(text, font_size, font_weight, text_color, glitch_intensity, animate, position, duration, track, gap_before)remotion_list_components(category) - 列出可用组件remotion_search_components(query) - 搜索组件remotion_get_component_schema(name) - 获取组件详情remotion_list_themes() - 列出可用主题remotion_get_theme_info(name) - 获取主题详情remotion_list_color_tokens() - 配色方案remotion_list_typography_tokens() - 字体系统remotion_list_motion_tokens() - 动画设计remotion_list_spacing_tokens() ⭐ 新增 - 间距和安全边距remotion_get_info() - 服务器信息和统计所有持续时间和定时参数支持灵活的时间字符串:
# 字符串格式
duration="2s" # 2秒
duration="500ms" # 500毫秒
duration="1.5s" # 1.5秒
duration="1m" # 1分钟(60秒)
gap_before="1s" # 1秒间隔
gap_before="250ms" # 250毫秒间隔
# 浮点格式仍然有效
duration=2.0
gap_before=0.5
时间轴采用专业的多轨道方法:
# 主轨道:自动堆叠
remotion_add_title_scene(...) # 从0秒开始
remotion_add_pie_chart(...) # 自动堆叠在标题之后
remotion_add_bar_chart(...) # 自动堆叠在饼图之后
# 覆盖层轨道:顶部叠加
remotion_add_text_overlay(..., track="overlay", align_to="main", offset=5.0)
# 背景轨道:位于主要内容后面
remotion_add_background(..., track="background")
默认轨道:
main(第0层)- 主要内容,自动堆叠,间隔0.5秒overlay(第10层)- 文本覆盖层,UI元素background(第-10层)- 背景媒体现代科技美学,蓝色/青色调色板