I have a script that generates different combinations of H.264/265, bitrate and control-rate (0=VBR,1=CBR), e.g.:
==> h265 br=1000000
gst-launch-1.0 filesrc location=../src.mjpeg ! 'image/jpeg,framerate=200/1,width=192,height=192' ! nvjpegdec idct-method=float ! 'video/x-raw(memory:NVMM),format=I420' ! nvvidconv ! nvv4l2h265enc bitrate=1000000 control-rate=0 ! filesink location=nv_h265_br1000000_ctrl0_patchedgstjpg.h265
==> h265 br=1000000
gst-launch-1.0 filesrc location=../src.mjpeg ! 'image/jpeg,framerate=200/1,width=192,height=192' ! nvjpegdec idct-method=float ! 'video/x-raw(memory:NVMM),format=I420' ! nvvidconv ! nvv4l2h265enc bitrate=1000000 control-rate=1 ! filesink location=nv_h265_br1000000_ctrl1_patchedgstjpg.h265
However, the control-rate parameter has no effect, the produced files are identical.
How do I enable variable bitrate in the H.264/H.265 GStreamer encoder?
I found this three-year-old semi-related topic TX1 H265 encode rate-control mode VBR/CBR, which indicates that this should be supported by now.
ls -l
total 389496
-rw-r--r-- 1 coudy staff 36951567 8 Apr 15:01 nv_h264_br1000000_ctrl0_patchedgstjpg.h264
-rw-r--r-- 1 coudy staff 36951567 8 Apr 15:01 nv_h264_br1000000_ctrl1_patchedgstjpg.h264
-rw-r--r-- 1 coudy staff 3763402 8 Apr 15:01 nv_h264_br100000_ctrl0_patchedgstjpg.h264
-rw-r--r-- 1 coudy staff 3763402 8 Apr 15:01 nv_h264_br100000_ctrl1_patchedgstjpg.h264
-rw-r--r-- 1 coudy staff 7466901 8 Apr 15:01 nv_h264_br200000_ctrl0_patchedgstjpg.h264
-rw-r--r-- 1 coudy staff 7466901 8 Apr 15:01 nv_h264_br200000_ctrl1_patchedgstjpg.h264
-rw-r--r-- 1 coudy staff 1780226 8 Apr 15:01 nv_h264_br50000_ctrl0_patchedgstjpg.h264
-rw-r--r-- 1 coudy staff 1780226 8 Apr 15:01 nv_h264_br50000_ctrl1_patchedgstjpg.h264
-rw-r--r-- 1 coudy staff 36885668 8 Apr 15:01 nv_h265_br1000000_ctrl0_patchedgstjpg.h265
-rw-r--r-- 1 coudy staff 36885668 8 Apr 15:01 nv_h265_br1000000_ctrl1_patchedgstjpg.h265
-rw-r--r-- 1 coudy staff 3714848 8 Apr 15:01 nv_h265_br100000_ctrl0_patchedgstjpg.h265
-rw-r--r-- 1 coudy staff 3714848 8 Apr 15:01 nv_h265_br100000_ctrl1_patchedgstjpg.h265
-rw-r--r-- 1 coudy staff 7403316 8 Apr 15:01 nv_h265_br200000_ctrl0_patchedgstjpg.h265
-rw-r--r-- 1 coudy staff 7403316 8 Apr 15:01 nv_h265_br200000_ctrl1_patchedgstjpg.h265
-rw-r--r-- 1 coudy staff 1729854 8 Apr 15:01 nv_h265_br50000_ctrl0_patchedgstjpg.h265
-rw-r--r-- 1 coudy staff 1729854 8 Apr 15:01 nv_h265_br50000_ctrl1_patchedgstjpg.h265