Set encoder to constant quality mode

• Hardware Platform (Jetson / GPU) : NVIDIA Jetson AGX Orin
• DeepStream Version : 7.1
• JetPack Version (valid for Jetson only) : 6.0
• TensorRT Version : 8.6.2.3
• Issue Type( questions, new requirements, bugs) : question

Hello,
In my pipeline I am using such 2 encoders with the following properties:

...
# Create H265 encoder element
h265_encoder = create_pipeline_element(
    "nvv4l2h265enc", "h265-encoder", "H265 Encoder", logger
)
h265_encoder.set_property("iframeinterval", 60)
h265_encoder.set_property("idrinterval", 60)
pipeline_elements.append(h265_encoder)

...
...

# Create H264 encoder element
h264_encoder = create_pipeline_element(
    "nvv4l2h264enc", "h264-encoder", "H264 Encoder", logger
)
h264_encoder.set_property("iframeinterval", 1)
h264_encoder.set_property("insert-sps-pps", True)
h264_encoder.set_property("idrinterval", 1)
pipeline_elements.append(h264_encoder)
...

I would like to configure those encoders to use constant quality mode on both of them instead of bitrate-based settings to maintain consistent video quality. After reviewing possible settings I found:

  • control-rate which might be set to 0 (variable_bitrate), 1 (constant_bitrate), 2

However except this one i cannot find any other settings that might be set on those elements to ensure constant quality.

Question
How can i configure those 2 encoders so that they work in constant quality mode? Are there any other properties that should be set to enable it?

“control-rate=2” means constantQP. In theory, small QP has a better video quality. the related parameters are cq, initqp, constqp.
please refer to the explanation in the doc. and you can use gst-inspect-1.0 nvv4l2h264enc or gst-inspect-1.0 nvv4l2h265enc to get the supported parameters.

@fanzh Thank You for the answer. I checked the plugins with gst-inspect-1.0 but I didn’t see the control-rate=2, I only saw 0 or 1. However in documentation it is clearly explained, Thank You.

On Jetson, the related parameters are ratecontrol-enable, quant-i-frames, quant-p-frames, quant-b-frames and qp-range.

And then on Jetson can You also set control-rate=2 or 1? As far as I checked, control_rate=2 is not enabled on Jetson, or my DeepStream/Gstreamer version is too old?

Also when it comes to ratecontrol-enable should it be set to 0 or 1? quant-p-frames requires setting ratecontrol-enable = 0 so i assume this is the correct value, right?

On Jetson, control-rate only does not support mode2 even with the latest DS7.1. yes, please set ratecontrol-enable to 0 if needing to set quant-p-frames.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.