Principle:Farama Foundation Gymnasium Video Frame Saving
| Knowledge Sources | |
|---|---|
| Domains | Reinforcement_Learning, Visualization |
| Last Updated | 2026-02-15 03:00 GMT |
Overview
A utility pattern for converting lists of rendered frames into video files for post-hoc visualization of environment episodes.
Description
Video Frame Saving takes pre-collected render frames (typically from render_mode="rgb_array_list") and assembles them into video files. Unlike the RecordVideo wrapper which records during live interaction, this approach enables post-hoc video creation from buffered frames.
This is useful when:
- Recording decisions are made after the episode completes
- Frames need custom processing before saving
- Integration with custom rendering pipelines
Usage
Use save_video when you have pre-collected frames (e.g., from env.render() with rgb_array_list mode) and want to save them after the episode ends. This provides more control than the RecordVideo wrapper.
Theoretical Basis
Post-hoc frame assembly:
# Abstract algorithm
frames = []
for step in episode:
frames = env.render() # Accumulates with rgb_array_list
if should_save(episode):
video = create_clip(frames, fps)
video.write(path)