• TensorRT Version• NVIDIA GPU Driver Version (valid for GPU only) Driver Version: 535.129.03
• Issue Type (questions, new requirements, bugs)
Hello, everyone. I am trying to use DeepStream and GStreamer to change the bitrate of nvv4l2h264enc at runtime. According to the output of gst-inspect-1.0 nvv4l2h264enc, it seems that the bitrate can only be changed when the pipeline is in the NULL or READY state:
bitrate : Set bitrate for v4l2 encode ** flags: readable, writable, changeable only in NULL or READY state** ** Unsigned Integer. Range: 0 - 4294967295 Default: 4000000**
I tried to change it at runtime, no error occurred, but the bitrate change did not take effect.
Is there any method to change the bitrate of the nvv4l2h264enc encoder at runtime?
I am designing an algorithm to study the transmission issues in low-latency real-time interactive scenarios. In this scenario, the client predicts bandwidth and sends a request to the server. The server then encodes video frames at the bitrate requested by the client. Therefore, I need to dynamically modify the bitrate while GStreamer is in the playing state. How can I achieve this?
Thanks for the sharing! currently nvv4l2h264enc only support changing bitrate in the NULL or READY state. you can adjust peak-bitrate in PLAYING state.
ok, thanks for your reply. In my knowledge, peak-bitrate is a parameter used to set the peak bitrate in VBR mode. It can only set the peak bitrate for encoder in VBR mode but is difficult to control the video bitrate as precisely as CBR mode, all right?
Besides, I’ve seen some forum posts discussing modifying the NVENC encoder bitrate at runtime, for example:
This confuses me. Is it because other frameworks have implemented this feature, but DeepStream does not support it yet?
I am sorry for not testing it myself as I rarely use C++ and prefer Python. But, following the test2, I implemented it in Python as shown in my previous post. After modifying the encoder’s bitrate in this way, I successfully modified the encoder’s bitrate attribute without any errors at runtime. However, the encoded video did not change visually. For example, when I reduced the bitrate from 10 Mbps to 500 kbps, the encoder’s bitrate attribute changed accordingly, but there was no visible change in the video output. It’s emmm… amazing :).
the topic above is on Jetson. I tested test2.zip on dgpu with DS7.0. after the first bitrate setting(2Mbps), the bitrate is close to 2Mbps. After the second bitrate setting(4Mbps), the bitrate is close to 3Mbps, not 4Mbps. here is the log:
Default bit rate is 2Mbps
bitrate = 2348432 bps
bitrate = 2002560 bps
bitrate = 1558120 bps
bitrate = 1446424 bps
bitrate = 1940664 bps
bitrate = 1930560 bps
bitrate = 2035224 bps
Change bit rate to 4Mbps
bitrate = 1985696 bps
bitrate = 2343280 bps
bitrate = 2832752 bps
bitrate = 2586352 bps
bitrate = 2466888 bps
bitrate = 2720472 bps
bitrate = 2608872 bps
bitrate = 2635504 bps
bitrate = 2447008 bps
bitrate = 2350016 bps
bitrate = 3051416 bps
app sink receive eos
going to exit
Thanks for testing! Based on the results shown in the log, it seems that DeepStream is able to change the bitrate at runtime, but it cannot set the bitrate precisely?
Good news! I tested my code in DS7.0:
I successfully modified the encoder’s bitrate attribute without any errors at runtime, and the encoded video changed visually!