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

Option to save frames to disk in video recorder #715

Merged

Conversation

rk1a
Copy link

@rk1a rk1a commented Sep 17, 2023

Description

  • Adds constructor flag frames_to_disk to VideoRecorder and RecordVideo wrapper. Disabled by default.
  • If enabled write frames to image files in subfolder of video_folder. This step depends on imageio.
  • On closing the video recorder frames are loaded on the fly by moviepy reducing the memory footprint.
  • Saved frames are deleted after the video has been created.

Fixes #714

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I have run the pre-commit checks with pre-commit run --all-files (see CONTRIBUTING.md instructions to set it up)
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Copy link
Member

@pseudo-rnd-thoughts pseudo-rnd-thoughts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are removing monitoring/video_recorder in v1.0.0 to RecordVideo wrapper. Could you update the PR to use branch v1.0.0 and include a docstring example

@rk1a rk1a force-pushed the save-disk-video-recorder branch from 56229c4 to 1391640 Compare September 18, 2023 21:11
@rk1a rk1a changed the base branch from main to v1.0.0 September 18, 2023 21:12
Copy link
Member

@pseudo-rnd-thoughts pseudo-rnd-thoughts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing, thanks.
I'm impressed that we don't need to change the clip saving needs to be changed and the moviepy works with a list of strings

@pseudo-rnd-thoughts
Copy link
Member

For some reason the CI isn't running / showing up, therefore, I'm going to approve and see if it passes

@pseudo-rnd-thoughts pseudo-rnd-thoughts merged commit 16f3a4e into Farama-Foundation:v1.0.0 Sep 20, 2023
@pseudo-rnd-thoughts
Copy link
Member

@rk1a Could you make a follow up PR that fixes the CI issues? https://github.com/Farama-Foundation/Gymnasium/actions/runs/6248041856

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

Successfully merging this pull request may close these issues.

[Proposal] Option to read/write frames to disk in VideoRecorder
2 participants