Hi,
My total use case is that I am trying to create a 24/7 rtsp stream via MJPEG from Xavier AGX to a server. Ideally, I would like to launch and receive via python applications and opencv.
I have Opencv4.6, Cuda11.4, Jetpack 5.2, Jetson Xavier dev kit and 4 AGX production boards.
I am relatively new to Gstreamer so a lot of the issues probably come from inexperience. So, bear with me and any help is greatly appreciated.
Some caveats before I get started. To open my camera, I can use the command;
gst-launch-1.0 -v v4l2src device=/dev/video0 ! image/jpeg, width=640, height=480, framerate=30/1, format=MJPG ! jpegdec ! xvimagesink
The framerate looks great, everything is good. My camera is a USB camera at /dev/video0.
I can create an RTSP stream with;
./test-launch "v4l2src device=/dev/video0 use-damage=0 ! nvvidconv ! nvv4l2h265enc ! h265parse ! video/x-h265, stream-format=byte-stream ! rtph265pay name=pay0 pt=96 "
I can also view it on the same device via;
gst-launch-1.0 -v rtspsrc location=rtsp://127.0.0.1:8554/test ! application/x-rtp, media=video, encoding-name=H265 ! rtph265depay ! nvv4l2decoder ! nvvidconv ! xvimagesink
Video is there but the framerate is a little slow, so I am hoping to do MJPEG for compression.
I can run this python script;
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(‘(videotestsrc is-live=1 ! video/x-raw, width=320, height=240, framerate=30/1 ! nvvidconv ! nvv4l2h264enc insert-sps-pps=1 idrinterval=30 insert-vui=1 ! rtph264pay name=pay0 pt=96)’)
mounts.add_factory(“/test”, factory)
server.attach(None)
print(“stream ready at rtsp://127.0.0.1:8554/test”)
mainloop.run()
and I can view the test stream via;
gst-play-1.0 rtsp://127.0.0.1:8554/test
But, as soon as I try to format for MJPEG, I can’t get anything to work, I know it has to do with encoding/decoding, I just don’t know the right sequence.
My end goal is to launch via python app and decode via python app and write the frames to specific files. At this point, just launching and viewing via python would be amazing, I can figure it out from there.
The other question I have is whether I need to be worried about in system memory. Does the RTSP stream write to memory? I am using these 4 xaviers to collect my data for about 1-3 months for my training data.
Best,
Miles