Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Simple docker compose to reencode RTSP streams to H264 and AAC using mediamtx

cruizba/docker-rtsp-h264-aac

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

docker-rtsp-h264-aac

A straightforward Docker Compose setup to re-encode RTSP streams to H264 and AAC using mediamtx.

Purpose

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.

Usage

  1. Clone this repository.
  2. Navigate to the project directory: cd docker-rtsp-h264-aac
  3. Edit the .env file to set your RTSP_URL with the camera's RTSP URL. For example: RTSP_URL=rtsp://<yourcamera>:554/
  4. Run docker-compose up

Verify new RTSP server

Check if the stream is working by running:

ffplay rtsp://admin:password@localhost:8555/rtsp

Change RTSP Basic Auth

To modify the RTSP basic authentication settings, edit the mediamtx.yml file at the following lines:

mediamtx.yml#L58-L59

- user: admin
pass: password

Modify ffmpeg Command

The ffmpeg command can be adjusted in the docker-compose.yml file at the following lines:

ffmpeg -i ${RTSP_URL:?}
-c:v libx264 -preset medium -x264opts "keyint=10:min-keyint=10:no-scenecut"
-c:a aac -b:a 64k
-f rtsp "rtsp://localhost:8555/rtsp"

About

Simple docker compose to reencode RTSP streams to H264 and AAC using mediamtx

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published