-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Description
Which version are you using?
v1.15.3
Which operating system are you using?
Linux amd64 Docker
Describe the issue
Hello,
I'm trying to setup a public test RTSP server which I can use as a RTSP source.
I've managed to use FFmpeg to push video to the server and now I want to make it secure and prevent others from pushing video to the server while making anyone able to read from it.
I've decided to use an env variable to set user and password to hopefully avoid commiting them, but while in runOnInit the parameters get replaced correctly, the user and pass fields won't. If I replace ${RTSP_STREAMER_USER} and ${RTSP_STREAMER_PASS} (on in the auth config) with the actual values it will work, so it's not an issue of the environment variables getting read.
Any help? Thx
Rico
Describe how to replicate the issue
- Set config as provided
- Set
RTSP_STREAMER_USERandRTSP_STREAMER_PASSenvironment variables (I'm using a.envfile and importing it with docker compose) - Provide any random video file to test and edit the config accordingly
- Start mediamtx
- Check logs for errors
MediaMTX configuration
# mediamtx.yml
logLevel: info
api: true
authMethod: internal
authInternalUsers:
- user: ${RTSP_STREAMER_USER}
pass: ${RTSP_STREAMER_PASS}
ips: []
permissions:
- action: publish
path:
- action: read
path:
- action: playback
path:
- user: any
pass:
ips: []
permissions:
- action: read
path:
- action: playback
path:
paths:
big-buck-bunny:
source: publisher
runOnInit: >
ffmpeg -re -stream_loop -1 -i /videos/bbb.mp4
-c copy -f rtsp -rtsp_transport tcp rtsp://${RTSP_STREAMER_USER}:${RTSP_STREAMER_PASS}@localhost:8554/big-buck-bunnyMediaMTX logs
[rtsp @ 0x7f8c95d17640] method ANNOUNCE failed: 401 Unauthorized
[out#0/rtsp @ 0x7f8c94f23680] Could not write header (incorrect codec parameters ?): Server returned 401 Unauthorized (authorization failed)
Error opening output file rtsp://streamer:fVMA4D7Y@localhost:8554/big-buck-bunny.
Error opening output files: Server returned 401 Unauthorized (authorization failed)
2025/10/27 08:09:13 INF [RTSP] [conn [::1]:45332] closed: authentication failed: authentication failed
Network dump
No response
Metadata
Metadata
Assignees
Labels
No labels