NatCorder
Search…
⌃K

GIFRecorder

class NatML.Recorders.GIFRecorder : IMediaRecorder
The GIFRecorder records animated GIF images that loop forever.
Stopping a train with the Force, captured with NatCorder.

Creating the Recorder

/// <summary>
/// Create a GIF recorder.
/// </summary>
/// <param name="width">Image width.</param>
/// <param name="height">Image height.</param>
/// <param name="frameDuration">Frame duration in seconds.</param>
GIFRecorder (int width, int height, float frameDuration);
The width and height parameters determine the image dimensions in pixels. The frameDuration parameter determines the amount of time each frame will display for in seconds; a good value to start with is 0.1 seconds.

Image Size

/// <summary>
/// Image size.
/// </summary>
(int width, int height) frameSize { get; }
Refer to the Frame Size section of the IMediaRecorder interface for more information.

Committing Frames

/// <summary>
/// Commit a video pixel buffer for encoding.
/// The pixel buffer MUST have an RGBA8888 pixel layout.
/// </summary>
/// <param name="pixelBuffer">Pixel buffer containing video frame to commit.</param>
/// <param name="timestamp">Not used.</param>
void CommitFrame<T> (T[] pixelBuffer, long timestamp = ...) where T : unmanaged;
Refer to the Committing Video Frames section of the IMediaRecorder interface for more information.
The GIFRecorder ignores all timestamps on committed frames. This is because the frameDuration parameter overrides these timestamps.
The GIFRecorder does not support committing audio frames. Committing audio frames is a null operation.

Finishing Recording

/// <summary>
/// Finish writing and return the path to the recorded media file.
/// </summary>
Task<string> FinishWriting ();
Refer to the Finishing Recording section of the IMediaRecorder interface for more information.