Gstreamer issue streaming USB camera from Xavier NX over UDP

Hi all,
I’m currently quite fresh to using Gstreamer so forgive me if there is any missing information; this is my first time using it for streaming footage for a project so there is a lot I am still unaware of and would love any advice you could give me.
For the purpose of the project I will need to stream a USB camera connected to my Xaxier NX to another machine over UDP. Whilst testing the pipeline I am using the same Xavier NX however I have tried a different machine and am having the same problem.

Although the script is not showing up with any errors, the client is stuck at “New clock: Gstsystemclock” though will not open up a new window to view the stream.

Server Code:

gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! video/x-raw,framerate=30/1 ! x264enc speed-preset=ultrafast tune=zerolatency ! rtph264pay ! udpsink host=<IP_ADDRESS> port=<PORT>

Client Code

gst-launch-1.0 udpsrc port=<PORT> ! application/x-rtp, payload=96 ! rtph264depay ! avdec_h264 ! autovideosink

Server Output

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Redistribute latency...

Client Output:

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock

Is it an issue with the sink I have chosen? I have also tried xvimagesink and glimagesink and have been having the same problem with no window opening to view the stream. I have tested with videotestsrc and have had no problem so I would appreciate any help at all.
Please let me know if there’s any additional information I should provide as I am quite new to these forums.

Hi,
Please try the example in

Jetson AGX Orin FAQ
Q: Is there an example for running UDP streaming?

Hi, I have attempted to modify the script that you wrote for UDP in TX2 NX as the server and an X86 as a client, however I am having trouble getting gstreamer to accept any caps to stream video from my USB device.

Server Code:

gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,width=1280,height=720,framerate=30/1 ! timeoverlay valignment=4 halignment=1 ! nvvidconv ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! tee name=t ! nvv4l2h264enc insert-sps-pps=1 idrinterval=15 ! h264parse ! rtph264pay ! udpsink host=<HOST_IP> port=5000 sync=0 t. ! queue ! nvegltransform ! nveglglessink sync=0

Server Output:

Setting pipeline to PAUSED ...

Using winsys: x11
Opening in BLOCKING MODE
Pipeline is live and does not need PREROLL ...
Got context from element 'eglglessink0': gst.egl.EGLDisplay=context, display=(GstEGLDisplay)NULL;
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...

Hi,
Please try

$ gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,width=1280,height=720,framerate=30/1 ! nvvidconv ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! nvv4l2h264enc insert-sps-pps=1 idrinterval=15 ! h264parse ! rtph264pay ! udpsink host=<HOST_IP> port=5000 sync=0

HOST_IP has to be IP of the client.

Hi there,
Unfortunately still no luck at the moment:

Setting pipeline to PAUSED ...
Opening in BLOCKING MODE 
Pipeline is live and does not need PREROLL ...
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...

Thank you for your help so far. Could this have to do with the caps I am using? If it helps at all the USB device I am using supports both MJPG and YUYV.

Hi,
Please refer to

Jetson AGX Orin FAQ
Q: I have a USB camera. How can I launch it on AGX Orin?

to work out a command to launch the camera. And then you can link like:

... ! nvvidconv ! 'video/x-raw(memory:NVMM),width=1280,height=720,format=I420' ! nvv4l2h264enc insert-sps-pps=1 idrinterval=15 ! h264parse ! rtph264pay ! udpsink host=<HOST_IP> port=5000 sync=0
1 Like

Thank you so much for your help, was finally able to crack it. All though v4l2-ctl lists YUYV as an accepted video format Gstreamer prefers listing the format as YUY2.
Final Working Server Code:

gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,format=YUY2,width=640,height=480,framerate=30/1 ! videoconvert ! video/x-raw,format=NV12 ! nvvidconv ! 'video/x-raw(memory:NVMM),format=NV12' ! nvvidconv ! 'video/x-raw(memory:NVMM),width=1280,height=720,format=I420' ! nvv4l2h264enc insert-sps-pps=1 idrinterval=15 ! h264parse ! rtph264pay ! udpsink host=<HOST_IP> port=5000 sync=0

For future reference for anyone.
I used the same format of client code as detailed in this example and was able to stream the footage over UDP onto my ACER laptop.

Once again thank you!!

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