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;
d3d11Texture2d?: any;
textureSliceIndex?: number;
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 refers to 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 OpenGL interface defined by Khronos (javax.microedition.khronos.egl.*), set
eglContextto this field. - When using the OpenGL interface defined by Android (android.opengl.*), set
eglContextto this field.
- When using the OpenGL interface defined by Khronos (javax.microedition.khronos.egl.*), set
- eglType
- This parameter applies only to video data in Texture format. Refers to the Texture ID of the video frame.
- textureId
- This parameter applies only to video data in Texture format. Refers to an input 4x4 transformation matrix, typically an identity matrix.
- matrix
- This parameter applies only to video data in Texture format. Refers to an input 4x4 transformation matrix, typically an identity matrix.
- metadataBuffer
- This parameter applies only to video data in Texture format. Refers to the metadata buffer. Default value is
NULL. - metadataSize
- This parameter applies only to video data in Texture format. Refers to the size of the metadata. Default value is
0. - d3d11Texture2d
- This parameter applies only to video data in Windows Texture format. Refers to a pointer to an object of type
ID3D11Texture2Dused by the video frame. - alphaBuffer
- Alpha channel data output by portrait segmentation algorithm. This data matches the size of the video frame, with pixel values ranging from [0,255], where 0 indicates background and 255 indicates foreground (portrait).
You can use this parameter to render the video background into various effects such as transparent, solid color, image, video, etc.
Note: In custom video rendering scenarios, ensure that both the input video frame and
alphaBufferare of Full Range type; other types may cause incorrect rendering of alpha data. - fillAlphaBuffer
-
Note: For video data in BGRA or RGBA format, you can set the alpha channel data in either of the following ways: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 alpha channel data.
- false: (Default) Do not extract and fill alpha channel data.
- alphaStitchMode
- When the video frame contains alpha channel data, sets the relative position of
alphaBufferand the video frame. See AlphaStitchMode. - textureSliceIndex
- This parameter applies only to video data in Windows Texture format. Refers to the index of the
ID3D11Texture2Dtexture object used by the video frame in theID3D11Texture2Darray. - 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. Available values: 0, 90, 180, 270. Default is 0.
- timestamp
- Timestamp of the input video frame in milliseconds. Incorrect timestamps may cause 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 the settings based on your requirements for custom capture and rendering. See VideoColorSpace.