I am trying to setup an RTSP stream using gstreamer, except that I can’t get it to work, at all.
To begin with, I tried running the command shown here to start a stream. gst-launch-1.0 videotestsrc ! omxh265enc ! rtph265pay name=pay0 pt=96
I also tried modifying my own command to just capture the footage from the camera. This works fine. gst-launch-1.0 -v v4l2src device=/dev/video1 ! image/jpeg, width=1280, height=960, framerate=30/1 ! jpegdec ! videoconvert ! omxh264enc ! flvmux ! filesink location=videostream.flv
The pipeline you’re trying is incomplete. The string is intended to be passed to test-launch, which is an example of gst-rtsp-server. It would launch a rtsp server serving the output of the passed pipeline:
As @Honey_Patouceul stated that string is an incomplete pipeline. I would recommend giving a try to RidgeRun’s RTSP sink gstreamer element which permits high performance streaming to multiple computers using the RTSP / RTP protocols.
Sorry for not mentioning it. I did clone the RTSP-server repository, checked out branch v1.14 and did exactly what was posted here. This didn’t work for me (it started, but I couldn’t connect to the stream).
I can’t explain the behavior, I tested the top command from DaneLLL previously and that didn’t work. Now all of a sudden it works. (I was using the test-launch script)
Edit:
I rebooted the TX2 to try again and it seems that it doesn’t work reliably. I rebooted once more afterwards and it works.
Problem now is that the camera doesn’t start up with this command: ./test-launch "v4l2src device=/dev/video1 ! image/jpeg, width=1280, height=960, framerate=30/1 ! jpegdec ! omxh265enc ! rtph265pay name=pay0 pt=96"
My test code to save as a file works fine: gst-launch-1.0 -v v4l2src device=/dev/video1 ! image/jpeg, width=1280, height=960, framerate=30/1 ! jpegdec ! videoconvert ! omxh264enc ! flvmux ! filesink location=Videostream.flv
From your command it tells me:
Additional debug info:
xvimagesink.c(1773): gst_xv_image_sink_open (): /GstPipeline:pipeline0/GstXvImageSink:xvimagesink0:
Could not open display (null)
Okay, so now that’s that, I have the last issue where the camera doesn’t start up when running this command: ./test-launch --gst-debug-level 3 "v4l2src device=/dev/video0 io-mode=2 ! image/jpeg, width=1280, height=960, framerate=30/1, format=MJPG ! jpegparse ! jpegdec ! videoconvert ! omxh264enc ! rtph264pay name=pay0 pt=96"
The command should be correct, yet the LED on the camera board doesn’t light up. The camera works (tested with Cheese and gst-launch-1.0)
This is the error I get when connecting to the RTSP server:
0:00:10.475215965 9027 0x558921a590 ERROR rtspclient rtsp-client.c:2910:handle_describe_request: client 0x558930e110: no media
0:00:17.562239665 9027 0x7f94005d90 WARN v4l2 v4l2_calls.c:616:gst_v4l2_open:<v4l2src1> error: This isn't a device '/dev/video0'.
Rerunning this command: v4l2-ctl -d /dev/video0 --list-formats-ext shows:
failed to open /sys/dev/char/0:0/uevent
After multiple reboots it fixed itself and the stream works, but very unreliably.
Two things I noticed:
It uses quite a lot of CPU power (30-40%) and the stream has ~5 sec of delay.
I forgot to say that I finally got it to work, however only using the jpegdec. nvjpegdec has a memory leak and will crash the whole Jetson after roughly 2 minutes.