The problem of compression using MM api's 01_video_encode on TX2

I have successfully verified the correctness of video encoding with 01_video_encode, but my project requires me to use 01_video_encode for adjustable intraframe encoding of still images.
We need to adjust the bitrate to control the size of the stream to control the compression ratio. According to the formula:
Target bitrate= (resolution of image×yuv parameter×8×fps)/(target compression ratio)
If we want the compression ratio to be 30 , then we can get a target bit rate. Such a setup has been successfully verified in video encoding, but when I want to compress a still image, fps is set to 1 1, and this control has an error. Here is the command line:

nvidia@tegra-ubuntu:~/tegra_multimedia_api/samples/01_video_encode$ video_encode /home/nvidia/Downloads/test1_4k_yuv420.yuv 4096 2160 H265 output_4k_yuv420_3M5.hevc -br 3538944 -rc vbr -ifi 1 -fps 1 1

The following is the result:

Failed to query video capabilities: Inappropriate ioctl for device
NvMMLiteOpen : Block : BlockType = 8
===== MSENC =====
NvMMLiteBlockCreate : Block : BlockType = 8
892744264
842091865
Could not read complete frame from input file
File read complete.
===== NVENC blits (mode: 1) into block linear surfaces =====
App run was successful

Therefore, the entire encoding process is successfully completed, and the compressed code stream of the still image can be obtained, and finally can be decoded and displayed by ffmpeg, but I am confused how to control the compression factor of the still image. Do you have any way to solve this problem?

Hi,
We suggest you configure qp value directly. Please refer to ‘–elossless’.
With the option, it configures qp=0 to all frames.

if (ctx.enableLossless)
{
    ret = ctx.enc->setConstantQp(0);
    TEST_ERROR(ret < 0, "Could not set encoder constant qp=0", cleanup);
}

You may try 0-50 to get target bitrate.