3b1b / 3b1b/manim

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

Đang mở
#2,313 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
Python
Star
93.8k
Fork
7.7k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

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

Here is the bug report below.

**Code**:

```bash
(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
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:

```python
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)

```python
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
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.