Open
Description
Describe the bug
I was hitting the following error with VideoRecorder:
Moviepy - Building video /path/to/video/best-episode-0.mp4.
Moviepy - Writing video /path/to/video/best-episode-0.mp4
Process Process-1:
Traceback (most recent call last):
File "/path/to/python/multiprocessing/process.py", line 314, in _bootstrap
self.run()
File "/path/to/python/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/path/to/project/scripts/common/recorder.py", line 76, in record_video_worker
video_recorder.stop_recording()
File "/path/to/python/site-packages/gymnasium/wrappers/rendering.py", line 407, in stop_recording
clip.write_videofile(path, logger=moviepy_logger)
File "/path/to/python/site-packages/decorator.py", line 235, in fun
return caller(func, *(extras + args), **kw)
File "/path/to/python/site-packages/moviepy/decorators.py", line 54, in requires_duration
return f(clip, *a, **k)
File "/path/to/python/site-packages/decorator.py", line 235, in fun
return caller(func, *(extras + args), **kw)
File "/path/to/python/site-packages/moviepy/decorators.py", line 135, in use_clip_fps_by_default
return f(clip, *new_a, **new_kw)
File "/path/to/python/site-packages/decorator.py", line 235, in fun
return caller(func, *(extras + args), **kw)
File "/path/to/python/site-packages/moviepy/decorators.py", line 22, in convert_masks_to_RGB
return f(clip, *a, **k)
File "/path/to/python/site-packages/moviepy/video/VideoClip.py", line 300, in write_videofile
ffmpeg_write_video(self, filename, fps, codec,
File "/path/to/python/site-packages/moviepy/video/io/ffmpeg_writer.py", line 213, in ffmpeg_write_video
with FFMPEG_VideoWriter(filename, clip.size, fps, codec = codec,
File "/path/to/python/site-packages/moviepy/video/io/ffmpeg_writer.py", line 88, in __init__
'-r', '%.02f' % fps,
TypeError: must be real number, not NoneType
I noticed my moviepy was on an older 1.0 version. Upgrading to latest fixed the issue.
I think VideoRecorder may not be compatible with some or all moviepy 1.0 versions. We should bump the minimum version number in the pyproject.yaml.
Code example
video_recorder: RecordVideo = env.wrap(
lambda env: RecordVideo(
env,
os.path.join(task.agent_path, "videos"),
episode_trigger=lambda episode: True,
disable_logger=True,
fps=50,
name_prefix=task.name,
)
)
# run the environment until the episode finishes
System info
Name: gymnasium
Version: 1.0.0
Ubuntu 22.04
Additional context
This is probably what caused #882, which was closed because the user wasn't able to reproduce (possibly after inadvertently upgrading?)
Checklist
- I have checked that there is no similar issue in the repo