Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An error is reported when exporting a video at a specified frame rate #2313

Open
Velvet0314 opened this issue Feb 18, 2025 · 2 comments
Open
Labels

Comments

@Velvet0314
Copy link

When using the command-line arguments with --fps, a type error occured.

Here is the bug report below.

Code:

(manim) PS C:\Documents\Github\Repo\manim> manimgl test.py TextExample -r "1920x1080" --fps 60 --clear-cache -ow 
ManimGL v1.7.2
TextExample.mp4                         : : 0it [00:00, ?it/s]Traceback (most recent call last):
  File "C:\Application\Anaconda3\envs\manim\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Application\Anaconda3\envs\manim\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Application\Anaconda3\envs\manim\Scripts\manimgl.exe\__main__.py", line 7, in <module>
    sys.exit(main())
  File "C:\Documents\Github\Repo\manim\manimlib\__main__.py", line 61, in main
    run_scenes()
  File "C:\Documents\Github\Repo\manim\manimlib\__main__.py", line 39, in run_scenes
    scene.run()
  File "C:\Documents\Github\Repo\manim\manimlib\scene\scene.py", line 155, in run
    self.construct()
  File "C:\Documents\Github\Repo\manim\test.py", line 18, in construct
    self.play(Write(text))
  File "C:\Documents\Github\Repo\manim\manimlib\scene\scene.py", line 321, in wrapper
    func(self, *args, **kwargs)
  File "C:\Documents\Github\Repo\manim\manimlib\scene\scene.py", line 586, in play
    self.progress_through_animations(animations)
  File "C:\Documents\Github\Repo\manim\manimlib\scene\scene.py", line 551, in progress_through_animations
    for t in self.get_animation_time_progression(animations):
  File "C:\Documents\Github\Repo\manim\manimlib\scene\scene.py", line 499, in get_animation_time_progression
    time_progression = self.get_time_progression(run_time, desc=description)
  File "C:\Documents\Github\Repo\manim\manimlib\scene\scene.py", line 471, in get_time_progression
    times = np.arange(0, run_time, 1 / self.camera.fps) + 1 / self.camera.fps
TypeError: unsupported operand type(s) for /: 'int' and 'str'

And I locate the error in manimlib\scene\scene.py , line 471:

    def get_time_progression(
        self,
        run_time: float,
        n_iterations: int | None = None,
        desc: str = "",
        override_skip_animations: bool = False
    ) -> list[float] | np.ndarray | ProgressDisplay:
        if self.skip_animations and not override_skip_animations:
            return [run_time]

        times = np.arange(0, run_time, 1 / self.camera.fps) + 1 / self.camera.fps

I tried typecasting, and then it can work well. Hope an official fixed version!

add this line:

self.camera.fps = int(self.camera.fps)

    def get_time_progression(
        self,
        run_time: float,
        n_iterations: int | None = None,
        desc: str = "",
        override_skip_animations: bool = False
    ) -> list[float] | np.ndarray | ProgressDisplay:
        if self.skip_animations and not override_skip_animations:
            return [run_time]

        self.camera.fps = int(self.camera.fps) # typecasting
        
        times = np.arange(0, run_time, 1 / self.camera.fps) + 1 / self.camera.fps
@Velvet0314 Velvet0314 added the bug label Feb 18, 2025
@mitkonikov
Copy link
Contributor

Is this issue fixed with #2299 ?

@Velvet0314
Copy link
Author

Is this issue fixed with #2299 ?

I haven't got the latest pull. But it's just a tiny problem. I think with #2299 , it can work well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants