width
and height
) which defines the pixel size of the output video. With this in mind, the IMediaRecorder
interface exposes the frameSize
property:RGBA8888
pixel buffer. This could be a Color32[]
provided by Unity's Texture2D.GetPixels32
or WebCamTexture.GetPixels32
methods; it could be a managed byte[]
provided by the NatDevice camera preview or an OpenCV matrix; or it can be any other managed numeric array that contains data which can be interpreted as an RGBA8888
pixel buffer.frameSize.width * frameSize.height * 4
.CommitFrame
method has an overload that takes in a pointer to anRGBA8888
pixel buffer in native memory. This is useful for applications that want to avoid garbage collection when working with large pixel buffers in managed memory.CommitSamples
method has an overload that takes a pointer to a float
sample buffer in native memory. This is useful for applications that want to avoid garbage collection and extra allocations for high performance recording.sampleCount
parameter should account for the multiple channels of audio present within the buffer. In other words, the byte size of the nativeBuffer
must be equal to sampleCount * sizeof(float)
.FinishWriting
is called. Doing so will typically result in a hard crash.System.IO
API's to move the file where you want it.