The following gstreamer pipeline fragment with encode (video) into a 200kps bandwidth-limited stream:
x265enc bitrate=140 option-string=“vbv-maxrate=200:vbv-bufsize=800”
The video is typically VGA quality at this low bit rate, but this is adequate for my purposes.
Is there a way to get the same effect with either of the Jetpack hardware H.265 encoders?
(i.e. omxh265enc or nvv4l2h265enc)
My experience, thusfar, is that target bitrate is not respected on these hardware encoders and that cbr (constant bit rate) mode does not work.
This seems like it would be a common use case.
What am I missing?
DaneLLL and others who have struggled to get constant bit rate H.265 encoding to work on the Jetson:
The bitrate property of nvv4l2h265enc and omxh.265enc is specified in bits per second – not kilobits per second!
Setting the vbv-size property explicitly is not necessary.
If you specify a bitrate that is too low, the encoder will quietly ignore it. If trying to achieve a low-bit rate, test with lo-res video initially, then increase the resolution until the bitrate output from the encoder begins to increase. (until it starts overriding your specified bit rate)
The omxh265enc is superior to the nvv4l2h265enc in producing low bit-rate streams relatively free of artifacts.
Here are the omxh265 encoder properties that work for me:
omxh265enc bitrate=$((BITRATE*1000)) control-rate=2 EnableTwopassCBR=1 EnableStringentBitrate=1
where BITRATE is the (usual) target kilobits/s
I found this would encode 768x432x30fps video at ~150kbps or any other BITRATE I choose > 150kbps.
Please document that your bitrate units are in bits/s, especially given that the other gstreamer encoders use kilobits/s
Thanks for the sharing. We did not notice x264enc has bitrate in kbit/sec. Will check to add bit/sec in gst-inspect-1.0 nvv4l2h264enc in future release.
The omx plugins are not maintained for a while, if you see stability issues, we would encourage to use v4l2 plugins.
We do see CBR +virtual buffer size working in most cases. Probably it does not has significant difference in your use-case.