ScreenInput

class NatML.Recorders.Inputs.ScreenInput

The ScreenInput class simplifies the process of recording video from the screen. Unlike the CameraInput, the screen input grabs whatever is on screen without the ability to selectively include or exclude objects from being recorded.

The ScreenInput typically provides better recording performance than the CameraInput because it does not need to re-render the scene.

Creating the Screen Input

The camera input can be created with either a destination recorder or texture input:

With a Media Recorder

/// <summary>
/// Create a video recording input from the screen.
/// </summary>
/// <param name="recorder">Media recorder to receive video frames.</param>
/// <param name="clock">Recording clock for generating timestamps.</param>
ScreenInput (IMediaRecorder recorder, IClock clock = default);

The screen input can be created with a recorder which receives video frames captured from the screen.

With a Texture Input

/// <summary>
/// Create a video recording input from the screen.
/// </summary>
/// <param name="input">Texture input to receive video frames.</param>
/// <param name="clock">Recording clock for generating timestamps.</param>
ScreenInput (TextureInput input, IClock clock = default);

The screen input can be created with a texture input which receives video frames captured from the screen.

Skipping Frames

/// <summary>
/// Control number of successive camera frames to skip while recording.
/// </summary>
int frameSkip { get; set; }

The ScreenInput typically commits frames from the screen on every Unity update. You can reduce this frequency by increasing the frameSkip property. This is especially useful for creating animated GIF images which typically have a low frame rate look. It can also provide performance increases in GPU-bound applications.

Disposing the Input

/// <summary>
/// Stop recorder input and release resources.
/// </summary>
void Dispose ();

When you choose to stop recording, simply dispose the recorder input. You will typically do this before calling FinishWriting on the recorder.

Last updated