class NatML.Recorders.WEBMRecorder : IMediaRecorder
The WEBMRecorder records *.webm video files.
The WEBMRecorder uses the VP8 codec for video and the OPUS codec for audio.
The WEBMRecorder is not supported on iOS, macOS, or Windows.
Creating the Recorder
/// <summary>/// Create a WEBM recorder./// </summary>/// <paramname="width">Video width.</param>/// <paramname="height">Video height.</param>/// <paramname="frameRate">Video frame rate.</param>/// <paramname="sampleRate">Audio sample rate. Pass 0 for no audio.</param>/// <paramname="channelCount">Audio channel count. Pass 0 for no audio.</param>/// <paramname="bitrate">Video bitrate in bits per second.</param>WEBMRecorder (int width, int height, float frameRate, int sampleRate = ..., int channelCaount = ..., int bitrate = ...);
The WEBMRecorder can be created to record video with optional audio. To record video only, simply provide the video width, video height, and video frameRate.
// Record video only at 720p30var recorder =newWEBMRecorder(1280,720,60);
To record video with audio, you will provide the audio format along with the video format. The audio format comprises of the sampleRate and channelCount.
// Record 480p video with 24KHz mono audiovar recorder =newWEBMRecorder(640,480,30,24000,1);
When recording audio from Unity (e.g. using an AudioInput):
Set the sampleRate to AudioSettings.outputSampleRate.
Set the channelCount to (int)AudioSettings.speakerMode.
/// <summary>/// Commit a video pixel buffer for encoding./// The pixel buffer MUST have an RGBA8888 pixel layout./// </summary>/// <paramname="pixelBuffer">Pixel buffer containing video frame to commit.</param>/// <paramname="timestamp">Pixel buffer timestamp in nanoseconds.</param>voidCommitFrame<T> (T[] pixelBuffer,long timestamp) whereT:struct;