RTSP Stream via ethernet Xavier

Hi Folks,

My use case is;

I have an MJPEG camera streaming video via RTSP. I can confirm that it is working locally on my Xavier at 127.0.0.1.

What I want to do is view it on another computer. The tricky part here is that I have a ubuntu host computer, mac and windows based server. I am doing testing on my mac and/or my host computer before deploying solution to the windows server.

My current xavier is a development kit AGX with jetpack 5.1, cuda 11.4, opencv 4.6. Ideally, I just want to test in VLC on one of my test laptops because I know my script is working in python sa that is how I am viewing it locally on the xavier.

I am looking for any network configuration/settings that I need to do on both my laptop/server and xavier to get the rtsp stream to work.

What I have tried so far is changing the IP settings in IPv4 on the xavier to “share with other computers” I get the eth address of 10.42.0.1. I can ping it from my mac…I get data.

But, I can’t view the stream in rtsp… the stream locally is rtsp://127.0.0.1:8554/test.

I changed for my test laptop with vlc to rtsp://10.42.0.1:8554/test and other combinations…i.e. rtsp://10.42.0.1, etc.

If anyone has experience doing this it would be greatly appreciated.

I don’t think that involving private address is easier.
You may better tell about your network topolgy (wired, wifi…). With wifi you might want to avoid multicast.
A common issue is firewall blocking.
Note that even if UDP/8554 is opened, this is just a service port and actual communication would be done on another port. You may use sudo netstat -laputen for further checking.

You may also try using TCP transport:

gst-launch-1.0 -v rtspsrc location=rtsp://<Jetson_IPv4_address>:8554/test protocols=tcp ! rtpjpegdepay ! decodebin ! autovideosink

# Or
gst-launch-1.0 -v rtspsrc location=rtsp://<Jetson_IPv4_address>:8554/test protocols=tcp ! rtpjpegdepay ! parsebin ! decodebin ! autovideosink

Hi again,

So, my network topology for this case is I will be deploying about x4 xaviers with this same setup to stream via RTSP (ideally) to a server. All of the pipelines would be the same and it is all on prem, i.e. no internet.

Right now, I just want to make sure that I can view the rtsp stream from another computer as I do on the xavier itself.

I have a mac, or I could hook up my host computer (i.e. the one I used to flash, running ubuntu) via ethernet to one another and view the stream via python or vlc. Right now I don’t really care as I just want to make sure the connection is good.

sudo netstat -laputen 

On xavier results in;

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       User       Inode      PID/Program name    
tcp        0      0 127.0.0.1:37639         0.0.0.0:*               LISTEN      0          49727      1647/containerd     
tcp        0      0 0.0.0.0:8554            0.0.0.0:*               LISTEN      1000       79706      5207/python3        
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      0          14563      1/init              
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      105        15907      351/systemd-resolve 
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      0          51210      1722/sshd: /usr/sbi 
tcp        0      0 127.0.0.1:26263         0.0.0.0:*               LISTEN      1000       77329      5080/code-oss       
tcp6       0      0 :::111                  :::*                    LISTEN      0          14565      1/init              
tcp6       0      0 :::22                   :::*                    LISTEN      0          51223      1722/sshd: /usr/sbi 
udp        0      0 127.0.0.53:53           0.0.0.0:*                           105        15906      351/systemd-resolve 
udp        0      0 0.0.0.0:111             0.0.0.0:*                           0          14564      1/init              
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           120        11010      393/avahi-daemon: r 
udp        0      0 0.0.0.0:41468           0.0.0.0:*                           120        11012      393/avahi-daemon: r 
udp6       0      0 :::111                  :::*                                0          14566      1/init              
udp6       0      0 :::35630                :::*                                120        11013      393/avahi-daemon: r 
udp6       0      0 :::5353                 :::*                                120        11011      393/avahi-daemon: r 

The firewall on both my mac and my xavier are off.

I don’t have gstreamer on my mac, I can install it, but that’s why I was just using vlc for testing so I can make sure the ethernet connection works and move on to the next step.

Kind of a side question, but in my code i shared with you earlier;

import gi
gi.require_version("Gst","1.0")
gi.require_version("GstVideo","1.0")
gi.require_version("GstRtspServer","1.0")
from gi.repository import GLib, Gst, GstVideo, GstRtspServer

Gst.init(None)

mainloop = GLib.MainLoop()
server = GstRtspServer.RTSPServer()
mounts = server.get_mount_points()

factory = GstRtspServer.RTSPMediaFactory()
factory.set_launch('( v4l2src device=/dev/video0 ! image/jpeg, width=640, height=480, framerate=30/1, format=MJPG ! rtpjpegpay name=pay0 )')
mounts.add_factory("/test", factory)
server.attach(None)

print("stream ready at rtsp://127.0.0.1:8554/test")
mainloop.run()

I understand my print statement is only designating port 8554, but if viewiing from another computer shouldn’t I therefore use;

rtsp://ip_address_of_xavier

Do I need the 8554/test?

Thanks again

Oh, some additional context as well…

i pull up the network configurations with;

nm-connection-editor

I change the ipv4 settings to “share locally”.

And in my ifconfig I get a generated IP address for eth0. Let’s say, axy123.

When I plug that into my mac, I can ping the IP address axy123.

But, I can’t play the video in vlc with any of the following;

rtps://axy123
rtps://axy123:8554/test

etc.

Even more additional context, I ran gst-discoverer-1.0 rtsp://10.42.0.1:8554/test from my mac…

And it can see the stream…

Properties:
  Duration: 99:99:99.999999999
  Seekable: no
  Live: yes
  unknown: application/x-rtp
    video: JPEG
      Stream ID: ca8633a0fb8113efff8bf834c914bca0730f2146fc298a0540d63e95c7f93ed7/video:0:0:RTP:AVP:26
      Width: 640
      Height: 480
      Depth: 24
      Frame rate: 30/1
      Pixel aspect ratio: 1/1
      Interlaced: false
      Bitrate: 0
      Max bitrate: 0

So, I guess the connection works, but none of the gst commands or vlc can unpack the actual stream.

Hi,
Please check if you can run this setup successfully: Jetson Nano FAQ

Q: Is there any example of running RTSP streaming?

It should work if the server and client are in same local area network(LAN). Please give it a try.

Hey @DaneLLL ,

The server and client are connected directly via ethernet. I can ping the server, I can see it with gst-discoverer-1.0. I can see it is jpeg etc.

With the specific commands you gave reference to, that one has never worked for me because, and not positive but the new gstreamer doesn’t use nvoverlaysink.

I think it was replaced with nvmrd…something something.

Do you have any advice? If I can get the videotest to play between the two computers I would be pretty close.

Hi,
Does it work for H264 or H265? Probably it is specific to MJPEG.

omg…thankfully I finally figured it out…ooof.

So, the thing that was missing in my launch string was a jpegparse.

Total launch string is

v4l2srs device=/dev/video0 ! image/jpeg, width=640, height=480, framerate=30/1, format=MJPG ! jpegparse ! rtjpegpay name=0 pt=96

And receiving on client is

gst-launch-1.0 uridecodbin uri=rtsp:10.42.0.1:8854/test ! autovideosink

phewwwwww, that took only 8 hours to figure out.

Question for you @DaneLLL , is that the correct port to send out through? why does Gstrtpserver send out via 8854/test?

Hi,
Please check source code of test-launch:
gst-rtsp-server/test-launch.c at 1.16.2 · GStreamer/gst-rtsp-server · GitHub

There is an option to set to different port number. And you can modify the string for removing /test:

  /* attach the test factory to the /test url */
  gst_rtsp_mount_points_add_factory (mounts, "/test", factory);

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