Principle:Farama Foundation Gymnasium Video Recording
| Knowledge Sources | |
|---|---|
| Domains | Reinforcement_Learning, Visualization |
| Last Updated | 2026-02-15 03:00 GMT |
Overview
A monitoring pattern that captures rendered frames from RL environment episodes and saves them as video files for qualitative evaluation and debugging.
Description
Video Recording extends the environment wrapper pattern to capture rendered frames during agent interaction. Frames are collected from the environment's render() method (typically in rgb_array mode) and assembled into video files using MoviePy.
Recording can be controlled by:
- Episode triggers: Record every N-th episode, specific episodes, or use the capped cubic schedule
- Step triggers: Start recording at specific environment steps
- Video length: Fixed-length recordings or full episodes
Video recording is essential for:
- Qualitative evaluation: Visualizing agent behavior at different training stages
- Debugging: Identifying failure modes that statistics alone cannot reveal
- Communication: Sharing agent performance with stakeholders
Usage
Use video recording during evaluation phases of training to capture agent behavior. The environment must support render_mode="rgb_array" for frame capture. Recording is typically triggered at specific episodes or step intervals to avoid storage overhead.
Theoretical Basis
Frame capture at each environment step:
# Abstract algorithm
on_step():
if recording:
frame = env.render() # Returns RGB array
frames.append(frame)
if episode_done and recording:
save_video(frames, folder, fps)
frames = []
The capped cubic default schedule records at episodes: .