[solved] Nvbufsurface: Error in allocating buffer when using nvvideoconvert to fakesink on Jetson Nano

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU)
Jeson Nano, RTX 2060 / GTX 1080
• DeepStream Version
5.0
• JetPack Version (valid for Jetson only)
4.4
• TensorRT Version
7.1.3
• NVIDIA GPU Driver Version (valid for GPU only)
440

I am using Gstd + Gst-Interpipe for flexible pipelines, following these examples:
Nvidia Blog
RidgeRun Wiki

I am trying to make one pipeline for buffers converted to NVMM coming from the v4l2 camera, so I can later use it for output/encode/inference (just like in the examples above). There is no issues with this on dGPU, but on Jetson Nano I get the following:

$ GST_DEBUG=nvdspool:5 gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,format=YUY2,width=640,height=480 ! videoconvert ! nvvideoconvert ! video/x-raw\(memory:NVMM\),width=640,height=480 ! interpipesink name=video0_sink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
0:00:00.381230898 25980   0x5577d96940 DEBUG               nvdspool gstnvdsbufferpool.c:420:gst_nvds_buffer_pool_start:<nvdsbufferpool0> start
0:00:00.381306160 25980   0x5577d96940 DEBUG               nvdspool gstnvdsbufferpool.c:463:gst_nvds_buffer_pool_alloc_buffer:<nvdsbufferpool0> alloc_buffer
nvbufsurface: invalid colorFormat 0
nvbufsurface: Error in allocating buffer
Error(-1) in buffer allocation

** (gst-launch-1.0:25980): CRITICAL **: 12:22:07.601: gst_nvds_buffer_pool_alloc_buffer: assertion 'mem' failed
ERROR: from element /GstPipeline:pipeline0/Gstnvvideoconvert:nvvideoconvert0: failed to activate bufferpool
Additional debug info:
gstbasetransform.c(1670): default_prepare_output_buffer (): /GstPipeline:pipeline0/Gstnvvideoconvert:nvvideoconvert0:
failed to activate bufferpool
Execution ended after 0:00:00.176360403
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

I can replace interpipesink with fakesink and get the same result, which leads me to think it’s not a problem with interpipes/gstd. Running exactly the same on the dGPU works perfectly and I can get the interpipes to work. Any suggestions as to why this might happen only on Jetson?

Your title says failure on dGPU, but the information in the description says you are using Jetson Nano and RTX 2060 / GTX 1080. Jetson Nano is not dGPU. So what on earth are you running your case on?
Do you mean you run the pipeline in Building a Multi-Camera Media Server for AI Processing on the NVIDIA Jetson Platform | NVIDIA Technical Blog and met problem?
The Building a Multi-Camera Media Server for AI Processing on the NVIDIA Jetson Platform | NVIDIA Technical Blog sample is only applicable with Jetson, it is developed and tested on Jetson, so it may not workable on dGPU.
With Jetson, can you try the following pipeline:

gst-launch-1.0 v4l2src device=/dev/video0 ! ‘video/x-raw,format=YUY2,width=640,height=480’ ! videoconvert ! ‘video/x-raw, width=640,height=480,format=NV12’ ! nvvideoconvert ! ‘video/x-raw(memory:NVMM),width=640,height=480’ ! fakesink

Hi Fiona, the title says “works on dGPU”. The description says “Jeson Nano, RTX 2060 / GTX 1080”, which is the hardware I tested this on. Halfway through I say

There is no issues with this on dGPU, but on Jetson Nano I get the following:

The pipeline does not work on Jetson, with the errors above. The same pipeline works on dGPU without any issues.

it is developed and tested on Jetson, so it may not workable on dGPU

Exactly the opposite in my case. Apologies if this is not clear enough, I’ll edit the title, did you read through the post contents?

With Jetson, can you try the following pipeline:

gst-launch-1.0 v4l2src device=/dev/video0 ! ‘video/x-raw,format=YUY2,width=640,height=480’ ! videoconvert ! ‘video/x-raw, width=640,height=480,format=NV12’ ! nvvideoconvert ! ‘video/x-raw(memory:NVMM),width=640,height=480’ ! fakesink

Jetson and dGPU are quite different.

Appreciate your help. Indeed, the pipeline you suggested worked fine. Am I correct to assume that nvbufsurface: invalid colorFormat 0 indicates that the caps were not setup correctly to nvvideoconvert and NV12 pixel format is required?

Yes. nvvideoconvert support many kinds of caps, but with Jetson platform there is only limited types supported, we need to set it explicitly.

Got it. I also see that it is included in both examples and I have failed to notice it. Thank you for your help again!