Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Principle:Farama Foundation Gymnasium Video Recording

From Leeroopedia
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: {0,1,8,27,,k3,,729,1000,2000,}.

Related Pages

Implemented By

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment