Change video settings on RTSP streaming

Hi, Im trying to stream via rtsp using gstreamer on Nvidia Jetson Nano following this topic How to stream csi camera using RTSP? - #5 by caffeinedev

It works but I have a lot of latency streaming on a local network, the first thing I thought was changing the resolution and the framerate, however I dont know how could I change it, should I modify test-launch.c or how could I make it?

Or there is another way to reduce the latency?

Hi,
You can refer to steps in Jetson Nano FAQ
Q: Is there any example of running RTSP streaming?

For changing resolution and framerate of videotestsrc, you can set caps directly like:

videotestsrc is-live=1 ! video/x-raw,width=1920,height=1080,framerate=10/1 ! ...

Please also set is-live=1 to simulate a live source.

May also try udp streaming:
Gstreamer TCPserversink 2-3 seconds latency - #5 by DaneLLL

Thanks for the help! I will try udo streaming, meanwhile, I used this command

./test-launch "nvarguscamerasrc ! video/x-raw(memory:NVMM),width=640,height=480,framerate=15/1 ! nvvidconv ! video/x-raw(memory:NVMM),format=I420 ! nvjpegenc ! rtpjpegpay name=pay0 pt=26"

Instead of

./test-launch "videotestsrc ! nvvidconv ! nvv4l2h264enc ! h264parse ! rtph264pay name=pay0 pt=96"

Because the last one didnt work for me, I got this on the receiver

However with the other command it works but with 2-3 seconds of delay, whatsmore althought I specify on the command the settings I want, I get this on the terminal, it has set up with this fixed settings:

Sorry about this newbie question, I tried UDP streaming and there is almost no delay in the counter, but how I receive the image? Should I receive it with this command?

gst-launch-1.0 videotestsrc is-live=1 ! video/x-raw,width=1280,height=720 ! timeoverlay valignment=4 halignment=1 ! nvvidconv ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! tee name=t ! nvv4l2h264enc insert-sps-pps=1 idrinterval=15 ! h264parse ! rtph264pay ! udpsink host=127.0.0.1 port=5000 sync=0 t. ! queue ! nvegltransform ! nveglglessink sync=0

I get this on the receiver and the server:

Hi,
You can run gst-launch-1.0 command to make sure the string is good first. And then apply to test-launch.

gst-launch-1.0 nvarguscamerasrc ! video/x-raw(memory:NVMM),width=640,height=480,framerate=15/1 ! nvvidconv ! video/x-raw(memory:NVMM),format=I420 ! nvjpegenc ! rtpjpegpay name=pay0 pt=26 ! fakesink

Generally we will encode to h264 or h265 stream. Have not tried JPEG. You may check if you can decode it through VLC player.

Thanks for the reply, JPEG doesnt seem a good option so I am trying to make this command work with udp:

gst-launch-1.0 nvarguscamerasrc is-live=1 ! video/x-raw,width=1280,height=720 ! timeoverlay valignment=4 halignment=1 ! nvvidconv ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! tee name=t ! nvv4l2h264enc insert-sps-pps=1 idrinterval=15 ! h264parse ! rtph264pay ! udpsink host=127.0.0.1 port=5000 sync=0 t. ! queue ! nvegltransform ! nveglglessink sync=0

But I get this:

WARNING: erroneous pipeline: no property "is-live" in element "nvarguscamerasrc0"

If I eliminate is-live, it also doesnt work, i get this:

WARNING: erroneous pipeline: could not link nvarguscamerasrc0 to timeoverlay0, nvarguscamerasrc0 can't handle caps video/x-raw, width=(int)1280, height=(int)720

Hi,
Please try

gst-launch-1.0 nvarguscamerasrc ! nvvidconv ! video/x-raw,width=1280,height=720 ! timeoverlay valignment=4 halignment=1 ! nvvidconv ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! tee name=t ! nvv4l2h264enc insert-sps-pps=1 idrinterval=15 ! h264parse ! rtph264pay ! udpsink host=127.0.0.1 port=5000 sync=0 t. ! queue ! nvegltransform ! nveglglessink sync=0

The timeoverlay plugin supports CPU buffer(video/x-raw), so would need to copy the buffer from NVMM buffer to CPU buffer via nvvidconv plugin.

Hi, it works! Thanks! With low latency, but I have several points and doubts:

1st:
The streamings had a lot of microcuts, but I solved it by switching from h264 to h265

2nd
It works perfect with this command:

gst-launch-1.0 nvarguscamerasrc ! nvvidconv ! video/x-raw,width=1280,height=720,framerate=30/1 ! timeoverlay valignment=4 halignment=1 ! nvvidconv ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! tee name=t ! nvv4l2h265enc insert-sps-pps=1 idrinterval=15 ! h265parse ! rtph265pay ! udpsink host=192.168.0.118 port=5000 sync=0 t. ! queue ! nvegltransform ! nveglglessink sync=0

But when I try to launch:

Server:

./test-launch nvarguscamerasrc ! nvvidconv ! video/x-raw,width=1280,height=720,framerate=30/1 ! timeoverlay valignment=4 halignment=1 ! nvvidconv ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! tee name=t ! nvv4l2h265enc insert-sps-pps=1 idrinterval=15 ! h265parse ! rtph265pay ! udpsink host=127.0.0.1 port=8554 sync=0 t. ! queue ! nvegltransform ! nveglglessink sync=0

Client:

gst-launch-1.0 uridecodebin uri=rtsp://127.0.0.1:8554/test ! nvoverlaysink

I get this error:

(test-launch:17419): GLib-GObject-WARNING **: 15:13:47.307: invalid cast from 'GstNvArgusCameraSrc' to 'GstBin'

(test-launch:17419): GStreamer-CRITICAL **: 15:13:47.307: gst_bin_get_by_name: assertion 'GST_IS_BIN (bin)' failed

(test-launch:17419): GLib-GObject-WARNING **: 15:13:47.307: invalid cast from 'GstNvArgusCameraSrc' to 'GstBin'

(test-launch:17419): GStreamer-CRITICAL **: 15:13:47.307: gst_bin_get_by_name: assertion 'GST_IS_BIN (bin)' failed

(test-launch:17419): GLib-GObject-WARNING **: 15:13:47.307: invalid cast from 'GstNvArgusCameraSrc' to 'GstBin'

(test-launch:17419): GStreamer-CRITICAL **: 15:13:47.307: gst_bin_get_by_name: assertion 'GST_IS_BIN (bin)' failed


3rd

As JerryChang said on IMX219 set sensor_mode

There are several modes with diferent framerates and resolution for the IMX219, and depending of the resolution and the framerate wrote on the command it will switch to the closest sensor mode. However I tried 1280x720@120fps:

gst-launch-1.0 nvarguscamerasrc ! nvvidconv ! video/x-raw,width=1280,height=720,framerate=120/1 ! timeoverlay valignment=4 halignment=1 ! nvvidconv ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! tee name=t ! nvv4l2h265enc insert-sps-pps=1 idrinterval=15 ! h265parse ! rtph265pay ! udpsink host=192.168.0.118 port=5000 sync=0 t. ! queue ! nvegltransform ! nveglglessink sync=0

But i get this error and it stopped:

Setting pipeline to PAUSED ...

Using winsys: x11 
Opening in BLOCKING MODE 
Pipeline is live and does not need PREROLL ...
Got context from element 'eglglessink0': gst.egl.EGLDisplay=context, display=(GstEGLDisplay)NULL;
Setting pipeline to PLAYING ...
New clock: GstSystemClock
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 3264 x 2464 FR = 21,000000 fps Duration = 47619048 ; Analog Gain range min 1,000000, max 10,625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 3264 x 1848 FR = 28,000001 fps Duration = 35714284 ; Analog Gain range min 1,000000, max 10,625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1920 x 1080 FR = 29,999999 fps Duration = 33333334 ; Analog Gain range min 1,000000, max 10,625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1640 x 1232 FR = 29,999999 fps Duration = 33333334 ; Analog Gain range min 1,000000, max 10,625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1280 x 720 FR = 59,999999 fps Duration = 16666667 ; Analog Gain range min 1,000000, max 10,625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1280 x 720 FR = 120,000005 fps Duration = 8333333 ; Analog Gain range min 1,000000, max 10,625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: Running with following settings:
   Camera index = 0 
   Camera mode  = 2 
   Output Stream W = 1920 H = 1080 
   seconds to Run    = 0 
   Frame Rate = 29,999999 
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
ERROR: from element /GstPipeline:pipeline0/GstNvArgusCameraSrc:nvarguscamerasrc0: Internal data stream error.
Additional debug info:
gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline0/GstNvArgusCameraSrc:nvarguscamerasrc0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:00.401237835
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
GST_ARGUS: Cleaning up
CONSUMER: Done Success
GST_ARGUS: Done Success
Setting pipeline to NULL ...
Freeing pipeline ...

I also tried 3264x1848:

gst-launch-1.0 nvarguscamerasrc ! nvvidconv ! video/x-raw,width=3264,height=1848,framerate=30/1 ! timeoverlay valignment=4 halignment=1 ! nvvidconv ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! tee name=t ! nvv4l2h265enc insert-sps-pps=1 idrinterval=15 ! h265parse ! rtph265pay ! udpsink host=192.168.0.118 port=5000 sync=0 t. ! queue ! nvegltransform ! nveglglessink sync=0

And it works but I get this response, so im not sure if it is working on the resolution I wanted:

Using winsys: x11 
Opening in BLOCKING MODE 
Pipeline is live and does not need PREROLL ...
Got context from element 'eglglessink0': gst.egl.EGLDisplay=context, display=(GstEGLDisplay)NULL;
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Redistribute latency...
NvMMLiteOpen : Block : BlockType = 8 
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 8 
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 3264 x 2464 FR = 21,000000 fps Duration = 47619048 ; Analog Gain range min 1,000000, max 10,625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 3264 x 1848 FR = 28,000001 fps Duration = 35714284 ; Analog Gain range min 1,000000, max 10,625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1920 x 1080 FR = 29,999999 fps Duration = 33333334 ; Analog Gain range min 1,000000, max 10,625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1640 x 1232 FR = 29,999999 fps Duration = 33333334 ; Analog Gain range min 1,000000, max 10,625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1280 x 720 FR = 59,999999 fps Duration = 16666667 ; Analog Gain range min 1,000000, max 10,625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1280 x 720 FR = 120,000005 fps Duration = 8333333 ; Analog Gain range min 1,000000, max 10,625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: Running with following settings:
   Camera index = 0 
   Camera mode  = 2 
   Output Stream W = 1920 H = 1080 
   seconds to Run    = 0 
   Frame Rate = 29,999999 
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
NVMEDIA: H265 : Profile : 1 

It says that it catch camera mode 2.

Hi,
When running test-launch the string has to end in rtph264pay or rtph265pay. Please refer to sample string in FAQ.

Hi, then how I use UDP with the test-launch? I mean, this final code udpsink host=192.168.0.118 port=5000 sync=0 t. ! queue ! nvegltransform ! nveglglessink sync=0 how do I write udpsink on the test-launch code execution.

Would you mind to tell me how I modify this line of code to launch test-launch usind UDP?

./test-launch nvarguscamerasrc ! nvvidconv ! video/x-raw,width=1280,height=720,framerate=30/1 ! timeoverlay valignment=4 halignment=1 ! nvvidconv ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! tee name=t ! nvv4l2h265enc insert-sps-pps=1 idrinterval=15 ! h265parse ! rtph265pay ! udpsink host=127.0.0.1 port=8554 sync=0 t. ! queue ! nvegltransform ! nveglglessink sync=0```

Hi,
test-launch is to launch RTSP server. For UDP streaming, it is to run gst-launch-1.0 command like
Gstreamer TCPserversink 2-3 seconds latency - #5 by DaneLLL

Hi, okay thanks! Sorry about that. On the other hand, about the 3rd issue Change video settings on RTSP streaming - #9 by DaneLLL is there any way to select a custom configuration of resolution and framerate on the IMX219?

Btw another question about it, is there any way to not show the video on the sender,?

Hi,

Please remove the display sink in the command:

$ gst-launch-1.0 videotestsrc is-live=1 ! video/x-raw,width=1280,height=720 ! timeoverlay valignment=4 halignment=1 ! nvvidconv ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! tee name=t ! nvv4l2h264enc insert-sps-pps=1 idrinterval=15 ! h264parse ! rtph264pay ! udpsink host=10.19.106.10 port=5000 sync=0

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