I've read through the whole readme and the docs and the FAQ and I can't actually find an explanation of how to export the render to a video file.
I don't even know where to look for help on this. Is this a gym thing? If I'm running a keras-rl example then is this a Keras thing? Or is this something for the particular algorithm I'm choosing from keras? Or is this something for each environment (e.g. cartpole)? The FAQ or README should explain the interaction between these libraries better. I'm quite lost.
A lot of issues for gym seem to be about exporting video, but none of them contain MWEs.
This part of the README is too brief. (e.g. how do I specify a filename?)
Ah, I kind of figured it out. A bit. (It only exports some runs, and I don't know how to export as a GIF)
I just updated the FAQ with what I know.
Can someone check what I wrote, or add to it?
@mlda065 It's kinda lengthy but I found a way to export as video. To your training code add:
(I've done this for CartPole-v0)
env_to_wrap = gym.make('CartPole-v0')
env = wrappers.Monitor(env_to_wrap, 'your directory here', force = True)
observation = env.reset()
env.close()
env_to_wrap.close()
Writing force = True replaces your existing recording with current recording in the mentioned directory.
Hope that clears :)
Thanks for updating the wiki @mlda065!
Most helpful comment
@mlda065 It's kinda lengthy but I found a way to export as video. To your training code add:
(I've done this for CartPole-v0)
env_to_wrap = gym.make('CartPole-v0')env = wrappers.Monitor(env_to_wrap, 'your directory here', force = True)observation = env.reset()env.close()env_to_wrap.close()Writing
force = Truereplaces your existing recording with current recording in the mentioned directory.Hope that clears :)