Skip to main content
You can use the video functionality at the native layer by using the Qualcomm IM SDK framework or by using the V4L2 interfaces. Qualcomm provides GStreamer and V4L2-based sample applications to run the video sample use cases.

GStreamer samples

The Qualcomm IM SDK includes sample GStreamer applications for video playback. Note For information on sample GStreamer applications supported on different SoCs, see Multimedia sample applications. For information about the prerequisites for the GStreamer applications, see Run sample applications for video and audio. The following table lists the methods and the corresponding sample video test cases:
Table: Methods to test video use cases
MethodUse case
Using gst-launch-1.0Video playback
Audio-video playback
Video recording
Using the GStreamer applicationVideo playback

V4L2 samples

The iris_v4l2_test sample video test application uses Linux V4L2 interfaces to simulate several basic encoder and decoder behaviors. For more information, see sample V4L2 application. Qualcomm Linux supports the following video APIs:
  • GStreamer APIs: The Qualcomm GStreamer plugins are open-source GStreamer framework compliant. For more information about the GStreamer based plugins, see Qualcomm IM SDK.
  • V4L2 APIs: The Adreno VPU driver follows a standard V4L2-compliant call flow. The V4L2 APIs section provides information related to V4L2 APIs, commands, controls, and events.

Configure GStreamer and V4L2 APIs

  • Qualcomm offers GStreamer-based plugins that you can integrate into your media pipeline. For information on the GStreamer-based plugins, see Configure Qualcomm GStreamer plugins.
  • The Adreno VPU driver uses the V4L2 interface to support video encoding and decoding for all clients that follow the V4L2 guidance.

GStreamer APIs

For information on the GStreamer application development and pipeline creation, see Building an Application.

Configure GStreamer APIs

For information on configuring the GStreamer element property for different features and respective plugins, see Configure Qualcomm GStreamer plugins.

V4L2 APIs

This section describes V4L2 device nodes, file operations, commands, controls, and events for the decoder and encoder.

VPU driver nodes

The device registers the VPU driver during the boot-up process and assigns the device node number to the qcom-multimedia-proprietary-image.
  • VPU driver node for decoder: /dev/video32
  • VPU driver node for encoder: /dev/video33

Note:

For qcom-multimedia-image, the VPU driver assigns the device node to any of the two device nodes starting from video0 to video27.

V4L2 file operations

The Adreno VPU driver supports the following V4L2 file operations:
Table: V4L2 file operations
OperationDescription
openOpens the video device file descriptor (FD) that’s used to communicate with the VPU driver using the input/output control ioctl commands
closeCloses the video device upon the completion of a video use case, and releases all the VPU driver resources related to the video device
pollWaits for the events from the VPU driver
ioctlSends commands or controls to the VPU device

V4L2 common commands for decoder and encoder

The VPU driver supports the following ioctl commands for the video decoder and encoder use cases:
  • VIDIOC_ENUM_FMT
  • VIDIOC_TRY_FMT
  • VIDIOC_G_FMT
  • VIDIOC_S_FMT
  • VIDIOC_ENUM_FRAMESIZES
  • VIDIOC_REQBUFS
  • VIDIOC_QUERY_BUF
  • VIDIOC_CREATE_BUF
  • VIDIOC_PREPARE_BUF
  • VIDIOC_QBUF
  • VIDIOC_DQBUF
  • VIDIOC_STREAMON
  • VIDIOC_STREAMOFF
  • VIDIOC_QUERYCAP
  • VIDIOC_QUERYCTRL
  • VIDIOC_QUERYMENU
  • VIDIOC_SUBSCRIBE_EVENT
  • VIDIOC_UNSUBSCRIBE_EVENT
  • VIDIOC_G_SELECTION
  • VIDIOC_G_CTRL
  • VIDIOC_S_CTRL

V4L2 video decoder

This section provides information on the Adreno VPU decoder device nodes, supported controls, commands, and events. For the procedure to open a VPU decoder node, see VPU driver nodes. V4L2 ioctl commands for decoder For descriptions of the standard ioctl commands, see Video for Linux API Function Reference. Apart from the common commands, the VPU driver also supports the following ioctl commands for the video decoder use cases:
  • VIDIOC_TRY_DECODER_CMD
  • VIDIOC_DECODER_CMD
As specified in the Memory-to-Memory Stateful Video Decoder Interface, the decoder supports all the mandatory commands required for the video decoder use cases. V4L2 open-source controls for decoder For descriptions of the standard open-source controls, see Codec Control Reference. The VPU driver supports the following open-source controls for the video decoder use cases:
Table: V4L2 open-source controls for decoder
Control IDPurposeDynamic/Static
V4L2_CID_MPEG_VIDEO_H264_PROFILEH.264 decoder profileStatic
V4L2_CID_MPEG_VIDEO_HEVC_PROFILEHEVC decoder profileStatic
V4L2_CID_MPEG_VIDEO_VP9_PROFILEVP9 decoder profileStatic
V4L2_CID_MPEG_VIDEO_H264_LEVELH.264 decoder levelStatic
V4L2_CID_MPEG_VIDEO_HEVC_LEVELHEVC decoder levelStatic
V4L2_CID_MPEG_VIDEO_VP9_LEVELVP9 decoder levelStatic
V4L2_CID_MPEG_VIDEO_HEVC_TIERHEVC decoder tierStatic
The decoder supports the following V4L2 open-source events:
  • V4L2_EVENT_EOS
  • V4L2_EVENT_SOURCE_CHANGE
  • V4L2_EVENT_CTRL
The decoder supports the following V4L2 commands:
  • V4L2_DEC_CMD_START
  • V4L2_DEC_CMD_STOP

V4L2 video encoder

This section provides the information on the Adreno VPU encoder device nodes, supported controls, commands, and events. For the procedure to open a VPU encoder node, see VPU driver nodes. V4L2 ioctl commands for encoder For descriptions of the standard ioctl commands, see Function Reference. Apart from the common commands, the VPU driver also supports the following ioctl commands for the encode use cases:
  • VIDIOC_ENUM_FRAMEINTERVALS
  • VIDIOC_S_SELECTION
  • VIDIOC_S_PARM
  • VIDIOC_G_PARM
  • VIDIOC_TRY_ENCODER_CMD
  • VIDIOC_ENCODER_CMD
As specified in the Memory-to-Memory Stateful Video Encoder Interface, the encoder supports all the mandatory commands required for the video encoder use cases. V4L2 open-source controls for encoder For descriptions of the standard open-source controls, see Codec Control Reference. The VPU driver supports the following open-source controls for the video encoder use cases:
Table: V4L2 open-source controls for encoder
Control IDPurposeDynamic/Static
V4L2_CID_MPEG_VIDEO_H264_PROFILEH.264 encoder profileStatic
V4L2_CID_MPEG_VIDEO_HEVC_PROFILEHEVC encoder profileStatic
V4L2_CID_MPEG_VIDEO_H264_LEVELH.264 encoder levelStatic
V4L2_CID_MPEG_VIDEO_HEVC_LEVELHEVC encoder levelStatic
V4L2_CID_MPEG_VIDEO_HEVC_TIERH.264 encoder tierStatic
V4L2_CID_HFLIPHorizontal flipBoth
V4L2_CID_VFLIPVertical flipBoth
V4L2_CID_ROTATERotationStatic
V4L2_CID_MPEG_VIDEO_HEADER_MODEHeader modeStatic
V4L2_CID_MPEG_VIDEO_PREPEND_SPSPPS_TO_IDRSPS/PPS with Instantaneous Decoder Refresh (IDR) frameStatic
V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAMERequest force sync frameBoth
V4L2_CID_MPEG_VIDEO_BITRATEAverage bit rateBoth
V4L2_CID_MPEG_VIDEO_BITRATE_PEAKPeak bit rateBoth
V4L2_CID_MPEG_VIDEO_BITRATE_MODERate controlStatic
V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODEFrame skip modeStatic
V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLERC enable/disableStatic
V4L2_CID_MPEG_VIDEO_GOP_SIZEGroup-of-pictures sizeBoth
V4L2_CID_MPEG_VIDEO_B_FRAMESB-FramesStatic
V4L2_CID_MPEG_VIDEO_LTR_COUNTLTR frame countStatic
V4L2_CID_MPEG_VIDEO_USE_LTR_FRAMESUse LTRBoth
V4L2_CID_MPEG_VIDEO_FRAME_LTR_INDEXMark LTRBoth
V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITY_IDSet base layer ID for layer encodeStatic
V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPEIntra-refreshStatic
V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIODIntra-refresh periodBoth
V4L2_CID_MPEG_VIDEO_H264_MIN_QPH.264 minimum Quantization Parameter (QP)Static
V4L2_CID_MPEG_VIDEO_HEVC_MIN_QPHEVC minimum QPStatic
V4L2_CID_MPEG_VIDEO_H264_MAX_QPH.264 maximum QPStatic
V4L2_CID_MPEG_VIDEO_HEVC_MAX_QPHEVC maximum QPStatic
V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MIN_QPH.264 I-frame minimum QPStatic
V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_MIN_QPHEVC I-frame minimum QPStatic
V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MIN_QPH.264 P-Frame minimum QPStatic
V4L2_CID_MPEG_VIDEO_HEVC_P_FRAME_MIN_QPHEVC P-Frame minimum QPStatic
V4L2_CID_MPEG_VIDEO_H264_B_FRAME_MIN_QPH.264 B-Frame minimum QPStatic
V4L2_CID_MPEG_VIDEO_HEVC_B_FRAME_MIN_QPHEVC B-Frame minimum QPStatic
V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MAX_QPH.264 I-Frame maximum QPStatic
V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_MAX_QPHEVC I-Frame maximum QPStatic
V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MAX_QPH.264 P-Frame maximum QPStatic
V4L2_CID_MPEG_VIDEO_HEVC_P_FRAME_MAX_QPHEVC P-Frame maximum QPStatic
V4L2_CID_MPEG_VIDEO_H264_B_FRAME_MAX_QPH.264 B-Frame maximum QPStatic
V4L2_CID_MPEG_VIDEO_HEVC_B_FRAME_MAX_QPHEVC B-Frame maximum QPStatic
V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_QPHEVC I-Frame QPBoth
V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QPH.264 I-Frame QPBoth
V4L2_CID_MPEG_VIDEO_HEVC_P_FRAME_QPHEVC P-Frame QPBoth
V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QPH.264 P-Frame QPBoth
V4L2_CID_MPEG_VIDEO_HEVC_B_FRAME_QPHEVC B-Frame QPBoth
V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QPH.264 B-Frame QPBoth
V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_TYPEHEVC Hier coding typeStatic
V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_TYPEH.264 Hier coding typeStatic
V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODINGH.264 Hier codingStatic
V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_LAYERHEVC Hier layer countBoth
V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYERH.264 Hier layer countBoth
V4L2_CID_MPEG_VIDEO_H264_HIER_CODING_L0_BRH.264 layer 0-bit rateBoth
V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L0_BRHEVC layer 0-bit rateBoth
V4L2_CID_MPEG_VIDEO_H264_HIER_CODING_L1_BRH.264 layer 1-bit rateBoth
V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L1_BRHEVC layer 1-bit rateBoth
V4L2_CID_MPEG_VIDEO_H264_HIER_CODING_L2_BRH.264 layer 2-bit rateBoth
V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L2_BRHEVC layer 2-bit rateBoth
V4L2_CID_MPEG_VIDEO_H264_HIER_CODING_L3_BRH.264 layer 3-bit rateBoth
V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L3_BRHEVC layer 3-bit rateBoth
V4L2_CID_MPEG_VIDEO_H264_HIER_CODING_L4_BRH.264 layer 4-bit rateBoth
V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L4_BRHEVC layer 4-bit rateBoth
V4L2_CID_MPEG_VIDEO_H264_HIER_CODING_L5_BRH.264 layer 5-bit rateBoth
V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L5_BRHEVC layer 5-bit rateBoth
V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODEH.264 entropy modeStatic
V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODEEncode slice modeStatic
V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTESMaximum bytes in sliceStatic
V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MBMaximum macroblocks in sliceStatic
Set all static configuration options after setting the formats on both the planes and before requesting buffers on either of the plane. Call the dynamic parameters after setting the formats on both planes. For information on the V4L2 controls for encoder, see Codec Control Reference. The supported open-source events for encoder are:
  • V4L2_EVENT_EOS
  • V4L2_EVENT_CTRL
The supported open-source commands for encoder are:
  • V4L2_ENC_CMD_START
  • V4L2_ENC_CMD_STOP

Configure V4L2 APIs

Use the V4L2 control IDs, accepted format, accepted ranges, and sample code information, provided in this section, to configure and manage different video features on your device. B-Frame encode You can configure the VPU driver to set up B-Frames in an encoder session using the VIDIOC_S_CTRL ioctl system call. Set the B-Frame encode configuration before setting the VIDIOC_STREAMON on an output plane. The VPU driver supports B-Frame encode only with Hierarchical coding. This feature doesn’t support dynamic configuration.
Table: Control IDs for B-Frame encode
Control ID for H.264 and HEVC codecsAccepted formatRange
V4L2_CID_MPEG_VIDEO_B_FRAMESInteger
  • 0: Disable B-Frame
  • 1: Enable single B-Frame
The following code sample shows the static configuration for a single B-Frame:
v4l2_control control;
int ret = 0;
int bframes = 1;
memset(&control, 0, sizeof(control));
control.id = V4L2_CID_MPEG_VIDEO_B_FRAMES;
control.value = bframes;
ret = ioctl(mDriverFd, VIDIOC_S_CTRL, &control);// mDriverFd returned from open() system call
if (ret) {
    return -1;
}
memset(&control, 0, sizeof(control));
control.id = V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_TYPE;
control.value = 0;// V4L2_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_B
ret = ioctl(mDriverFd, VIDIOC_S_CTRL, &control);// mDriverFd returned from open() system call
if (ret) {
    return -1;
}
memset(&control, 0, sizeof(control));
control.id = V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER;
control.value = 1;//Enable 1 layer
ret = ioctl(mDriverFd, VIDIOC_S_CTRL, &control);// mDriverFd returned from open() system call
if (ret) {
    return -1;
}
Encoder initial QP override You can configure the VPU driver to override the initial frame quantization parameter (QP) for I-Frames, P-Frames, and B-Frames to an intended value of encoded frames. You can override using the VIDIOC_S_CTRL ioctl system call. The QP override provides the flexibility to set the initial frame QP for I-Frame only, or P-Frame only, or B-Frame only, or I-frame and P-Frame only, or P-Frame and B-Frame only, or combinations of these frames. Set the encoder initial QP override configuration before the VIDIOC_STREAMON on an output plane and is only applicable to an encoder session.
Table: Control IDs for encoder initial QP override
Control ID for H.264 codecAccepted formatQP range
V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QPInteger
Example according to the codec standard:
  • 1 to 51 for 8-bit
  • 1 to 63 (-12 to 51) for 10-bit
V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QPInteger
V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QPInteger
Control ID for HEVC codecAccepted formatQP range
V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_QPInteger
Example according to the codec standard:
  • 1 to 51 for 8-bit
  • 1 to 63 (-12 to 51) for 10-bit
V4L2_CID_MPEG_VIDEO_HEVC_P_FRAME_QPIInteger
V4L2_CID_MPEG_VIDEO_HEVC_B_FRAME_QPInteger
The following code sample shows the static configuration parameters to set:
  • 40 as an initial QP for the I-Frame
  • 35 as an initial QP for the P-Frame
  • B-Frame for the H.264 session
v4l2_control control;
int ret = 0;
memset(&control, 0, sizeof(control));
control.id = V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP;
control.value = 40;
ret = ioctl(mDriverFd, VIDIOC_S_CTRL, &control);// mDriverFd returned from open() system call
if (ret) {
    return -1;
}
memset(&control, 0, sizeof(control));
control.id = V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QP;
control.value = 35;
ret = ioctl(mDriverFd, VIDIOC_S_CTRL, &control);// mDriverFd returned from open() system call
if (ret) {
    return -1;
memset(&control, 0, sizeof(control));
control.id = V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QP;
control.value = 35;
ret = ioctl(mDriverFd, VIDIOC_S_CTRL, &control);// mDriverFd returned from open() system call
if (ret) {
    return -1;
}
Slice encode You can configure the VPU driver to encode a single frame into many slices using the VIDIOC_S_CTRL ioctl system call. The number of bits per slice or the number of macroblocks per slice is a slice boundary. Set the slice-encode configuration before VIDIOC_STREAMON on an output plane. The slice-encode feature doesn’t support dynamic configuration, and this configuration is applicable only to an encoder session.
Table: Control IDs for slice encode
Control ID for H.264 and HEVC codecsAccepted formatRange
V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODEenum
v4l2_mpeg_video_multi_slice_mode
Values according to the codec standard:
enum
v4l2_mpeg_video_multi_slice_mode
V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTESInteger
512 - MAX_BITRATE/8
Unit: bits/second
V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MBInteger1 to 36864
Unit: Macroblocks
The following code sample shows the static configuration to encode frames with many slices and with the maximum number of macroblocks per slice set to 400:
v4l2_control control;
int ret = 0;
v4l2_mpeg_video_multi_slice_mode slicemode = V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_MAX_MB;
memset(&control, 0, sizeof(control));
control.id = V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE;
control.value = slicemode;
ret = ioctl(mDriverFd, VIDIOC_S_CTRL, &control);// mDriverFd returned from open() system call
if (ret) {
    return -1;
}
memset(&control, 0, sizeof(control));
control.id = V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB;
control.value = 400;
ret = ioctl(mDriverFd, VIDIOC_S_CTRL, &control);// mDriverFd returned from open() system call
if (ret) {
    return -1;
}
Intra-refresh You can configure the VPU driver to activate the intra-refresh mode and intra-refresh period using the VIDIOC_S_CTRL ioctl system call. Set the intra-refresh configuration before issuing VIDIOC_STREAMON on an output plane. You can change the intra-refresh period dynamically during the session, and this feature is applicable only to an encoder session.
Table: Control IDs for intra-refresh
Control ID for H.264 and HEVC codecsAccepted formatRange
V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE
enum
v4l2_mpeg_video_intra_refresh_period_type
Random mode:
V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE_RANDOM
Cyclic mode:
V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE_CYCLIC
V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIODInteger
Set the intra-refresh period to be less than an I-frame interval
Unit: number of frames
The following code sample shows the static configuration to activate the random intra-refresh for every 10 frames:
v4l2_control control;
int ret = 0;
v4l2_mpeg_video_intra_refresh_period_type refreshtype = V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE_RANDOM;

memset(&control, 0, sizeof(control));
control.id = V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE;
control.value = refreshtype;
ret = ioctl(mDriverFd, VIDIOC_S_CTRL, &control);// mDriverFd returned from open() system call
if (ret) {
    return -1;
}
memset(&control, 0, sizeof(control));
control.id = V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD;
control.value = 10;
ret = ioctl(mDriverFd, VIDIOC_S_CTRL, &control);// mDriverFd returned from open() system call
if (ret) {
    return -1;
}
Rotation You can configure the VPU driver to rotate the input frame before encoding using the VIDIOC_S_CTRL ioctl system call. Set the rotation configuration before the VIDIOC_STREAMON on an output plane. The rotation feature doesn’t support dynamic configuration and is applicable only to an encoder session.
Table: Control IDs for rotation
Control ID for H.264 and HEVC codecsAccepted formatRange
V4L2_CID_ROTATEInteger
Unit: degrees
The following code sample shows the static configuration for rotating an input frame to 90 degrees:
v4l2_control control;
int ret = 0;
memset(&control, 0, sizeof(control));
control.id = V4L2_CID_ROTATE;
control.value = 90;
ret = ioctl(mDriverFd, VIDIOC_S_CTRL, &control);// mDriverFd returned from open() system call
if (ret) {
    return -1;
}
Frame QP range You can configure the VPU driver to set the minimum and maximum frame QP range parameters for I-frames, P-frames, and B-Frames to an intended value for encoded frames using the VIDIOC_S_CTRL ioctl system call. Set the frame QP range configuration before the VIDIOC_STREAMON on an output plane. The values are valid for an entire session. Dynamic configuration isn’t supported, and the frame QP feature is applicable only to an encoder session.
Table: Control IDs for frame QP range
Control ID for H.264 codecsAccepted formatRange
V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MIN_QPIntegerExample according to the codec standard: 1 to 51 for 8-bit
V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MAX_QP
V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MIN_QP
V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MAX_QP
V4L2_CID_MPEG_VIDEO_H264_B_FRAME_MIN_QP
V4L2_CID_MPEG_VIDEO_H264_B_FRAME_MAX_QP
V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_MIN_QP
V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_MAX_QP
V4L2_CID_MPEG_VIDEO_HEVC_P_FRAME_MIN_QP
V4L2_CID_MPEG_VIDEO_HEVC_P_FRAME_MAX_QP
V4L2_CID_MPEG_VIDEO_HEVC_B_FRAME_MIN_QP
V4L2_CID_MPEG_VIDEO_HEVC_B_FRAME_MAX_QP
The following code sample shows the static configuration parameter to choose 40 as the maximum QP and 10 as the minimum QP for an I-Frame, P-Frame, and B-Frame in an H.264 session:
v4l2_control control;
int ret = 0;
memset(&control, 0, sizeof(control));
control.id = V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MIN_QP;
control.value = 10;
ret = ioctl(mDriverFd, VIDIOC_S_CTRL, &control);// mDriverFd returned from open() system call
if (ret) {
    return -1;
}
memset(&control, 0, sizeof(control));
control.id = V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MIN_QP;
control.value = 10;
ret = ioctl(mDriverFd, VIDIOC_S_CTRL, &control);// mDriverFd returned from open() system call
if (ret) {
    return -1;
}
memset(&control, 0, sizeof(control));
control.id = V4L2_CID_MPEG_VIDEO_H264_B_FRAME_MIN_QP;
control.value = 10;
ret = ioctl(mDriverFd, VIDIOC_S_CTRL, &control);// mDriverFd returned from open() system call
if (ret) {
    return -1;
}
memset(&control, 0, sizeof(control));
control.id = V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MAX_QP;
control.value = 40;
ret = ioctl(mDriverFd, VIDIOC_S_CTRL, &control);// mDriverFd returned from open() system call
if (ret) {
    return -1;
}
memset(&control, 0, sizeof(control));
control.id = V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MAX_QP;
control.value = 40;
ret = ioctl(mDriverFd, VIDIOC_S_CTRL, &control);// mDriverFd returned from open() system call
if (ret) {
    return -1;
}
memset(&control, 0, sizeof(control));
control.id = V4L2_CID_MPEG_VIDEO_H264_B_FRAME_MAX_QP;
control.value = 40;
ret = ioctl(mDriverFd, VIDIOC_S_CTRL, &control);// mDriverFd returned from open() system call
if (ret) {
    return -1;
}
You can configure the following controls if you need to have the same minimum and maximum QP value for an I-Frame, P-Frame, and B-Frame: Table: Control IDs for H.264 codec
Table: Control IDs for H.264 codec
Control ID for H.264 codecAccepted formatRange
V4L2_CID_MPEG_VIDEO_H264_MIN_QPIntegerExample according to the code standard: 1 to 51 for 8-bit
V4L2_CID_MPEG_VIDEO_H264_MAX_QP
Table: Control IDs for HEVC codec
Control ID for HEVC codecAccepted formatRange
V4L2_CID_MPEG_VIDEO_HEVC_MIN_QPIntegerExample according to the code standard: 1 to 51 for 8-bit
V4L2_CID_MPEG_VIDEO_HEVC_MAX_QPInteger

Next steps