RTPS URL contains special characters

Hi, I’m using rtspsrc to create a pipeline for different live-cameras streams.

At this point I already have a working pipeline that clears almost all of the incoming streams, the problem is that I have stumbeled upon some RTP stream whose password contains a special character, precisely an ‘@’.

Thus my URL looks like the following:

rtsp://user:passw@rd@Current_IP/path1/path2/

And my pipeline looks like this:

gst-launch-1.0 -v rtspsrc location=rtsp://user:passw@rd@Current_IP/path1/path2/ ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! autovideosink

When using this URL within my working pipeline, it returns an unauthorized error. From what I could grasp, essentially the problem is that the password contains this ‘@’ and it messes up with the stream authentication.

The error is the following:

Use Windows high-resolution clock, precision: 1 ms
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Got context from element 'autovideosink0': gst.d3d11.device.handle=context, device=(GstD3D11Device)"\(GstD3D11Device\)\ d3d11device3", adapter=(uint)0, adapter-luid=(gint64)51438, device-id=(uint)7684, vendor-id=(uint)4318, hardware=(boolean)true, description=(string)"NVIDIA\ GeForce\ RTX\ 2080\ Ti";
Progress: (open) Opening Stream
Pipeline is PREROLLED ...
Prerolled, waiting for progress to finish...
Progress: (connect) Connecting to rtsp://admin:P@ssw0rd2024!@192.168.152.16/Streaming/Channels/101/
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Unauthorized
Additional debug info:
../gst/rtsp/gstrtspsrc.c(7071): gst_rtspsrc_send (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
Unauthorized (401)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...

My question is:
Which would be your proposal or solution for this problem ? How should I address this issue ? Is there any configuration I can use to make gstreamer “ignore” or “translate” this symbol into something that the pipeline will be able to read ?

You need to escape (“URL encode”) the parts of the URL that contain special characters that have meaning in those positions. In your case (if the @ is the only problem), you should be able to replace it with %40.

1 Like

As long as I’m aware, the @ is the only problem, yes. So I’ll try to detect and replace those parts of the string.

Is there any resource or list you know that lists all of the reserved characters ?

Thank you!

RFC 3986 - Uniform Resource Identifier (URI): Generic Syntax for example

1 Like