3b1b / 3b1b/manim

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

Aberta Para iniciantes
#2,313 2 comentários 0 reações 0 responsáveis Ver no GitHub
bug
Linguagem predominante
Python
Estrelas
93.9k
Forks
7.7k
Merge médio
2d 13h
PRs com merge (30d)
4

Descrição

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

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Direção de pesquisa

The error occurs in manimlib/scene/scene.py line 471 where self.camera.fps is a string when passed via --fps. Start by checking how command-line arguments are parsed and passed to the camera's fps attribute. Look for the argument parsing code, likely in __main__.py or config parsing, to see where fps is set. Then ensure fps is converted to an integer before use in get_time_progression. Test by running the provided command with the fix.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Domínio
cli
Tipo de issue
Bug
Dificuldade
2/5
Tempo estimado
1-3 horas
Status de atividade
Estagnada
Clareza
Claramente especificada
Facilidade para iniciantes
65/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.