ROI encoding remain every frame

I am trying to encode video ROI using jetson mmapi.

./video_encode ./input.yuv 1920 1080 H264 ./output.h264 --eroi -roi test.cfg --input-metadata

I ran the above command.
The number of frames in the video is 591.

In test.cfg
1 30 0 0 500 500
… for 50 frames
0 0 0 0 0 0
… for rest of the frame

It was expected that only the first 50 frames would be ROI_encoded.
And from then on, it was expected to be encoded the same as the other parts.
However, when i checked the results, the ROI encoding performed with 1 30 0 0 500 500 remained even after that.

How can i prevent ROI encoding from being preserved?

Hi,
Please check populate_roi_Param() in 01_video_encode. When it reads to end of file, it seeks to start and reads the setting again:

        cout << "EOF of ROI_param_file & rewind" << endl;
        stream->clear();
        stream->seekg(0);

You may remove the code and try again.

Thanks for reply.

I did as you said, even after i cleared that code and ran it, the ROI remained.
So, by initializing the QPdelta of the ROI to 0 at the end of test.cfg like 1 0 0 0 500 500, i was able to solve the problem.
Do i have to reset QPdelta to 0 every time to initialize ROI encoding?

Hi,
If the frame does not need to set ROI, please not to set this flag:

VEnc_imeta_param.flag |= V4L2_ENC_INPUT_ROI_PARAM_FLAG;

Please apply this and give it a try.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.