I am using 8M Plus SOM and using imx-gst1.0-plugin in our application for H264 encoding.
There is no API to limit the QP for I frame.
We decided to use VBR hence set the bitrate as zero i.e. enc->open_param.nBitRate = 0.
After that setting the QP for I frame as 35 and for Pframe as 25 through enc_enc_param.nQuantParam.
After encoding, observed QP 35 for I frames and QP 40 for P frames.
As per the manual
bitRate is the target bit rate in kbps. If 0, there is no rate control and pictures are encoded with a quantization parameter equal to quantParam in EncParam.
quantParam is used for all quantization parameters with VBR (no rate control). The range of value is 1-31 for MPEG-4 and 0-51 for H.264. When rate control is enabled, this field is ignored.
Clearly it's a bug in the Plug-in / firmware.
Please look into the issue and provide a solution.
Solved! Go to Solution.
Hi @KrishnaraoP
I wanted to share please if you can use gstreamer pipeline in order to run the encoder on i.MX8MPlus. There is no issue in the VPU firmware and we can control QP for the I and P frames.
Few things to consider: talking about QP for I frame, that if frame_level_rate_control is 1, hevc_minimum_qp_value and hevc_maximum_qp_value are used in the pipeline. If frame_level_rate_control is 0 then only hevc_i_frame_qp_value take into effect (or try modifying all the controls).
for example: frame_level_rate_control is 0 : v4l2h265enc extra-controls="controls,hevc_profile=1,hevc_level=15,hevc_i_frame_qp_value =20")and check if it works as expected, or modify all the controls to get it working. (qpMin/qpMax and qp in this case - for example: v4l2h265enc extra-controls="controls,hevc_profile=1,hevc_level=15,hevc_maximum_qp_value=20, hevc_i_frame_qp_value=19")
For V4L2 codec observations:
you can list the V4L2 control supported by the device.
root@imx8mpevk:~# v4l2-ctl -d /dev/video0 -l
i.MX Linux User guide has numerous gstreamer pipeline to get an idea about usage of different plugins. Topic especially related to encoding section 7.3.3 Video encoding page 63.
For h265 as an example a gstreamer pipeline, as follows:
gst-launch-1.0 filesrc location=out.nv12 ! rawvideoparse width=3840 height=2160 format=nv12 framerate=30/1 colorimetry=bt709 ! v4l2h264enc extra-controls="controls,h264_profile=1,h264_level=15,h264_minimum_qp_value=20, h264_i_frame_qp_value=22" ! filesink location=qp22_test.h264
Moreover, https://community.nxp.com/t5/i-MX-Processors/8M-Plus-H264-Encoding-issues-unreliable-firmware/m-p/21...seems to be the same issue kindly let me know if further information is required.
Kind Regards,
Tashia
Hi
I observed two issues,
extra-controls="controls,video_bitrate_mode=1,video_bitrate=4000000,video_gop_size=60, slice_partitioning_method=1, number_of_mbs_in_a_slice=17, frame_level_rate_control_enable=1, h264_profile=4, h264_minimum_qp_value=25, h264_maximun_qp_value=45"
a) encoding in baseline profile only
b) frame_level_rate_control_enable=1, and h264_minimum_qp_value=25, h264_maximun_qp_value=45 but I observed qp=48 for the first and second frame, third frame qp as 46.
Hello,
Please send is you BSP and the whole steps you made to see that VPU does not work.
Regards
Hi
Linux version 6.6.52-lts-next (aarch64-poky-linux-gcc (GCC) 13.3.0, GNU ld (GNU Binutils) 2.42.0.20240723) #1 SMP PREEMPT
in imx-gst1.0-plugin i.e. imx-gst1.0-plugin\plugins\vpu\gstvpuenc.c file
a) set the bitrate to zero i.e. in gst_vpu_enc_set_format function
enc->open_param.nBitRate = 0;
b) assigning the quantiztion parameter based on the frametype
in gst_vpu_enc_handle_frame
if (enc_enc_param.nForceIPicture == 1)
enc_enc_param.nQuantParam = 35;
else
enc_enc_param.nQuantParam = 30;
it is not working, no support in imx-vpuwrap package.
Hi @KrishnaraoP
I wanted to share please if you can use gstreamer pipeline in order to run the encoder on i.MX8MPlus. There is no issue in the VPU firmware and we can control QP for the I and P frames.
Few things to consider: talking about QP for I frame, that if frame_level_rate_control is 1, hevc_minimum_qp_value and hevc_maximum_qp_value are used in the pipeline. If frame_level_rate_control is 0 then only hevc_i_frame_qp_value take into effect (or try modifying all the controls).
for example: frame_level_rate_control is 0 : v4l2h265enc extra-controls="controls,hevc_profile=1,hevc_level=15,hevc_i_frame_qp_value =20")and check if it works as expected, or modify all the controls to get it working. (qpMin/qpMax and qp in this case - for example: v4l2h265enc extra-controls="controls,hevc_profile=1,hevc_level=15,hevc_maximum_qp_value=20, hevc_i_frame_qp_value=19")
For V4L2 codec observations:
you can list the V4L2 control supported by the device.
root@imx8mpevk:~# v4l2-ctl -d /dev/video0 -l
i.MX Linux User guide has numerous gstreamer pipeline to get an idea about usage of different plugins. Topic especially related to encoding section 7.3.3 Video encoding page 63.
For h265 as an example a gstreamer pipeline, as follows:
gst-launch-1.0 filesrc location=out.nv12 ! rawvideoparse width=3840 height=2160 format=nv12 framerate=30/1 colorimetry=bt709 ! v4l2h264enc extra-controls="controls,h264_profile=1,h264_level=15,h264_minimum_qp_value=20, h264_i_frame_qp_value=22" ! filesink location=qp22_test.h264
Moreover, https://community.nxp.com/t5/i-MX-Processors/8M-Plus-H264-Encoding-issues-unreliable-firmware/m-p/21...seems to be the same issue kindly let me know if further information is required.
Kind Regards,
Tashia