0

I have an Xavier AGX dev kit and x4 AGXs I hope to replicate this pipeline on. I am serving the RTSP stream to _my_ip_address:8554/test. I can see it on other computers and VLC no problem. The stream itself is MJPEG. I am not doing h264 because my camera can get better quality and higher fps with mjpeg.

My clear intention/problem statement; I want to split a MJPEG RTSP stream from gstreamer into segmented mp4s on my client. Interval length doesn't matter, just the specific commands is what I am missing.

I can split the live rtsp stream into chunks with ffmpeg on other computers just fine using;

ffmpeg -rtsp_transport tcp -i rtsp://10.42.0.1:8554/test -c copy -f segment -segment_time 600 /home/miles/Documents/line_1_%d.mp4

(how do you format code segments on stack?)

The pipeline is being launched from python/gstreamer on the xavier end. For some reason using python on my ubuntu machine doesn't work. I installed opencv with gstreamer support and it is looking at the correct python path.

I can import gi, etc, but I can't get the video to play in my opencv on my ubuntu machine. If anyone can solve that for me.. that would be great, but not the main problem. I am happy to use command line to solve the problem, but my thought was to first try and use gstreamer to get the stream in python and then do the multifile work in python as well....have spent great deal of time on it, but to no avail. So, I switched to ffmpeg, which seems to have an easier to find solution..

import os os.system("ffmpeg -rtsp_transport tcp -i rtsp://10.42.0.1:8554/test -c copy -f segment -segment_time 600 /home/miles/Documents/line_1_%d.mp4")

It seems like I should be able to use gstreamer to do this....but I can't figure out the mjpeg part. For instance, I found an example using splitmuxsink....

gst-launch-1.0 rtspsrc location=rtsp://10.82.131.240:8554/h264ESVideoTest ! rtph264depay ! h264parse ! splitmuxsink location=file%02d.mp4 max-size-time=10000000000 

That expects h264 though, not mjpeg.

Anyone have an idea of how to do this in gstreamer? Otherwise I have a bandaged together pipeline.

M

See above, I didn't realize it was in two sections.

1 Answers1

0

Unfortunately it seems like JPEG in MP4 is not implemented in GStreamer. You could switch to Matroska instead though. The pipeleline adjusted from your example would be something like this:

gst-launch-1.0 rtspsrc location=rtsp://10.82.131.240:8554/h264ESVideoTest ! rtpjpegdepay ! splitmuxsink location=file%02d.mkv muxer=matroskamux max-size-time=10000000000
Florian Zwoch
  • 6,764
  • 2
  • 12
  • 21
  • Hey Thanks, @florian. I am testing between ffmpeg and gstreamer. Your code works great, but I am dropping a lot of frames. ffmpeg I don't really have that problem. Do you know how I could up the frame rate/speed? – Milesk1990 Jan 08 '23 at 05:11
  • Probably have to play around with `rtspsrc` options. If things get dropped I can only imagine happening it there due to connection. Try `rtspt://` as protocol to use rtsp interleaving. – Florian Zwoch Jan 08 '23 at 09:29