fix: recorder drop audio (-an) — cameras use pcm_mulaw which MP4 doesn't support

This commit is contained in:
Claus Lohmar 2026-08-05 14:10:08 +01:00
parent 752941f991
commit 3ded3cc1e8
2 changed files with 20 additions and 1 deletions

18
main.go
View file

@ -62,6 +62,16 @@ func main() {
snaps.StartAll(cfg.Cameras)
app.snapshots = snaps
// Start FFmpeg recorder for all enabled cameras.
rec := NewRecorderManager(cfg.Storage)
rec.StartAll(cfg.Cameras)
app.recorder = rec
// Start retention cleaner.
cln := NewCleaner(cfg.Storage)
go cln.Start()
app.cleaner = cln
// Start the HTTP server (blocks).
errCh := make(chan error, 1)
go func() {
@ -110,6 +120,8 @@ type App struct {
server *Server
go2rtc *Go2RTCManager
snapshots *SnapshotEngine
recorder *RecorderManager
cleaner *Cleaner
}
// StartServer initializes and starts the HTTP server.
@ -124,6 +136,12 @@ func (a *App) StartServer() error {
// Shutdown performs a graceful shutdown of all services.
func (a *App) Shutdown() {
if a.recorder != nil {
a.recorder.StopAll()
}
if a.cleaner != nil {
a.cleaner.Stop()
}
if a.snapshots != nil {
a.snapshots.StopAll()
}

View file

@ -127,7 +127,8 @@ func (rm *RecorderManager) startRecorder(cam CameraConfig) {
"-hide_banner", "-loglevel", "error",
"-rtsp_transport", "tcp",
"-i", rtspURL,
"-c", "copy", // stream-copy: zero transcoding, near-zero CPU
"-an", // drop audio (pcm_mulaw not supported in MP4)
"-c:v", "copy", // stream-copy video: zero transcoding, near-zero CPU
"-t", "300", // hard stop after 300 seconds (5 minutes)
"-y", // overwrite output without asking
partFile,