diff --git a/revid/revid.go b/revid/revid.go index 75d06e76..e1ba16ad 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -211,6 +211,7 @@ func (r *Revid) reset(c config.Config) error { } case config.InputAudio: st = mts.EncodeAudio + encOptions = append(encOptions, mts.TimeBasedPSI(time.Duration(r.cfg.PSITime)*time.Second)) default: panic("unknown input type") } @@ -460,10 +461,16 @@ func (r *Revid) Start() error { } r.cfg.Logger.Log(logger.Info, "revid reset") - // Calculate delay between frames based on FileFPS. + // Calculate delay between frames based on FileFPS for Video or RecPeriod for audio. d := time.Duration(0) - if r.cfg.FileFPS != 0 { - d = time.Duration(1000/r.cfg.FileFPS) * time.Millisecond + if r.cfg.Input == config.InputAudio { + if r.cfg.RecPeriod != 0 { + d = time.Duration(r.cfg.RecPeriod * float64(time.Second)) + } + } else { + if r.cfg.FileFPS != 0 { + d = time.Duration(1000/r.cfg.FileFPS) * time.Millisecond + } } r.cfg.Logger.Log(logger.Debug, "starting input processing routine")