Skip to content

NestMTX Configuration Options

NestMTX is highly configurable through environment variables, allowing you to customize various aspects of the application, such as database connections, MQTT client settings, Twilio integration for ICE, MediaMTX configurations, and more. While some variables are required, others are optional and provide additional functionality when set.

Configuration Options

The following table outlines the available environment variables, indicating whether each is required, along with a brief description and the default value if applicable.

VariableDescriptionDefault ValueAvailable in Docker
NODE_ENVSpecifies the environment mode (development, production, test).developmentNo
PORTThe port on which the application will listen for unencrypted HTTP requests2000No
HTTPS_PORTThe port on which the application will listen for encrypted HTTPS requests2001No
APP_KEYThe application key used for encryption and security.2yHkmRqv832ze68zwyIOtBpwzSHIrVzVYes
HOSTThe host address on which the application will run.0.0.0.0No
LOG_LEVELSpecifies the logging level for the application.infoYes
PINO_PORTThe port for the Pino logger, if applicable.62000No
DB_CONNECTIONThe database connection type (sqlite, mysql, pg, mssql).sqliteYes
DB_HOSTThe host address for the database.localhostYes
DB_PORTThe port for the database.When DB_HOST = mysql: 3306
When DB_HOST = pg: 5432
When DB_HOST = mssql: 1143
DB_USERThe username for the database connection.lucidYes
DB_PASSWORDThe password for the database connection.''Yes
DB_NAMEThe name of the database to connect to.lucidYes
DB_SECUREWhether to use a secure connection to the database (true/false).falseYes
MQTT_PROTOCOLThe protocol used for MQTT (wss, ws, mqtt, mqtts, etc.).mqttYes
MQTT_HOSTThe MQTT broker host address.
If set to :instance: a local MQTT server will be started
:instance:Yes
MQTT_PORTThe port for the MQTT broker.1883Yes
MQTT_USERThe username for MQTT authentication.NoneYes
MQTT_PASSThe password for MQTT authentication.NoneYes
MQTT_BASE_TOPICThe base topic used for MQTT eventsnestmtxYes
TWILIO_ACCOUNT_SIDTwilio Account SID used for ICE configuration.NoneYes
TWILIO_API_KEY_SIDTwilio API Key SID for accessing Twilio services.NoneYes
TWILIO_API_KEY_SECRETTwilio API Key Secret for secure access to Twilio services.NoneYes
IP_PUBLIC_RESOLVEDThe resolved public IP address of the server.
This is required if IP resolution is disabled.
None
IP_RESOLVERS_ENABLEDWhich IP resolvers are enabled. (google, cloudflare, aws, akamai, ipify, ifconfigMe, ipEchoNet, ipInfoIo, httpBin).trueYes
IP_LAN_RESOLVEDThe resolved LAN IP address of the server.
This is required if IP resolution is disabled.
None
ICE_USE_TWILIOWhether to use Twilio for ICE (true/false).trueYes
MEDIA_MTX_PATHRequired The file path to the MediaMTX executable.NoneNo
MEDIA_MTX_CONFIG_PATHRequired The path to the MediaMTX configuration file.NoneNo
MEDIA_MTX_API_PORTThe port for the MediaMTX API.9997No
MEDIA_MTX_PLAYBACK_ENABLEDWhether playback is enabled in MediaMTX (true/false).trueYes
MEDIA_MTX_RTSP_PLAYBACK_PORTThe port for RTSP playback in MediaMTX.9996No
MEDIA_MTX_RTSP_ENABLEDWhether RTSP is enabled in MediaMTX (true/false).falseYes
MEDIA_MTX_RTMP_ENABLEDWhether RTMP is enabled in MediaMTX (true/false).falseYes
MEDIA_MTX_HLS_ENABLEDWhether HLS is enabled in MediaMTX (true/false).falseYes
MEDIA_MTX_HLS_USE_DISKWhether HLS uses disk storage in MediaMTX (true/false).falseYes
MEDIA_MTX_WEB_RTC_ENABLEDWhether WebRTC is enabled in MediaMTX (true/false).falseYes
MEDIA_MTX_SRT_ENABLEDWhether SRT is enabled in MediaMTX (true/false).falseYes
MEDIA_MTX_RTSP_TCP_PORTThe TCP port for RTSP in MediaMTX.8554No
MEDIA_MTX_RTSP_UDP_RTP_PORTThe UDP RTP port for RTSP in MediaMTX.8000No
MEDIA_MTX_RTSP_UDP_RTCP_PORTThe UDP RTCP port for RTSP in MediaMTX.8001No
MEDIA_MTX_RTMP_PORTThe port for RTMP in MediaMTX.1935No
MEDIA_MTX_HLS_PORTThe port for HLS in MediaMTX.8888No
MEDIA_MTX_WEB_RTC_PORTThe port for WebRTC in MediaMTX.8889No
MEDIA_MTX_WEB_RTC_UDP_PORTThe UDP port for WebRTC in MediaMTX.8189No
MEDIA_MTX_SRT_PORTThe port for SRT in MediaMTX.8890No
GSTREAMER_BINThe file path to the GStreamer executable (gst-launch-1.0).gst-launch-1.0No
FFMPEG_BINThe file path to the FFmpeg executable.ffmpegNo
FFMPEG_HW_ACCELERATORThe hardware accelerator to use with ffmpeg for encoding and decodingNoneYes
FFMPEG_HW_ACCELERATOR_DEVICEThe device for the ffmpeg hardware accelerator to use with ffmpeg for encoding and decodingNoneYes
WEBRTC_RTP_MIN_PORTThe minimum port range for WebRTC RTP.10000Yes
WEBRTC_RTP_MAX_PORTThe maximum port range for WebRTC RTP.20000Yes
HTTPS_CERT_PATHThe path to the SSL certificate to use for serving https traffic.
If relative (does not start with /) the path is assumed to be
relative to the applications tmp folder
nestmtx.crtYes
HTTPS_KEY_PATHThe path to the SSL certificate key to use for serving https traffic.
If relative (does not start with /) the path is assumed to be
relative to the applications tmp folder
nestmtx.pemYes
NESTMTX_RTSP_TCP_PORTThe port number to show for RTSP (TCP) in the UI8554Yes
NESTMTX_RTSP_UDP_RTP_PORTThe port number to show for RTSP (UDP/RTP) in the UI8000Yes
NESTMTX_RTSP_UDP_RTCP_PORTThe port number to show for RTSP (UDP/RTCP) in the UI8001Yes
NESTMTX_RTMP_PORTThe port number to show for RTMP in the UI1935Yes
NESTMTX_HLS_PORTThe port number to show for HLS in the UI8888Yes
NESTMTX_WEB_RTC_PORTThe port number to show for WebRTC in the UI8889Yes
NESTMTX_SRT_PORTThe port number to show for SRT in the UI8890Yes
DROPCAM_EXCLUDED_DATACENTERSA comma seperated list of dropcam.com hostname datacenters which should not be tried as fallbacks for bad RTSP connectionsNoneYes
DROPCAM_EXCLUDED_PHONETICSA comma seperated list of dropcam.com hostname phonetics which should not be tried as fallbacks for bad RTSP connectionsNoneYes
DROPCAM_EXCLUDED_DATACENTER_ZONESA comma seperated list of dropcam.com hostname datacenter zones which should not be tried as fallbacks for bad RTSP connectionsNoneYes
DROPCAM_EXCLUDED_HOSTNAMESA comma seperated list of dropcam.com hostnames which should not be tried as fallbacks for bad RTSP connectionsNoneYes
DROPCAM_MAX_CASCADESThe maximum number of alternative dropcam.com hostnames to try before the feed is determined to be unreachable5Yes