You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Manim无法生成完整视频仅输出帧文件,Sideview插件报错求助

解决Manim Sideview仅生成帧不合成MP4的问题

1. 修正Manim Sideview扩展配置

  • 打开VS Code设置(快捷键Ctrl+,),搜索Manim Sideview
  • 找到Manim: Command选项,确保值为manim(而非manimgl——manimgl默认仅生成帧,不自动合成视频)
  • 检查Manim: Output Directory,建议留空让Manim自动匹配项目结构,避免路径配置冲突

2. 确认FFmpeg已安装并配置

Manim依赖FFmpeg完成帧到视频的合成,缺失会导致无法生成MP4:

  • 打开VS Code终端,输入ffmpeg -version,若提示命令不存在,需安装FFmpeg并添加到系统PATH
  • 安装后重启VS Code,再尝试预览动画

3. 修正代码中的更新器逻辑

你的代码中直接使用self.time存在版本兼容问题(Manim CE推荐使用self.get_time()),同时更新器需添加dt参数以符合规范,修改后代码如下:

from manim import *

class Mod3Clock(Scene):
    def construct(self):
        # Create the outer circle of the clock
        clock_circle = Circle(radius=2)
        self.play(Create(clock_circle))

        # Create the ticks and numbers
        for i in range(3):
            angle = i * 2 * PI / 3  # 0, 120, 240 degrees
            tick = Line(start=2.5 * np.array([np.cos(angle), np.sin(angle), 0]), 
                        end=2 * np.array([np.cos(angle), np.sin(angle), 0]))
            number = MathTex(f"{i}")
            number.move_to(1.5 * np.array([np.cos(angle), np.sin(angle), 0]))
            self.play(Create(tick), Write(number))

        # Create the hands of the clock
        hour_hand = Line(ORIGIN, 1 * UP, color=BLUE)
        hour_hand.add_updater(lambda h, dt: h.set_angle(-PI / 2 + (PI / 3) * self.get_time()))

        minute_hand = Line(ORIGIN, 1.5 * UP, color=RED)
        minute_hand.add_updater(lambda m, dt: m.set_angle(-PI / 2 + (2 * PI / 3) * self.get_time()))

        self.add(hour_hand, minute_hand)
        self.wait(9)  # Wait to show the hands moving

4. 用命令行测试排除扩展问题

如果以上步骤无效,直接用Manim命令行验证是否能生成视频:

  • 打开VS Code终端,进入Animations文件夹
  • 运行命令:
    manim -pql mod3_clock.py Mod3Clock
    
    若该命令能成功生成并预览MP4,说明问题出在Manim Sideview的配置,建议重置扩展设置或重新安装扩展

5. 避免路径中的特殊字符

你的项目路径包含空格和单引号(Yoyo's Tutoring),可能导致扩展解析路径出错,尝试将文件夹重命名为无特殊字符的名称(如YoyosTutoring)


内容的提问来源于stack exchange,提问作者Yoyos Tutoring

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.22 11:36:14