Streaming UDP from gstreamer to VLC

I have a udp stream working from my nano using a Logitech c615 using the following params:

SERVER:
gst-launch-1.0 -v v4l2src device=/dev/video1 ! “image/jpeg,width=1920, height-1080, framerate=30/1” ! rtpjpegpay ! udpsink host=$CLIENT_IP port=5000

CLIENT:
gst-launch-1.0 -e -v udpsrc port=5000 ! application/x-rtp, encoding-name=JPEG,payload=26 ! rtpjpegdepay ! jpegdec ! autovideosink

Server is my Jetson Nano and client is my Macbook.

When attempting to view the stream in VLC, I’m unable to open the stream on udp://@:5000, can someone give me any advice? It appears the stream connects, but no video shows.

You may try this on receiver end:

gst-launch-1.0 udpsrc port=5000 ! application/x-rtp, payload=26 ! rtpjpegdepay ! jpegdec ! videoconvert ! xvimagesink

For VLC, there might be another way to set payload (maybe a sdp file).

You may also hit some limitation if using high resolution * framerate, so you may try to increase kernel socket TX max buffer size :

# Get current buffer max size for TX:
sudo sysctl net.core.wmem_max

# Set bigger size:
sudo sysctl -w net.core.wmem_max=33554432

Same may apply with RX max buffer size on receiver end:

# Get current buffer max size for TX:
sudo sysctl net.core.rmem_max

# Set bigger size:
sudo sysctl -w net.core.rmem_max=33554432

Alternatively, you can also set buffer-size property in udpsink or udpsrc.

Thank you for your quick reply, unfortunately, that didn’t work. I’m not sure what other information to provide.

I edited my previous post while you were replying, sorry.

Save this to file test_mjpg.sdp on your mac:

m=video 5000 RTP/AVP 26
c=IN IP4 192.168.0.40
a=rtpmap:26 JPEG/90000

and try to open this file from VLC:

vlc test_mjpg.sdp
1 Like

Awesome! Using this sdp file worked well on the VLC side. The only issue is I’m dealing with a 2 second delay through VLC as opposed to almost no delay when running gstreamer from the terminal.

Also, what is the significance of this IP: 192.168.0.40, I’m not sure where that came from.

Thank you so much!

The IP was just the one of my jetson being both sender and receiver on my LAN. May not be so relevant if it works for you with different IPs.

The latency may be adjusted from VLC parameters (need to go to VLC menu bar Tools/Preferences activate ‘All’ rather than ‘Simple’, then navigate and try), but I never got some reliable low latency with VLC.

1 Like

I’ve had great success so far, but am running into an issue on windows and wondering if I’m not properly understanding the gstreamer pipeline.

SERVER:
gst-launch-1.0 -v v4l2src device=/dev/video1 ! “image/jpeg,width=1920, height-1080, framerate=30/1” ! rtpjpegpay ! udpsink host=$CLIENT_IP port=5000

CLIENT:
gst-launch-1.0 udpsrc port=5000 ! application/x-rtp, payload=26 ! rtpjpegdepay ! jpegdec ! videoconvert ! autovideosink

This works on mac and linux, but not on windows.

I have the same client command working with gstreamer on Windows.
You may check if any firewall rule prevents from receiving on UDP/5000.

1 Like

You are so frickin helpful! Thank you so much, that was exactly the issue.