# Recording videos with multiagent env

**URL:** <https://discuss.ray.io/t/recording-videos-with-multiagent-env/3307>\
**Category:** RLlib\
**Created:** [August 21, 2021, 2:25pm UTC](https://discuss.ray.io/t/recording-videos-with-multiagent-env/3307 "2021-08-21T14:25:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![PavelC](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/pavelc/32/1049_2.png) [@PavelC](https://discuss.ray.io/u/PavelC)\
**Post date:** [August 21, 2021, 2:25pm UTC](https://discuss.ray.io/t/recording-videos-with-multiagent-env/3307/1 "2021-08-21T14:25:28Z")

</div>

I’m working on getting saving videos to work in multiagent envs.  
I have tried the example [env\_rendering\_and\_recording.py](https://github.com/ray-project/ray/blob/master/rllib/examples/env_rendering_and_recording.py) from the newest stable release and nightly. It correctly creates videos in the single-agent setting. However, once I activate the flag `--multi-agent` the video folder is created but not videos are created inside.  
Can anybody reproduce this? Am I doing something wrong? I’m just running the example code unmodified.

---

<div class="post-metadata">

**Author:** ![PavelC](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/pavelc/32/1049_2.png) [@PavelC](https://discuss.ray.io/u/PavelC)\
**Post date:** [August 21, 2021, 4:12pm UTC](https://discuss.ray.io/t/recording-videos-with-multiagent-env/3307/2 "2021-08-21T16:12:05Z")

</div>

After further fixes I found the problem:  
`MultiAgentCustomRenderedEnv` does not have metadata, while `CustomRenderedEnv` has

```auto
metadata = {
    "render.modes": ["rgb_array"],
}

```

which is necessary for recording to take place.  
I inserted `MultiAgentCustomRenderedEnv.metadata = CustomRenderedEnv.metadata` in line 94 as a workaround and now videos are correctly generated.

---

<div class="post-metadata">

**Author:** ![sven1977](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sven1977/32/53_2.png) [@sven1977](https://discuss.ray.io/u/sven1977)\
**Post date:** [August 23, 2021, 7:09am UTC](https://discuss.ray.io/t/recording-videos-with-multiagent-env/3307/3 "2021-08-23T07:09:54Z")

</div>

Awesome @PavelC , thanks for posting the solution here. Great catch! Could you create a fix-it PR with the suggested changes and assign me on the PR?

---

<div class="post-metadata">

**Author:** ![PavelC](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/pavelc/32/1049_2.png) [@PavelC](https://discuss.ray.io/u/PavelC)\
**Post date:** [August 27, 2021, 1:40pm UTC](https://discuss.ray.io/t/recording-videos-with-multiagent-env/3307/4 "2021-08-27T13:40:35Z")

</div>

Sure, I’ll see to it that I open a PR.
