LinuxCommandLibrary

mediamtx

Stream media using RTSP, RTMP, and WebRTC

TLDR

Run MediaMTX

$ mediamtx
copy

Run MediaMTX with a custom configuration location
$ mediamtx [path/to/config.yml]
copy

Start MediaMTX as a daemon
$ systemctl start mediamtx
copy

SYNOPSIS

mediamtx [OPTIONS] [-c CONFIG_PATH]

PARAMETERS

-c CONFIG_PATH, --conf CONFIG_PATH
    Specifies the path to the configuration file. If not provided, mediamtx looks for a default configuration file (e.g., mediamtx.yml) in standard locations.

-v, --version
    Displays the version information of the mediamtx server and then exits.

-h, --help
    Shows the help message, listing all available command-line options and their descriptions, then exits.

-n, --no-color
    Disables colorized output in the console log, useful for environments that don't support ANSI escape codes or for clearer log parsing.

-l LEVEL, --log-level LEVEL
    Sets the logging level for the server. Common levels include debug, info, warn, error. Higher levels provide more verbose output.

-s ADDRESS, --server-address ADDRESS
    Overrides the server's listening address specified in the configuration file. For example, :8554 for RTSP or :1935 for RTMP.

-p PATH_CONFIG, --paths PATH_CONFIG
    Allows specifying or overriding path configurations directly from the command line, typically in JSON or YAML format, useful for quick tests or dynamic setups without a full config file.

DESCRIPTION

mediamtx (formerly rtsp-simple-server) is a comprehensive, zero-dependency media server written in Go. It enables the creation, proxying, and consumption of various types of media streams over multiple protocols, including RTSP, RTMP, HLS, WebRTC, MPEG-TS, and SRT.

It's designed for ease of use and low resource consumption, making it suitable for a wide range of applications from IP cameras to live broadcasting. Its primary configuration is done via a YAML file, allowing for flexible stream management, authentication, and protocol setup.

CAVEATS

mediamtx is primarily configured via its YAML configuration file (e.g., mediamtx.yml). While it has some command-line options, most advanced features like stream authentication, protocol-specific settings, and stream sources are managed within this file. Users should consult the official documentation for detailed configuration.

Ensure necessary network ports (e.g., 8554 for RTSP, 1935 for RTMP, 8888 for WebRTC) are open in your firewall for external access to streams.

DEFAULT CONFIGURATION

By default, mediamtx looks for a configuration file named mediamtx.yml or config.yml in the current directory, the user's home directory, or standard system configuration paths. If no configuration file is found or specified, it will start with minimal default settings, often listening on standard ports like 8554 for RTSP.

RUNNING AS A SERVICE

For production deployments, it is common to run mediamtx as a systemd service on Linux or a similar service management tool on other operating systems. This ensures it starts automatically on boot and can be managed (started, stopped, restarted) easily.

HISTORY

mediamtx was originally known as rtsp-simple-server, developed by Alessandro Gatti (aler9). It gained popularity for its simplicity, efficiency, and broad protocol support, particularly for RTSP. The project was later rebranded to mediamtx to reflect its expanded capabilities beyond just RTSP, encompassing a wider array of streaming protocols and features. It is written in Go, emphasizing performance and zero external runtime dependencies.

SEE ALSO

ffmpeg(1), vlc(1), nginx(8), gstreamer(1)

Copied to clipboard