#6283·mediamtx

RTSP source should support filtering media types before SETUP, like FFmpeg `-allowed_media_types video`

Author: OpenCodDevCreated Sep 29, 2026Updated Sep 29, 2026

Describe the feature

Hi,

I’d like to report a compatibility gap in the RTSP source handling.

When MediaMTX connects to an RTSP source that exposes multiple media types in its SDP, it currently sends SETUP for all advertised tracks, including audio, application, and metadata tracks such as vnd.onvif.metadata.

This is a problem for some sources because it creates unnecessary or unwanted SETUP requests for non-video tracks, and in some cases those tracks should be ignored entirely.

Example

A source may return SDP like:

sdp
m=video
a=control:stream=0

m=application
a=rtpmap:107 vnd.onvif.metadata/90000
a=control:stream=1

Current MediaMTX behavior:

DESCRIBE
SETUP stream=0
SETUP stream=1
PLAY

What we need is behavior equivalent to FFmpeg:

bash
ffmpeg -allowed_media_types video ...

which results in only:

DESCRIBE
SETUP stream=0
PLAY

and ignores:

  • m=audio
  • m=application
  • vnd.onvif.metadata
  • any non-video media

Why this matters

This is important for RTSP interoperability with devices and servers that expose auxiliary tracks but are intended to be consumed as video-only sources.

A video-only selection mode would:

  • avoid unnecessary SETUP requests
  • prevent issues with unsupported or noisy metadata tracks
  • align MediaMTX behavior more closely with FFmpeg’s RTSP client behavior
  • improve compatibility with RTSP cameras and servers that expose extra media streams

Suggested solution

It would be very useful to add a configuration option such as:

yaml
allowedMediaTypes:
  - video

or a simpler shortcut like:

yaml
videoOnly: true

This should be applied before track setup, so that non-video tracks are never SETUP at all.

Expected behavior

When video-only filtering is enabled, MediaMTX should:

  1. parse the SDP as usual
  2. inspect the available media tracks
  3. only issue SETUP for video tracks
  4. ignore all other media types completely

Additional note

This feature would be particularly valuable for RTSP sources that include ONVIF metadata or other auxiliary application streams, where only the video track is actually needed.

Thanks for considering this improvement.