Manim 按 media/videos/脚本名/{画质}/ 组织成片,默认画质档是 1080p60,用 -ql 调试时才落到 480p15。要改输出位置,可以传 --media_dir,也可以在脚本里改 config.media_dir;示例在画面上标出默认路径,配合文章里的命令一起看。

完整代码

1
2
3
4
5
6
7
8
9
10
11
from manim import *

class OutputDirectories(Scene):
def construct(self):
path = Text("media/videos/scene/1080p60/", font_size=30)
label = Text("default output folder", font_size=24, color=GREY)
VGroup(path, label).arrange(DOWN, buff=0.35)
self.play(Write(path), FadeIn(label))
self.wait(0.5)
self.play(path.animate.set_color(YELLOW))
self.wait(1)

演示视频

下载 Python 脚本

要点

  • --media_dir 是命令行参数,优先级高于配置文件
  • 脚本内改 config.media_dir 要在创建 Scene 之前生效
  • -o 可自定义输出文件名,--dry_run 只走流程不写文件

代码来源:Manim Community 官方教程 Tutorials / Manim’s Output Settings,示例代码按 Manim CE 0.20.1 编写并实跑验证。