NatCorder
Search…
⌃K

CameraInput

class NatML.Recorders.Inputs.CameraInput
The CameraInput simplifies the process of recording video from one or multiple game cameras.
The CameraInput does not support recording Unity UI canvases that render using the Screen Space - Overlay mode. This is a limitation of Unity Engine.

Creating the Camera 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 a game camera.
/// </summary>
/// <param name="recorder">Media recorder to receive committed frames.</param>
/// <param name="clock">Clock for generating timestamps.</param>
/// <param name="cameras">Game cameras to record.</param>
CameraInput (IMediaRecorder recorder, IClock clock, params Camera[] cameras);
The camera input can be created with a recorder which receives video frames from the game cameras. There is a similar constructor which does not accept a clock, for recorders which do not use timestamps:
/// <summary>
/// Create a video recording input from one or more game cameras.
/// </summary>
/// <param name="recorder">Media recorder to receive video frames.</param>
/// <param name="cameras">Game cameras to record.</param>
CameraInput (IMediaRecorder recorder, params Camera[] cameras);

With a Texture Input

/// <summary>
/// Create a video recording input from one or more game cameras.
/// </summary>
/// <param name="input">Texture input to receive video frames.</param>
/// <param name="cameras">Game cameras to record.</param>
CameraInput (TextureInput input, IClock clock, params Camera[] cameras);
The camera input can be created with a backing texture input that receives video frames from the game cameras. There is a similar constructor which does not accept a clock, for recorders which do not use timestamps:
/// <summary>
/// Create a video recording input from one or more game cameras.
/// </summary>
/// <param name="input">Texture input to receive video frames.</param>
/// <param name="cameras">Game cameras to record.</param>
CameraInput (TextureInput input, params Camera[] cameras);

Skipping Frames

/// <summary>
/// Control number of successive camera frames to skip while recording.
/// </summary>
int frameSkip { get; set; }
The CameraInput typically commits frames from the game camera(s) 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.

HDR Recording

/// <summary>
/// Configure the camera input for HDR or post-processing FX rendering.
/// </summary>
bool HDR { get; set; }
When using post processing effects, the camera input can be informed to use a high dynamic range framebuffer for recording.

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.