Gstreamer error

When I’m running the object detection script. the following problem occurs:

Any suggestions on why this might be?

[WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (1757) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Internal data stream error.

[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (886) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created

It would be very hard to guess with so few details.
You may provide your object detection code, or at least the videoCapture part with the gstreamer pipeline.

Here is the code,
I am using IMX219-200

import jetson.inference
import jetson.utils
import cv2

net = jetson.inference.detectNet('ssd-mobilenet-v2', threshold = 0.5)

cap = cv2.VideoCapture(f'v4l2src device=/dev/video0 io-mode=2 ! image/jpeg, width=(int)3840, height=(int)2160 !  nvjpegdec ! video/x-raw, format=I420 ! appsink', cv2.CAP_GSTREAMER)

while True:
    success, img =
    imgCuda = jetson.utils.cudaFromNumpy(img)

    detections = net.Detect(imgCuda)
    for d in detections:
        # print(d)
        x1,y1,x2,y2 = int(d.Left),int(d.Top),int(d.Rifht),int(d.Bottom)
        className = net.GetClassDesc(d.ClassID)
        cv2.rectangle(img,(x1,y1), (x2,y2), (255,0,255),2)
        cv2.putText(img, className, (x1+5,y1+15), 0.75,(255,0,255),2)

    # img = jetson.utils.cudaToNumpy(imgCuda)
    cv2.imshow('image', img)

I don’t know about IMX219-200 in details, but I am unsure the driver provides jpeg format. Check with:

v4l2-ctl -d0 --list-formats-ext

My understanding would be that you would first install SDK from vendor (Seeed ?) including driver and maybe device tree.

Then as IMX219 is basically a bayer sensor, you would have to go with Argus that will handle debayering with ISP and auto-tune gains, exposure, white-balance…

So with gstreamer you would use nvarguscamerasrc plugin that would provide NV12 format into NVMM memory (you would then use nvvidconv for converting into BGRx and copy to system memory, then use videoconvert for providing BGR frames to opencv appsink.

But the simplest would just be using jetson-utils VideoSource with uri csi://0.

here is the list from the command

	Index       : 0
	Type        : Video Capture
	Pixel Format: 'RG10'
	Name        : 10-bit Bayer RGRG/GBGB
		Size: Discrete 3264x2464
			Interval: Discrete 0.048s (21.000 fps)
		Size: Discrete 3264x1848
			Interval: Discrete 0.036s (28.000 fps)
		Size: Discrete 1920x1080
			Interval: Discrete 0.033s (30.000 fps)
		Size: Discrete 1640x1232
			Interval: Discrete 0.033s (30.000 fps)
		Size: Discrete 1280x720
			Interval: Discrete 0.017s (60.000 fps)

when I’m changing cap = cv2.VideoCapture(‘csi://0’, cv2.CAP_GSTREAMER)
cap, the error is still there

This uri is for jetson-utils VideoSource, not for gstreamer.

First check if your camera works in pure gstreamer mode (this would validate driver and Argus). This assumes that your Jeston is not headless, but have a monitor attached :

gst-launch-1.0 -v nvarguscamerasrc ! 'video/x-raw(memory:NVMM),format=NV12,width=1280,height=720,framerate=30/1' ! autovideosink

I got this:

Got EOS from element "pipeline0".

Execution ended after 0:00:00.120951126

Setting pipeline to PAUSED ...

Setting pipeline to READY ...

Setting pipeline to NULL ...

Freeing pipeline ...

Did you install SDK from vendor ? By default, only RPi v2 cam model would be supported.

I am not sure, is there any way to check?

I think that if having done this, and especially if having to install a custom device tree you would remember as it is not obvious.
You may check if reading from V4L works:

v4l2-ctl -d /dev/video0 --set-fmt-video=width=1280,height=720,pixelformat=RG10 --set-ctrl bypass_mode=0 --stream-mmap 

If not working, you’d better contact camera vendor support for installing this.

Once you get the camera working, you may post again for further help.

anyone, any suggestions?

It looks like the camera source is not ready. You may contact camera vendor to help you enable the camera. Or can buy a Raspberry Pi camera v2 which is supported by default.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.