DeepStream 4.0) nvmux: Input buffer number of surfaces (-336860181) must be equal to mux->num_surfaces_per_frame

Hi,

Thanks for the release of DeepStream 4.0!

I just gave it a try with some of my test pipelines on Xavier.

The following worked on EA, but not on GA.

NO CAPS

nvstreammux width=1920 height=1080 batch-size=1 batched-push-timeout=33000000 name=nvmux ! nvinfer config-file-path=dstest1_pgie_config.txt ! nvvideoconvert ! nvdsosd ! nvegltransform ! nveglglessink sync=False \
videotestsrc num-buffers=9000 is-live=true ! "video/x-raw,width=1920,height=1080,framerate=30/1,format=NV12" ! nvvideoconvert ! nvmux.sink_0

Log

deepstream_sdk_v4.0_jetson/sources/apps/sample_apps/deepstream-test1$ gst-launch-1.0 nvstreammux width=1920 height=1080 batch-size=1 batched-push-timeout=33000000 name=nvmux ! nvinfer config-file-path=dstest1_pgie_config.txt ! nvvideoconvert ! nvdsosd ! nvegltransform ! nveglglessink sync=False videotestsrc num-buffers=9000 is-live=true ! "video/x-raw,width=1920,height=1080,framerate=30/1,format=NV12" ! nvvideoconvert ! nvmux.sink_0
Setting pipeline to PAUSED ...

Using winsys: x11 
Creating LL OSD context new
0:00:01.040580871 26708   0x558de7e630 INFO                 nvinfer gstnvinfer.cpp:519:gst_nvinfer_logger:<nvinfer0> NvDsInferContext[UID 1]:initialize(): Trying to create engine from model files
0:00:38.079952770 26708   0x558de7e630 INFO                 nvinfer gstnvinfer.cpp:519:gst_nvinfer_logger:<nvinfer0> NvDsInferContext[UID 1]:generateTRTModel(): Storing the serialized cuda engine to file at /home/emi/projects/deepstream_sdk_v4.0_jetson/samples/models/Primary_Detector/resnet10.caffemodel_b1_int8.engine
Pipeline is live and does not need PREROLL ...
Got context from element 'eglglessink0': gst.egl.EGLDisplay=context, display=(GstEGLDisplay)NULL;
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Creating LL OSD context new
ERROR: from element /GstPipeline:pipeline0/GstNvStreamMux:nvmux: Input buffer number of surfaces (-336860181) must be equal to mux->num_surfaces_per_frame (1)
	Set nvstreammux property num-surfaces-per-frame appropriately

Additional debug info:
/dvs/git/dirty/git-master_linux/deepstream/sdk/src/gst-plugins/gst-nvmultistream/gstnvstreammux.c(308): gst_nvstreammux_chain (): /GstPipeline:pipeline0/GstNvStreamMux:nvmux
Execution ended after 0:00:00.138949701
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

This is simply a NOCAPS version of the followings that work fine.

RGBA

nvstreammux width=1920 height=1080 batch-size=1 batched-push-timeout=33000000 name=nvmux ! nvinfer config-file-path=dstest1_pgie_config.txt ! nvvideoconvert ! nvdsosd ! nvegltransform ! nveglglessink sync=False \
videotestsrc num-buffers=9000 is-live=true ! "video/x-raw,width=1920,height=1080,framerate=30/1,format=NV12" ! nvvideoconvert ! "video/x-raw(memory:NVMM),width=(int)1920,height=(int)1080,format=RGBA" ! nvmux.sink_0

NV12

nvstreammux width=1920 height=1080 batch-size=1 batched-push-timeout=33000000 name=nvmux ! nvinfer config-file-path=dstest1_pgie_config.txt ! nvvideoconvert ! nvdsosd ! nvegltransform ! nveglglessink sync=False \
videotestsrc num-buffers=9000 is-live=true ! "video/x-raw,width=1920,height=1080,framerate=30/1,format=NV12" ! nvvideoconvert ! "video/x-raw(memory:NVMM),width=(int)1920,height=(int)1080,format=NV12" ! nvmux.sink_0

The error message suggests to set num-surfaces-per-frame, but does it make such a difference between WITH and WITHOUT cap?

Thanks.

Hi,
It looks OK if we must configure caps in sink pad of nvstreammux. It is to ensure caps is OK to go before transiting to PLAYING state.

Yeah, I agree. But the error looked far from an expectation of with or without caps. So I would like to know what’s happening inside,
out of curiosity.

I will check it with more logging, and see if it indicates any.

@TakenoriSato, did you figure out what that error was? I am hitting the same error in my pipeline.

Thanks

Hi, no, I haven’t checked any further. Can’t you avoid the error by adding a caps filter?

No luck, tried with a capsfilter and doing a nvvidconv and it keeps giving me the same error.

Hi,
Please upgrade to DS4.0.1 and refer to samples in

/opt/nvidia/deepstream/deepstream-4.0/sources/apps/sample_apps/

I still get the same error:

0:00:13.284278022  6958   0x7f24005a30 WARN             nvstreammux gstnvstreammux.c:309:gst_nvstreammux_chain:<streammux> error: Input buffer number of surfaces (0) must be equal to mux->num_surfaces_per_frame (1)
	Set nvstreammux property num-surfaces-per-frame appropriately

I gave up with using it with a string-based gstreamer pipeline and now I am using deepstream-app and extending it to support what I want. That seems to work better.

Hi estebanp
I had the same issue (Input buffer number of surfaces (0) must be equal to num_surfaces_per_frame (1)) when i launched my custom-c+±created pipeline. Deepstream-app works just fine so i’ve decided to find some difference (it should be) AND
there are some options set for nvarguscamerasrc :

  gst_element_factory_make (NVDS_ELEM_SRC_CAMERA_CSI, "src_elem");

(1) g_object_set (G_OBJECT (bin->src_elem), “bufapi-version”, TRUE, NULL);
g_object_set (G_OBJECT (bin->src_elem), “maxperf”, TRUE, NULL);

(1) - does the trick (no issue appears for me). You may try it if it is still actual.

4 Likes

thank you i was able to fix my problem with your solution