Support Regex Capture Groups in source for Dynamic RTSP Routing (original) (raw)

Describe the feature

Hi,

I would like to request support for using regex capture groups in the source field for dynamic RTSP routing in MediaMTX.

Current Behavior

Path regex matching currently works as expected, for example:

~^mycam/([^/]+)/([^/]+)/(.+)$

However, it is not possible to reuse the captured groups inside the source URL.

Example:

The values are interpreted literally, which results in errors such as DNS lookup failures for $1.


Expected Behavior

It would be very useful to support dynamic source definitions like:

Where:

Example

Incoming request:

rtsp://proxy:8555/mycam/10.0.0.15/8554/stream1

Expected resolved source:

rtsp://10.0.0.15:8554/stream1

Why This Would Be Useful

This feature would:


Workarounds Considered

Current alternatives are possible but not ideal:


Thanks for your work on MediaMTX.