Hello!
I am working using Jetson’s h.265 encoder. Recently started using ROI features more, in an attempt to prioritise certain video areas, and “deprioritise” others.
Now, the way one creates ROI is via v4l2_enc_ROI_param; structure. It contains the ROI rectangle, and a signed value QPdelta. My understanding (there is very little documentation) is that this value is added to the QP the encoder would set in the ROI. And so:
- Negative QPdelta changes the QP to the smaller value, therefore making quantisation less strong and yielding higher quality/more details
- Positive QPdelta changes the QP to the bigger value, so quantisation is stronger and quality gets lower/less details
I tried working with ROIs with negative deltas first, and it seemed to work. Areas within ROI were generally of higher quality. Then I tried setting positive deltas and that failed the following way:
- If the ROI area is within certain range (I was using 1920x360 at 0,0 for Full HD resolution, so basically topmost 1/3 of a video frame) setting QPdelta to any positive value, even “1” results in HUGE files. My example was literally 100x bigger than the same .yuv stream encoded with same ROI and QPdelta of “-1”
- Smaller ROIs do not carry “super heavy” penalty, for example when I tried 1100x360 the stream size was OK but still, with QPdelta set to “1” I got higher quality in the ROI itself and lower quality elsewhere, which is opposite of what I would expect.
I did some testing using the 01_video_encode
Jetson sample and the following command: /usr/src/jetson_multimedia_api/samples/01_video_encode/video_encode ../videos/input.nv12.yuv 1920 1080 H265 output.h265 --sp -rc vbr -br 2000000 --input-metadata --eroi -roi roi.txt
And the roi.txt had one line:
1 1 0 0 1920 360
This caused “huge output” effect. It doesn’t appear when the roi.txt is:
1 -1 0 0 1920 360
To be honest this looks like a bug to me. Are positive QPdeltas even allowed? If so, how they were supposed to work?
My system is Jetson AGX, cat /etc/nv_tegra_release
returns # R32 (release), REVISION: 7.3, GCID: 31982016, BOARD: t186ref, EABI: aarch64, DATE: Tue Nov 22 17:32:54 UTC 2022
The input .yuv files used were all 1920x1080 NV12, some 800 frames long.
With best regards
Michal