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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Saved video empty #294

Closed
chisarie opened this issue Jan 19, 2021 · 2 comments
Closed

[Bug] Saved video empty #294

chisarie opened this issue Jan 19, 2021 · 2 comments
Labels
bug Something isn't working openai gym related to OpenAI Gym interface

Comments

@chisarie
Copy link

馃悰 Bug

Hello.

Following this example from the documentation, a video file is generated, but it remains empty.

Can you also reproduce the problem? Or is it only an issue with my setup? Thank you very much for the help and for this nice library.

To Reproduce

import gym
from stable_baselines3.common.vec_env import VecVideoRecorder, DummyVecEnv

env_id = "CartPole-v1"
video_folder = "logs/videos/"
video_length = 100

env = DummyVecEnv([lambda: gym.make(env_id)])

obs = env.reset()

# Record the video starting at the first step
env = VecVideoRecorder(
    env,
    video_folder,
    record_video_trigger=lambda x: x == 0,
    video_length=video_length,
    name_prefix="random-agent-{}".format(env_id),
)

env.reset()
for _ in range(video_length + 1):
    action = [env.action_space.sample()]
    obs, _, _, _ = env.step(action)
# Save the video
env.close()

Expected behavior

The video should show the agent. It is empty instead.

###聽System Info

  • Describe how the library was installed:
conda create --name baselines3_env  
conda activate baselines3_env  
conda install python
pip install stable-baselines3[extra]  
pip install pybullet
  • Python version: 3.9.1
  • Gym version: 0.18.0
@chisarie chisarie added the bug Something isn't working label Jan 19, 2021
@araffin
Copy link
Member

araffin commented Jan 19, 2021

Hello,
this issue comes from gym apparently, see openai/gym#2139 and openai/gym#2145

Please upgrade to use the master version of gym ;)

@araffin araffin added the openai gym related to OpenAI Gym interface label Jan 19, 2021
@chisarie
Copy link
Author

It worked! Thank you very much Antonin :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working openai gym related to OpenAI Gym interface
Projects
None yet
Development

No branches or pull requests

2 participants