nvoverlaysink YUV 420SP NVMAP_IOC_WRITE failed

Hi,

I’m facing issue while trying to render YUV 420SP content using gstreamer on Jetson TX1 with R23.2. This is the command I am using.

.

gst-launch-1.0 filesrc location=sample_420SP.yuv ! videoparse width=1920 height=1088 framerate=1/1 format=23 ! nvoverlaysink

It plays out the video but the chorma is not proper. Also, the below error is reported for every frame

NVMAP_IOC_WRITE failed: Invalid argument

However, if I try to render YUV 420P it plays out without any issues. I used the below command for rendering 420P.

gst-launch-1.0 filesrc location=sample_420P.yuv ! videoparse width=1920 height=1088 framerate=1/1 format=2 ! nvoverlaysink

Can someone please help me understand what the issue could be?

One more observation, when using mp4 file as a input, and omxh264dec to decode with nvoverlaysink as video sink, the video plays out fine ( i.e. the chroma is displayed correctly). Also the omxh264dec outputs raw video in YUV 420 Semi Planar format, which is the same format I am trying to use. I tried to dump raw video after decode and use it with the pipeline I have mentioned above. I still see the same distorted video.

Any help or suggestion will be appreciated.

Hi

When working with raw files, in my experience it is necessary to add the blocksize parameter to the filesrc. Furthermore it may be necessary to transfer the raw video to the NVMM memory before sending it to nvoverlaysink.

I tried something like this:

gst-launch-1.0 videotestsrc num-buffers=120 ! 'video/x-raw, width=1920, height=1088, framerate=30/1, format=NV12' ! filesink location=/home/ubuntu/test_nv12.yuv

gst-launch-1.0 filesrc location=test_nv12.yuv blocksize=3110400 ! videoparse width=1920 height=1088 format=23 framerate=30/1 ! nvvidconv ! 'video/x-raw(memory:NVMM), width=1920, height=1088, format=NV12, framerate=30/1' ! nvoverlaysink

Or

gst-launch-1.0 filesrc location=test_nv12.yuv blocksize=3110400 ! videoparse width=1920 height=1088 format=23 framerate=30/1 ! videoconvert ! videoscale ! xvimagesink

Colors seem to be correct, but the format is somehow distorted.
To calculate the blocksize:

width x height x (number of bytes per pixel)

420 formats have 12 bit per pixel, i.e. 1.5 byte per pixel.

Hope that helps

1 Like