A straightforward Docker Compose setup to re-encode RTSP streams to H264 and AAC using mediamtx.
Many IP cameras use codecs that are incompatible with certain legacy software that only supports H264 and AAC. This project re-encodes RTSP streams to H264 and AAC using ffmpeg for transcoding and mediamtx to present a new RTSP server. Ffmpeg and mediamtx are excellent tools for this task, prompting the creation of this easily modifiable Docker Compose setup.
- Clone this repository.
- Navigate to the project directory:
cd docker-rtsp-h264-aac - Edit the
.envfile to set your RTSP_URL with the camera's RTSP URL. For example:RTSP_URL=rtsp://<yourcamera>:554/ - Run
docker-compose up
Check if the stream is working by running:
ffplay rtsp://admin:password@localhost:8555/rtspTo modify the RTSP basic authentication settings, edit the mediamtx.yml file at the following lines:
mediamtx.yml#L58-L59
docker-rtsp-h264-aac/mediamtx.yml
Lines 58 to 59 in 756e50d
The ffmpeg command can be adjusted in the docker-compose.yml file at the following lines:
docker-rtsp-h264-aac/docker-compose.yml
Lines 11 to 14 in 25a446c