How can I add a name and a password to an RTSP stream?

I have a basic gstreamer setup that streams video from my camera and makes it available as an RTSP server:

olcamerasrc ! video/x-h264,width=1920,height=1080,framerate=30/1,bitrate=4000000,stream-format=byte-stream ! rtph264pay name=pay0 pt=96

This works fine, I can play this in VLC as rtsp://<IP Address>:8554/test but I want to:

  1. Change the name from test to something else.
  2. Add a password to the stream.

There seem to be multiple ways of doing this in gstreamer, what’s the most basic?

Have you had a look at the examples yet?

e.g. subprojects/gst-rtsp-server/examples/test-auth.c · main · GStreamer / gstreamer · GitLab

Sorry, I should have been more clear. This is in a script:

/usr/bin/test-launch "( olcamerasrc ! video/x-h264,width=1920,height=1080,framerate=30/1,bitrate=4000000,stream-format=byte-stream ! rtph264pay name=pay0 pt=96 )"

so I don’t have the ability to use a C API. I just want to add something to this setup string.

This (test-launch) looks like it’s literally one of the examples from the link I gave.

It’s one of the most minimal ones unfortunately.

You will need to build a modified version to do what you want to do.