Interface IVideoWriter
Encodes one video from rendered frames (decision DR-25): what RecordVideo and SaveVideo(IReadOnlyList<NDArray>, string, Func<long, bool>?, Func<long, bool>?, long?, string, long, long, string?, double?, IVideoWriter?)
hand their frames to, where Gymnasium hands them to moviepy. Implement it to store videos another way.
public interface IVideoWriter
- Extension Methods
Remarks
PngVideoWriter (the default) writes each video as a folder of PNG frames, with no external program;
FfmpegVideoWriter pipes the frames to ffmpeg for an mp4 like Gymnasium's. Parity with
Gymnasium is on the frames handed over, never on the encoded bytes.
Properties
Extension
What the writer appends to a video's path: .mp4 for a file, or the empty string for a folder named like
Gymnasium's video file without its extension.
string Extension { get; }
Property Value
Methods
Write(string, IReadOnlyList<NDArray>, double)
Writes one video, replacing a video already at that path.
void Write(string path, IReadOnlyList<NDArray> frames, double fps)
Parameters
pathstringThe video's path without extension: Gymnasium's
{video_folder}/{name}, the folder existing.framesIReadOnlyList<NDArray>The frames in order,
(H, W, 3)RGB (or(H, W, 4),(H, W)); they stay the caller's.fpsdoubleThe frame rate.
Exceptions
- ArgumentException
Thrown for no frames, or frames of different shapes.