Callback Format
Description
A callback function is used to receive data (such as video frame data, ByteSize, and frame ID) encoded by VideoEncoder and implement user-defined processing functions in the callback.
To implement user-defined processing function, you are advised to perform operations, such as saving data and writing lists (append), to reduce the processing time and prevent the encoding thread from being blocked, which slows down the video encoding speed.
Prototype
def callback_func(pyBytes: bytes, outDataSize: int, channelId: int, frameId: int) -> None
Parameter Description
callback_func indicates the function name, which is user-defined but must be the same as the function name registered by registerVencCallBack.
Parameter |
Type |
Description |
|---|---|---|
pyBytes |
bytes |
Output video frame data after encoding. |
outDataSize |
int |
Output memory size for storing encoded video frame data. |
channelId |
int |
Video stream index, which is set during VideoEncoder initialization. |
frameId |
int |
Video frame index, which is set by the encode function of the VideoEncoder class. |
Return Parameter Description
None
Exception Throwing Interface
If the function parameters and outputs are not defined in the specified format, the "pybind11::error_already_set" exception occurs.