VideoFrame

Configurations of the video frame.

public class VideoFrame
    {
        public VIDEO_PIXEL_FORMAT type;

        public int width;

        public int height;

        public int yStride;

        public int uStride;

        public int vStride;

        public byte[] yBuffer;

        public IntPtr yBufferPtr;

        public byte[] uBuffer;

        public IntPtr uBufferPtr;

        public byte[] vBuffer;

        public IntPtr vBufferPtr;

        public int rotation;

        public long renderTimeMs;

        public int avsync_type;

        public IntPtr metadata_buffer;

        public int metadata_size;

        public IntPtr sharedContext;

        public int textureId;

        public IntPtr d3d11Texture2d;

        public float[] matrix;

        public byte[] alphaBuffer;

        public ALPHA_STITCH_MODE alphaStitchMode;

        public IVideoFrameMetaInfo metaInfo;

        public ColorSpace colorSpace;
    };

Note that the buffer provides a pointer to a pointer. This interface cannot modify the pointer of the buffer, but it can modify the content of the buffer.

Attributes

type
The pixel format. See VIDEO_PIXEL_FORMAT.
width
The width of the video, in pixels.
height
The height of the video, in pixels.
yStride
For YUV data, the line span of the Y buffer; for RGBA data, the total data length.
Attention: When dealing with video data, it is necessary to process the offset between each line of pixel data based on this parameter, otherwise it may result in image distortion.
uStride
For YUV data, the line span of the U buffer; for RGBA data, the value is 0.
Attention: When dealing with video data, it is necessary to process the offset between each line of pixel data based on this parameter, otherwise it may result in image distortion.
vStride
For YUV data, the line span of the V buffer; for RGBA data, the value is 0.
Attention: When dealing with video data, it is necessary to process the offset between each line of pixel data based on this parameter, otherwise it may result in image distortion.
yBuffer
For YUV data, the pointer to the Y buffer; for RGBA data, the data buffer.
uBuffer
For YUV data, the pointer to the U buffer; for RGBA data, the value is 0.
vBuffer
For YUV data, the pointer to the V buffer; for RGBA data, the value is 0.
rotation
The clockwise rotation of the video frame before rendering. Supported values include 0, 90, 180, and 270 degrees.
renderTimeMs
The Unix timestamp (ms) when the video frame is rendered. This timestamp can be used to guide the rendering of the video frame. This parameter is required.
avsync_type
Reserved for future use.
metadata_buffer
This parameter only applies to video data in Texture format. The MetaData buffer. The default value is NULL.
metadata_size
This parameter only applies to video data in Texture format. The MetaData size. The default value is 0.
sharedContext
This parameter only applies to video data in Texture format. EGL Context.
textureId
This parameter only applies to video data in Texture format. Texture ID.
d3d11Texture2d
This parameter only applies to video data in Windows Texture format. It represents a pointer to an object of type ID3D11Texture2D, which is used by a video frame.
matrix
This parameter only applies to video data in Texture format. Incoming 4 × 4 transformational matrix. The typical value is a unit matrix.
colorSpace
By default, the color space properties of video frames will apply the Full Range and BT.709 standard configurations. You can configure the settings according your needs for custom video capturing and rendering. See .
alphaBuffer

The alpha channel data output by using portrait segmentation algorithm. This data matches the size of the video frame, with each pixel value ranging from [0,255], where 0 represents the background and 255 represents the foreground (portrait).

By setting this parameter, you can render the video background into various effects, such as transparent, solid color, image, video, etc.

Attention:
  • In custom video rendering scenarios, ensure that both the video frame and alphaBuffer are of the Full Range type; other types may cause abnormal alpha data rendering.
  • Make sure that alphaBuffer is exactly the same size as the video frame (width × height), otherwise it may cause the app to crash.
alphaStitchMode
When the video frame contains alpha channel data, it represents the relative position of alphaBuffer and the video frame. See ALPHA_STITCH_MODE.
metaInfo

The meta information in the video frame. To use this parameter, contact technical support.