Sign inSign up

alex778/stream-recorder

By alex778

Updated about 2 months ago

Stream recorder. Such as RTSP, M3U8, etc.

Image
Networking
Internet of things
0

60

alex778/stream-recorder repository overview

Stream Recorder

Small Docker service that records a network stream into video files.

You give it a stream URL in .env, start the container, and it writes video files into the records folder.

Example .env

STREAM_URL=rtsp://user:password@camera-host:554/stream

RECORD_MODE=transcode
OUTPUT_FORMAT=mkv
OUTPUT_DIR=/records

SEGMENT_SECONDS=auto
MAX_SEGMENT_MB=100
TARGET_TOTAL_BITRATE_KBIT=1000

RECONNECT_DELAY_SECONDS=5
RECONNECT_DELAY_MAX_SECONDS=10
RTSP_TRANSPORT=tcp
FFMPEG_LOGLEVEL=warning

OUTPUT_FPS=5
VIDEO_BITRATE=900k
VIDEO_MAXRATE=900k
VIDEO_BUFSIZE=1800k
AUDIO_BITRATE=64k
GOP_SIZE=10

It can work with things like:

  • rtsp
  • rtmp
  • m3u8
  • regular http/https video streams

If the stream disappears, the current file is closed, a message is written to the log, and the service keeps trying again after a short pause.

Files are split into parts, so you do not end up with one huge recording.

Quick start

docker compose up -d --build

Recorded files will appear in:

./records

Example .env

STREAM_URL=rtsp://192.168.1.200:8554/live/stream

RECORD_MODE=transcode
OUTPUT_FORMAT=mkv
OUTPUT_DIR=/records

SEGMENT_SECONDS=auto
MAX_SEGMENT_MB=100
TARGET_TOTAL_BITRATE_KBIT=1000

RECONNECT_DELAY_SECONDS=5
RECONNECT_DELAY_MAX_SECONDS=10
RTSP_TRANSPORT=tcp
FFMPEG_LOGLEVEL=warning

OUTPUT_FPS=5
VIDEO_BITRATE=900k
VIDEO_MAXRATE=900k
VIDEO_BUFSIZE=1800k
AUDIO_BITRATE=64k
GOP_SIZE=10

Notes

  • mkv is the safest output format if the stream is unstable
  • copy keeps the original quality, but files can be bigger
  • transcode makes smaller files and gives more control over bitrate and fps

Tag summary

Content type

Image

Digest

sha256:9b842b360

Size

246.3 MB

Last updated

about 2 months ago

docker pull alex778/stream-recorder