Deepstream USB Python Example GST Pipeline Fails

Please provide complete information as applicable to your setup.

• Jetson Xaiver NX
• DeepStream 5.1
• JetPack Version 4.5.1

I’m attempting to modify the following deepstream python example application to utilize my USB camera:

Example Line

Which gives the following error:

Error: gst-stream-error-quark: Internal data stream error. (1): gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:usb-cam-source:
streaming stopped, reason not-negotiated (-4)

Using the below line I am able to connect and stream the video feed:

gst-launch-1.0 -v v4l2src device=/dev/video0 ! image/jpeg, width=640, height=480, framerate=30/1, format=MJPG ! jpegparse ! jpegdec ! xvimagesink

I’ve attempted to modify the python example from above with the below:

caps_v4l2src.set_property(‘caps’, Gst.Caps.from_string(“image/jpeg, width=640, height=480, framerate=30/1, format=MJPG ! jpegparse ! jpegdec ! xvimagesink”))

Which continues to give the above error.

I’m looking for guidance on the correct method for inserting parameters into the python GST feed so that it would operate as my test stream.

Thanks!

You need try to replace v4l2src with “v4l2src device=/dev/video0 ! image/jpeg, width=640, height=480, framerate=30/1, format=MJPG ! jpegparse ! jpegdec” in your pipeline as your camera output is jpeg. Or you can replace one camera with yuv output.

I seem to be having trouble finding the correct format for converting my gst-launch test into the python format.

I found this link which seems to describe the breakdown:

gstreamer usage

However it is still not clear what elements I need and how I set the properties for these elements to make the conversion work.

Here it the document for GStreamer.

https://gstreamer.freedesktop.org/documentation/tutorials/index.html?gi-language=c

Thanks for the link.

I was able to build the pipline using the Gst Element factory. I’ve attached the program for anyone else looking to decode MJPEG cameras streams.

This is the Gst stream that is built using the element factory.

gst-launch-1.0 v4l2src device=/dev/video0 ! ‘image/jpeg,width=640,height=480,framerate=30/1’ ! jpegdec ! nvvideoconvert ! ‘video/x-raw(memory:NVMM),format=NV12’ ! mux.sink_0 nvstreammux live-source=1 name=mux batch-size=1 width=640 height=480 ! nvinfer config-file-path=/opt/nvidia/deepstream/deepstream-5.1/sources/apps/sample_apps/deepstream-test1/dstest1_pgie_config.txt batch-size=1 ! nvmultistreamtiler rows=1 columns=1 width=640 height=480 ! nvegltransform ! nveglglessink

TmpTest.py (11.3 KB)

Thanks for your help.