mediamtx/docs/2-usage/04-configuration.md
Enrico 9a82874601
Include instruction to override parameters in list (#5177)
Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
2025-11-18 03:54:33 +01:00

2 KiB

Configuration

All the configuration parameters are listed and commented in the configuration file (mediamtx.yml).

There are several ways to change the configuration:

  1. By editing the configuration file, that is

    • included into the release bundle

    • available in the root folder of the Docker image (/mediamtx.yml); it can be overridden in this way:

      docker run --rm -it --network=host -v "$PWD/mediamtx.yml:/mediamtx.yml:ro" bluenviron/mediamtx
      

    The configuration can be changed dynamically when the server is running (hot reloading) by writing to the configuration file. Changes are detected and applied without disconnecting existing clients, whenever it's possible.

  2. By overriding configuration parameters with environment variables, in the format MTX_PARAMNAME, where PARAMNAME is the uppercase name of a parameter. For instance, the rtspAddress parameter can be overridden in the following way:

    MTX_RTSPADDRESS="127.0.0.1:8554" ./mediamtx
    

    Parameters that have array as value can be overridden by setting a comma-separated list. For example:

    MTX_RTSPTRANSPORTS="tcp,udp"
    

    Parameters in maps can be overridden by using underscores, in the following way:

    MTX_PATHS_TEST_SOURCE=rtsp://myurl ./mediamtx
    

    Parameters in lists can be overridden in the same way as parameters in maps, using their position like an additional key. This is particularly useful if you want to use internal users but define credentials through enviroment variables:

    MTX_AUTHINTERNALUSERS_0_USER=username
    MTX_AUTHINTERNALUSERS_0_PASS=password
    

    This method is particularly useful when using Docker; any configuration parameter can be changed by passing environment variables with the -e flag:

    docker run --rm -it --network=host -e MTX_PATHS_TEST_SOURCE=rtsp://myurl bluenviron/mediamtx
    
  3. By using the Control API.