Interface IEncoder
Interface to implement to create an encoder.
Namespace: UnityEditor.Recorder.Encoder
Assembly: Unity.Recorder.Editor.dll
Syntax
public interface IEncoder
Properties
GetVideoInputPath
Returns the input video path for the encoder. Based on the returned value, the appropriate addVideoFrame function will be invoked.
Declaration
IEncoder.VideoInputPath GetVideoInputPath { get; }
Property Value
Type | Description |
---|---|
IEncoder.VideoInputPath |
Methods
AddAudioFrame(NativeArray<float>)
Encodes an array of audio values and adds it to the audio stream.
Declaration
void AddAudioFrame(NativeArray<float> bytes)
Parameters
Type | Name | Description |
---|---|---|
NativeArray<float> | bytes | The array of bytes to encode. |
Remarks
The number of channels is determined by the number of speakers in the scene.
See Also
AddVideoFrame(NativeArray<byte>, MediaTime)
Encodes an array of bytes and adds it to the video stream.
Declaration
void AddVideoFrame(NativeArray<byte> bytes, MediaTime time)
Parameters
Type | Name | Description |
---|---|---|
NativeArray<byte> | bytes | The array of bytes to encode. |
MediaTime | time | The timestamp of the current frame. |
Remarks
The encoder interprets the format of the array based on the texture format in IEncoderSettings passed to the OpenStream method.
See Also
AddVideoFrame(RenderTexture, MediaTime)
Encodes a Texture and adds it to the video stream.
Declaration
void AddVideoFrame(RenderTexture frame, MediaTime time)
Parameters
Type | Name | Description |
---|---|---|
RenderTexture | frame | The texture to encode. |
MediaTime | time | The timestamp of the current frame. |
CloseStream()
Closes the stream of audio and video frames.
Declaration
void CloseStream()
OpenStream(IEncoderSettings, RecordingContext)
Opens the stream to add the audio and video frames to.
Declaration
void OpenStream(IEncoderSettings settings, RecordingContext ctx)
Parameters
Type | Name | Description |
---|---|---|
IEncoderSettings | settings | The settings of this encoder. |
RecordingContext | ctx | The context of the Recorder that drives this encoder. |