add: SVT-AV1 lp (thread cap) config knob

Add encoding.lp (0 = auto) so a long encode can be capped to N logical
processors instead of pinning every core, as a lighter-weight alternative to
the compose cgroup limit. Threaded config -> types.Job -> -svtav1-params via a
testable svtav1Params helper. Settings-UI surfacing stays with #1.

refs #5
This commit is contained in:
Esa Kataja
2026-06-21 19:37:26 +03:00
parent 9bb7c72c1a
commit 80b602fbbb
5 changed files with 43 additions and 1 deletions
+12 -1
View File
@@ -403,6 +403,17 @@ func (e *Encoder) encodeOpus(ctx context.Context, wavs []string, workDir string)
return opusFiles, nil
}
// svtav1Params builds the -svtav1-params value, appending lp=N (logical
// processors / encoder thread count) only when lp > 0. lp=0 lets SVT-AV1
// auto-detect, preserving prior behavior.
func svtav1Params(lp int) string {
p := "film-grain=10:film-grain-denoise=1:scd=1:qm-min=4:qm-max=15:keyint=10s"
if lp > 0 {
p += fmt.Sprintf(":lp=%d", lp)
}
return p
}
func (e *Encoder) encodeVideo(ctx context.Context, input, workDir string, opusFiles []string, job *types.Job, metadata *types.Metadata, interlaced bool, streamLangs []StreamMetadata) error {
outFile := filepath.Join(workDir, "output.mkv")
@@ -418,7 +429,7 @@ func (e *Encoder) encodeVideo(ctx context.Context, input, workDir string, opusFi
}
}
svtParams := fmt.Sprintf("film-grain=10:film-grain-denoise=1:scd=1:qm-min=4:qm-max=15:keyint=10s")
svtParams := svtav1Params(job.LP)
zscaleStr, newWidth, err := e.calculateZscaleWidth(ctx, input, 0)
if err != nil {