NVArgusCameraSrc: IImageNativeBuffer not supported by Image.

Hello everyone!

I am developing a GStreamer application that reads images from a CSI-Camera, manipulates those images and sends them to two separate branches using the tee-element.

One branch saves images to the disk using a multifilesink and the other branch sends those images to an udpsink for further delivery. Each of those branches is connected to the tee-element via a queue-element. I think I should also mention that the “save images” branch is dynamically connected to the pipeline when another part of my project requests it.

My problem is that the “save images” branch always crashes after about 100 images with the following error:

(Argus) Error BadParameter:  (propagating from src/eglstream/ImageImpl.cpp, function initialize(), line 382)
(Argus) Error BadParameter:  (propagating from src/eglstream/ImageImpl.cpp, function copyToNvBuffer(), line 440)
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, threadExecute:476 IImageNativeBuffer not supported by Image.
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, threadFunction:177 (propagating)

My google search of that error didn’t turn up anything useful.
I also tried changing the queue parameters with no effect.

My pipeline looks like this:
(The pipeline is big and I don’t know how else I could show/explain it, sorry for the spam)

# Camera capture elements
source = Gst.ElementFactory.make("nvarguscamerasrc", "nvarguscamerasrc")
capsfilter = Gst.ElementFactory.make("capsfilter", "capsfilter")
nvvidconv = Gst.ElementFactory.make("nvvidconv", "nvvidconv")
tee = Gst.ElementFactory.make("tee", "tee")

# Bin for gather-testdata module
self.testdata = Gst.Bin.new("testdata")
# Bin for streaming module
self.streaming = Gst.Bin.new("streaming")

# Streaming elements
queue1 = Gst.ElementFactory.make("queue", "queue1")
encoder = Gst.ElementFactory.make("nvv4l2h265enc", "nvv4l2h265enc")
udpsink = Gst.ElementFactory.make("udpsink", "udpsink")

# Gather-testdata elements
queue2 = Gst.ElementFactory.make("queue", "queue2")
videorate = Gst.ElementFactory.make("videorate", "videorate")
framefilter = Gst.ElementFactory.make("capsfilter", "framefilter")
jpegenc = Gst.ElementFactory.make("nvjpegenc", "nvjpegenc")
identity = Gst.ElementFactory.make("identity", "identity")
multifilesink = Gst.ElementFactory.make("multifilesink","sink")

elements = [source, capsfilter, nvvidconv, tee, self.streaming, self.testdata, queue1, encoder, udpsink, queue2, videorate, framefilter, jpegenc, identity, multifilesink]

# Configure elements
source.set_property("maxperf", True)
source.set_property("do-timestamp", True)
caps = Gst.caps_from_string("video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, framerate=(fraction)30/1, format=(string)NV12")
capsfilter.set_property("caps", caps)
nvvidconv.set_property("flip-method", 2)

queue1.set_property("flush-on-eos", True)
encoder.set_property("maxperf-enable", True)
encoder.set_property("bitrate", 1000000)
encoder.set_property("insert-sps-pps", True)

queue2.set_property("flush-on-eos", True)
caps = Gst.caps_from_string("video/x-raw(memory:NVMM), framerate=(fraction)5/1, format=(string)NV12, width=(int)1920, height=(int)1080")
framefilter.set_property("caps", caps)

identity.connect("handoff", self.on_handoff)

multifilesink.set_property("post-messages", True)
multifilesink.set_property("location", car.config.TESTDATA_LOCATION + "frame%d.jpg")

# Add elements to pipeline and bin
self.streaming.add(queue1)
self.streaming.add(encoder)
self.streaming.add(udpsink)
pad = queue1.get_static_pad("sink")
ghostpad = Gst.GhostPad.new("sink", pad)
self.streaming.add_pad(ghostpad)

self.testdata.add(queue2)
self.testdata.add(videorate)
self.testdata.add(framefilter)
self.testdata.add(jpegenc)
self.testdata.add(identity)
self.testdata.add(multifilesink)
pad = queue2.get_static_pad("sink")
ghostpad = Gst.GhostPad.new("sink", pad)
self.testdata.add_pad(ghostpad)

self.pipeline.add(source)
self.pipeline.add(capsfilter)
self.pipeline.add(nvvidconv)
self.pipeline.add(tee)
self.pipeline.add(self.streaming)
        
# Link all elements that can be automatically linked
source.link(capsfilter)
capsfilter.link(nvvidconv)
nvvidconv.link(tee)

queue1.link(encoder)
encoder.link(udpsink)

queue2.link(videorate)
videorate.link(framefilter)
framefilter.link(jpegenc)
jpegenc.link(identity)
identity.link(multifilesink)

# Manually link the tee_pads because they are "request"-pads
tee_streaming_pad = tee.get_request_pad("src_%u")
streaming_pad = self.streaming.get_static_pad("sink")
tee_streaming_pad.link(streaming_pad)

Any help is much appreciated!

Hi,
Please share which Jetson platform you use and the release version( $ head -1 /etc/nv_tegra_release )

Hi!
Sorry for the late response.

I am currently unable to provide the information as the device in question is not at hand.
I know that it is a Jetson Nano (Developer Kit) with JetPack 4.3, Multimedia API version 32.3 and DeepStream 4.0.2 installed.

However, after precarious testing I narrowed down the problem. The error is caused by the nvjpegenc-element. I switched it for the regular jpegencoder (which can be found here: https://gstreamer.freedesktop.org/documentation/jpeg/jpegenc.html?gi-language=c) and it worked successfully. Before new buffers reach the jpegencoder I had to convert them from “video/x-raw(memory:NVMM)” to “x-raw” because the new jpegencoder does not support the original format.

Now the branch has to look like this:

... tee ! queue ! videorate ! "video/x-raw(memory:NVMM), framerate=(fraction)5/1, format=(string)NV12, width=(int)1920, height=(int)1080" ! nvvidconv ! "video/x-raw, framerate=(fraction)5/1, format=(string)NV12, width=(int)1920, height=(int)1080" ! jpegenc ! identity ! multifilesink

I am not sure what caused the problem. Maybe I misconfigured the nvjpegenc-element?

Hi,
Please try the prebuilt lib in https://elinux.org/L4T_Jetson/r32.3.x_patch
[GSTREAMER]streaming using jpegenc halts after a short delay

Thanks for the help!