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

How to record simulation movies? #26

Open
miyukin73 opened this issue Sep 30, 2022 · 2 comments
Open

How to record simulation movies? #26

miyukin73 opened this issue Sep 30, 2022 · 2 comments

Comments

@miyukin73
Copy link

Hello,

I am new to Mujoco but I could take a screenshot by referring to your program! Thank you very much.

However, I did not know how to take a video and would like to know how to do so.

I am sorry to trouble you with this, but thank you in advance for your time.

Thank you in advance.

@rpapallas
Copy link
Contributor

I don't think this is supported in this library currently. What I have been doing is to use an external tool that records my screen and just specify the MuJoCo window as the area to record. I know this can't be done asynchronously, but it's an option.

You could technically save multiple screenshots and bind them into a video (that's what a video is), but it will require some extra work on your part. But you could create a directory per video you want to record, save multiple screenshots (30fps for example) in there, then use ffmpeg to compile the pictures to a video. All this can be done in a bash script or even in Python if you wanted to:

  1. Save screenshots to dir
  2. Use subprocess.Popen to execute the ffmpeg command to compile to video.
  3. Delete the screenshots after the video is being created.

@saneeeee
Copy link

You can collect frames to an array with offscreen rendering and produce a video from the array using cv2.

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

No branches or pull requests

3 participants