ExternalVideoFrame
External video frame.
public class ExternalVideoFrame
{
public VIDEO_BUFFER_TYPE type;
public VIDEO_PIXEL_FORMAT format;
public byte[] buffer;
public int stride;
public int height;
public int cropLeft;
public int cropTop;
public int cropRight;
public int cropBottom;
public int rotation;
public long timestamp;
public byte[] eglContext;
public EGL_CONTEXT_TYPE eglType;
public int textureId;
public byte[] metadataBuffer;
public int metadataSize;
public byte[] alphaBuffer;
public bool fillAlphaBuffer;
public ALPHA_STITCH_MODE alphaStitchMode;
public IntPtr d3d11Texture2d;
public int textureSliceIndex;
public ColorSpace colorSpace;
};
Properties
- type
- Video type. See VIDEO_BUFFER_TYPE.
- format
- Pixel format. See VIDEO_PIXEL_FORMAT.
- buffer
- Video buffer.
- stride
- Stride of the input video frame, in pixels (not bytes). For Texture, this refers to the width of the Texture.
- height
- Height of the input video frame.
- eglContext
- (Texture only)
- When using the Khronos-defined OpenGL interface (javax.microedition.khronos.egl.*), set
eglContextto this field. - When using the Android-defined OpenGL interface (android.opengl.*), set
eglContextto this field.
- When using the Khronos-defined OpenGL interface (javax.microedition.khronos.egl.*), set
- eglType
- (Texture only) Type of the Texture ID for the video frame.
- textureId
- (Texture only) A 4x4 transformation matrix input, typically an identity matrix.
- metadataBuffer
- (Texture only) Metadata buffer. Default is
NULL. - metadataSize
- (Texture only) Size of the metadata. Default is
0. - d3d11Texture2d
- (Windows Texture only) A pointer to an
ID3D11Texture2Dobject used by the video frame. - alphaBuffer
- Alpha channel data output by portrait segmentation algorithm. The data matches the video frame size, with pixel values ranging 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 video frame and
alphaBufferare Full Range. Other types may cause abnormal Alpha rendering. - fillAlphaBuffer
-
Note: For BGRA or RGBA video data, you can set Alpha channel data using either of the following:(BGRA or RGBA only) 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 or fill Alpha channel data.
- alphaStitchMode
- When the video frame contains Alpha channel data, sets the relative position of
alphaBufferand the video frame. See ALPHA_STITCH_MODE. - textureSliceIndex
- (Windows Texture only) Index of the
ID3D11Texture2Dtexture object used by the video frame in theID3D11Texture2Darray. - cropLeft
- (Raw video only)
- cropTop
- (Raw video only)
- cropRight
- (Raw video only)
- cropBottom
- (Raw video only)
- rotation
- Raw data field. Specifies clockwise rotation of the input video group. Options: 0, 90, 180, 270. Default is 0.
- timestamp
- Timestamp of the input video frame in milliseconds. Incorrect timestamps may cause frame drops or AV sync issues.
- colorSpace
- Color space property of the video frame. By default, Full Range and BT.709 configurations are applied. You can customize this based on custom capture or rendering needs. See VideoColorSpace.