fix: recorder drop audio (-an) — cameras use pcm_mulaw which MP4 doesn't support
This commit is contained in:
parent
752941f991
commit
3ded3cc1e8
2 changed files with 20 additions and 1 deletions
18
main.go
18
main.go
|
|
@ -62,6 +62,16 @@ func main() {
|
||||||
snaps.StartAll(cfg.Cameras)
|
snaps.StartAll(cfg.Cameras)
|
||||||
app.snapshots = snaps
|
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).
|
// Start the HTTP server (blocks).
|
||||||
errCh := make(chan error, 1)
|
errCh := make(chan error, 1)
|
||||||
go func() {
|
go func() {
|
||||||
|
|
@ -110,6 +120,8 @@ type App struct {
|
||||||
server *Server
|
server *Server
|
||||||
go2rtc *Go2RTCManager
|
go2rtc *Go2RTCManager
|
||||||
snapshots *SnapshotEngine
|
snapshots *SnapshotEngine
|
||||||
|
recorder *RecorderManager
|
||||||
|
cleaner *Cleaner
|
||||||
}
|
}
|
||||||
|
|
||||||
// StartServer initializes and starts the HTTP server.
|
// StartServer initializes and starts the HTTP server.
|
||||||
|
|
@ -124,6 +136,12 @@ func (a *App) StartServer() error {
|
||||||
|
|
||||||
// Shutdown performs a graceful shutdown of all services.
|
// Shutdown performs a graceful shutdown of all services.
|
||||||
func (a *App) Shutdown() {
|
func (a *App) Shutdown() {
|
||||||
|
if a.recorder != nil {
|
||||||
|
a.recorder.StopAll()
|
||||||
|
}
|
||||||
|
if a.cleaner != nil {
|
||||||
|
a.cleaner.Stop()
|
||||||
|
}
|
||||||
if a.snapshots != nil {
|
if a.snapshots != nil {
|
||||||
a.snapshots.StopAll()
|
a.snapshots.StopAll()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,8 @@ func (rm *RecorderManager) startRecorder(cam CameraConfig) {
|
||||||
"-hide_banner", "-loglevel", "error",
|
"-hide_banner", "-loglevel", "error",
|
||||||
"-rtsp_transport", "tcp",
|
"-rtsp_transport", "tcp",
|
||||||
"-i", rtspURL,
|
"-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)
|
"-t", "300", // hard stop after 300 seconds (5 minutes)
|
||||||
"-y", // overwrite output without asking
|
"-y", // overwrite output without asking
|
||||||
partFile,
|
partFile,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue