[MMAPI][00_video_decode] Why the bottom of the decoded image has a green aera,when not use conv

In decoding H.265 format, the resolution of the file is relatively low, the effect is particularly evident

Record H.265 file commands:

gst-launch-1.0 -e nvcamerasrc fpsRange="30.0 30.0" ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! \
nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), width=(int)176, height=(int)144, format=(string)I420' ! omxh265enc bitrate=2000000 ! \
'video/x-h265, stream-format=(string)byte-stream' ! filesink location=test.h265 -e

Program operating parameters:

./video_decode test.h265 H265 -wx 0 -wy 0 -ww 960 -wh 540 --stats

If you use videoconv there is no problem

./video_decode test.h265 H265 -wx 0 -wy 0 -ww 960 -wh 540

I found the function dec->capture_plane.getFormat(format) to get the video width and height is not correct(width=192, height=160), and then use capture_plane.setFormat(format) to set the correct parameters into, no effect

Hi Li,
The HW decoder outputs aligned buffers. Another case is that 1920x1080 content is decoded to 1920x1088 buffers.

Hi DaneLLL,

So, VideoDecoder must connect a VideoConverter?
Can I set the minimum alignment unit for the decoder?

Hi Li,
It is better to use VideoConverter because it is done by HW.

Or you can copy valid data to another buffer via CPU.UPDATE[05/09/2017]This cannot work

Hi DaneLLL,

Why the same resolution(176x144), H264 decoding with out videoConverter, there is no green area ?

gst-launch-1.0 -e nvcamerasrc fpsRange="30.0 30.0" ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! \
nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), width=(int)176, height=(int)144, format=(string)I420' ! omxh264enc bitrate=2000000 ! \
'video/x-h264, stream-format=(string)byte-stream' ! filesink location=test.h264 -e
./video_decode test.h264 H264 -wx 0 -wy 0 -ww 960 -wh 540 --stats

Hi LI,

gst-launch-1.0 -e nvcamerasrc fpsRange="30.0 30.0" num-buffers=30 ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), width=(int)176, height=(int)144, format=(string)I420' ! omxh264enc bitrate=2000000 ! matroskamux ! filesink location= 264.mkv

The media info from VLC:
Resolution: 176x162
Display resolution: 176x144

gst-launch-1.0 -e nvcamerasrc fpsRange="30.0 30.0" num-buffers=30 ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), width=(int)176, height=(int)144, format=(string)I420' ! omxh265enc bitrate=2000000 ! matroskamux ! filesink location= 265.mkv

Resolution: 176x160
Display resolution: 176x144

So the difference you observe is that 264 decoder internally performs cropping via VideoConverter.

Hi DaneLLL,

How to copy valid data to another buffer via CPU.
Is there a reference code for this operation?

I set:

ret =
		dec->capture_plane.setupPlane(V4L2_MEMORY_USERPTR,
				min_dec_capture_buffers + 5, false,
				true);

However, when render(dec_buffer->planes[0].fd) is called, a Segmentation fault occurs and printing

nvbuf_utils: dmabuf_fd -1 mapped entry NOT found

Hi Li,
My apology for the bad comment. The decoded data is in block linear memory format and you always need NvVideoConverter to convert it to pitch linear memory format.

[Copy valid data to another buffer via CPU] cannot work.

In addition to adding the videoConverter, is there another way to solve the green edge problem?
Can we let the renderer read YUV by user width and height?

Hi Li, please use NvVideoConverter.

Hi,DaneLLL

Thank you for your reply.
After using the new library in the post, my video multi-channel decoding program can run well.
[url]https://devtalk.nvidia.com/default/topic/1006857/-mmapi-under-what-conditions-lsquo-conv-gt-capture_plane-qbuffer-rsquo-will-block/[/url]