NatCorder
Search…
CameraInput
class NatSuite.Recorders.Inputs.CameraInput
The CameraInput class simplifies the process of recording video from one or multiple game cameras.
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 Recorder Input

1
/// <summary>
2
/// Create a video recording input from a game camera.
3
/// </summary>
4
/// <param name="recorder">Media recorder to receive committed frames.</param>
5
/// <param name="clock">Clock for generating timestamps.</param>
6
/// <param name="cameras">Game cameras to record.</param>
7
CameraInput (IMediaRecorder recorder, IClock clock, params Camera[] cameras);
Copied!
The input is always created with a recorder which receives video frames that are recorded from the game camera(s). The constructor also accepts a clock for generating timestamps for the video frames that are committed.
Some recorders like the GIFRecorder and the JPGRecorder to not require timestamps. As such, there is a constructor which doesn't require a clock:
1
/// <summary>
2
/// Create a video recording input from one or more game cameras.
3
/// </summary>
4
/// <param name="recorder">Media recorder to receive video frames.</param>
5
/// <param name="cameras">Game cameras to record.</param>
6
CameraInput (IMediaRecorder recorder, params Camera[] cameras);
Copied!
The camera input can also be created with an ITextureInput which sends frames to a recorder:
No Clock
Clock
1
/// <summary>
2
/// Create a video recording input from one or more game cameras.
3
/// </summary>
4
/// <param name="input">Texture input to receive video frames.</param>
5
/// <param name="cameras">Game cameras to record.</param>
6
CameraInput (ITextureInput input, params Camera[] cameras);
Copied!
1
/// <summary>
2
/// Create a video recording input from one or more game cameras.
3
/// </summary>
4
/// <param name="input">Texture input to receive video frames.</param>
5
/// <param name="cameras">Game cameras to record.</param>
6
CameraInput (ITextureInput input, IClock clock, params Camera[] cameras);
Copied!

Skipping Frames

1
/// <summary>
2
/// Control number of successive camera frames to skip while recording.
3
/// </summary>
4
int frameSkip { get; set; }
Copied!
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.

Stopping the Recorder Input

1
/// <summary>
2
/// Stop recorder input and release resources.
3
/// </summary>
4
void Dispose ();
Copied!
When you choose to stop recording, simply dispose the recorder input. You will typically do this before calling FinishWriting on the recorder.
Last modified 6mo ago