The VideoEncoder module provides the APIs for video encoding.
The main capabilities provided by this module include:
Encoder creation and destruction: Creates a single-stream video encoder instance based on the MIME type or encoder name. It also supports creating a primary encoder and a secondary encoder with preprocessing capabilities to implement one-input-two-output dual-stream encoding, and destroys encoder instances to release resources.
Encoding parameter configuration: Configures the description information of the encoded video (such as resolution, frame rate, pixel format, bit rate, and profile), and supports features such as layered encoding, long-term reference frames, and B frames.
Asynchronous callback mechanism: Registers callback functions to respond to events generated by the encoder, such as errors, stream changes, input buffer requests, and output buffer readiness.
Per-frame parameter configuration: In Surface mode, sets frame-level encoding parameters (such as frame-level QPMin/QPMax and LTR reference frames) through callbacks.
Encoding control: Starts, stops, flushes, and resets the encoder, controls the encoding process state, and notifies the end of the input stream.
Input and output processing: Submits input buffers filled with data and releases output buffers, supporting both Buffer mode and Surface mode.
Synchronous mode support: Queries and obtains available input and output buffers to implement a synchronous encoding process.
Dynamic parameter setting: Sets dynamic encoder parameters (such as requesting I-frames and quantization parameter ranges) during encoding.
Preprocessing and dual-stream encoding: Supports creating a secondary encoder from the primary encoder to implement one-input-two-output dual-stream encoding. Video encoding preprocessing (downsampling and cropping) is supported only in dual-stream encoding scenarios.
Applicable scenarios include video recording, live video streaming, video conferencing, video calls, screen recording, and other scenarios where raw video frames need to be encoded into compressed bitstreams.
You can refer to the corresponding development guide and samples based on your development requirements.
System capability: SystemCapability.Multimedia.Media.VideoEncoder
Since: 9