CM H264 Encode
The cmH264Encode is used to encode the video/x-raw(YUV) data to video/h264(H264) data by the gstvideo4linux2 library. It uses a hardware encoder on the C3V.
API Instructions
create/destroy
gpointer cm_h264_encode_create();
void cm_h264_encode_destroy(gpointer hd);
start/stop
void cm_h264_encode_start(gpointer hd);
void cm_h264_encode_stop(gpointer hd);
parameters
The h264 encoder parameters:
/* @ gop_size The GOP size for IPPP*/
void cm_h264_encode_set_gop_size(gpointer hd, int gop_size);
/*
* Variable bitrate control
* @qpmin qp minium, >= 0
* @qpmax qp maximum, <=51
* @br_max max bitrate
*/
void cm_h264_encode_set_bitrate_vbr(gpointer hd, int qpmin, int qpmax, int br_max);
/* @br Constant bitreate control value */
void cm_h264_encode_set_bitrate_cbr(gpointer hd, int be);
/* @qp Constant qp value */
void cm_h264_encode_set_bitrate_cq(gpointer hd, int qp);
/* Start keyframe encode immediately*/
void cm_h264_encode_set_froce_key_frame(gpointer hd);
Get the h264 media info with caps string format.
data
The encoder needs to know the actual format of the input before encoding, so must ensure the source is ready to be linked(the media info is ready).
Demo
H264 Encode Demo
Structure
Get YUV data from the sensor then encode it to H264.
Main codes
For more details please refer to the demo file.
Test result
The h264 data can be saved to the file and displayed on the PC.
Â