Configuration
All the configuration parameters are listed and commented in the configuration file (mediamtx.yml).
There are several ways to change the configuration:
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:1
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.
By overriding configuration parameters with environment variables, in the format
MTX_PARAMNAME, wherePARAMNAMEis the uppercase name of a parameter. For instance, thertspAddressparameter can be overridden in the following way:MTX_RTSPADDRESS="127.0.0.1:8554" ./mediamtxParameters 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 ./mediamtxParameters 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=passwordThis method is particularly useful when using Docker; any configuration parameter can be changed by passing environment variables with the
-eflag:docker run --rm -it --network=host -e MTX_PATHS_TEST_SOURCE=rtsp://myurl bluenviron/mediamtx:1By using the Control API.