ExternalVideoFrame
External video frame.
export class ExternalVideoFrame {
type?: VideoBufferType;
format?: VideoPixelFormat;
buffer?: Uint8Array;
stride?: number;
height?: number;
cropLeft?: number;
cropTop?: number;
cropRight?: number;
cropBottom?: number;
rotation?: number;
timestamp?: number;
eglType?: EglContextType;
textureId?: number;
matrix?: number[];
metadataBuffer?: Uint8Array;
metadataSize?: number;
alphaBuffer?: Uint8Array;
fillAlphaBuffer?: boolean;
alphaStitchMode?: AlphaStitchMode;
colorSpace?: ColorSpace;
}
Properties
- type
- Video type. See VideoBufferType.
- format
- Pixel format. See VideoPixelFormat.
- buffer
- Video buffer.
- stride
- Stride of the input video frame, in pixels (not bytes). For Texture, this value indicates the width of the Texture.
- height
- Height of the input video frame.
- eglContext
- This parameter applies only to video data in Texture format.
- When using the Khronos-defined OpenGL interface (
javax.microedition.khronos.egl.*), seteglContextto this field. - When using the Android-defined OpenGL interface (
android.opengl.*), seteglContextto this field.
- When using the Khronos-defined OpenGL interface (
- eglType
- This parameter applies only to video data in Texture format. Indicates the Texture ID of the video frame.
- textureId
- This parameter applies only to video data in Texture format. A 4x4 transformation matrix input, typically an identity matrix.
- matrix
- This parameter applies only to video data in Texture format. A 4x4 transformation matrix input, typically an identity matrix.
- metadataBuffer
- This parameter applies only to video data in Texture format. Indicates the data buffer of MetaData. Default value is
NULL. - metadataSize
- This parameter applies only to video data in Texture format. Indicates the size of MetaData. Default value is
0. - alphaBuffer
- Alpha channel data output by the portrait segmentation algorithm. This data matches the size of the video frame. Each pixel value ranges from [0,255], where 0 represents background and 255 represents foreground (portrait).
You can use this parameter to render the video background with various effects, such as transparency, solid color, image, or video.
Note: In custom video rendering scenarios, ensure that both the input video frame and
alphaBufferare of Full Range type; other types may result in abnormal Alpha data rendering. - fillAlphaBuffer
-
Note: For video data in BGRA or RGBA format, you can choose either of the following methods to set the Alpha channel data:This parameter applies only to video data in BGRA or RGBA format. Specifies whether to extract the Alpha channel data from the video frame and automatically fill it into
- Automatically fill by setting this parameter to true.
- Set via the
alphaBufferparameter.
alphaBuffer:- true: Extract and fill the Alpha channel data.
- false: (default) Do not extract or fill the Alpha channel data.
- alphaStitchMode
- When the video frame contains Alpha channel data, sets the relative position of
alphaBufferand the video frame. See AlphaStitchMode. - cropLeft
- This parameter applies only to raw video data.
- cropTop
- This parameter applies only to raw video data.
- cropRight
- This parameter applies only to raw video data.
- cropBottom
- This parameter applies only to raw video data.
- rotation
- Field related to raw data. Specifies whether to rotate the input video group clockwise. Options: 0, 90, 180, 270. Default is 0.
- timestamp
- Timestamp of the input video frame, in milliseconds. Incorrect timestamps may result in frame drops or audio-video desynchronization.
- colorSpace
- Color space properties of the video frame. By default, Full Range and BT.709 standard configurations are applied. You can customize settings based on business requirements such as custom capture or rendering. See VideoColorSpace.