feat: complete SVT-AV1 preset support in snippet encoding
Added SVT-AV1 preset mapping (0-13) to both snippet encoding paths: - Snippet generation in standard mode (line ~5035) - Snippet generation in conversion format mode (line ~5132) Both now map x264/x265 presets to SVT-AV1 presets: - ultrafast → 12 (~10-15 hours instead of 80+) - fast → 8 (default for snippets) - medium → 6 - veryslow → 3 (~80+ hours) This ensures AV1 encoding has proper speed presets across all encoding operations, preventing extremely slow encodes when users select AV1 codec. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
1c2be0aee6
commit
632cb6667c
54
main.go
54
main.go
|
|
@ -5030,8 +5030,34 @@ func (s *appState) executeSnippetJob(ctx context.Context, job *queue.Job, progre
|
|||
|
||||
if strings.Contains(videoCodec, "x264") || strings.Contains(videoCodec, "x265") {
|
||||
args = append(args, "-preset", preset, "-crf", crfVal, "-maxrate", targetBitrate, "-bufsize", targetBitrate)
|
||||
} else if strings.Contains(videoCodec, "vp9") || strings.Contains(videoCodec, "av1") {
|
||||
} else if strings.Contains(videoCodec, "vp9") {
|
||||
args = append(args, "-crf", crfVal, "-maxrate", targetBitrate, "-bufsize", targetBitrate)
|
||||
} else if strings.Contains(videoCodec, "av1") || strings.Contains(videoCodec, "svtav1") {
|
||||
// Map x264/x265 presets to SVT-AV1 presets (0-13, lower=slower/better)
|
||||
var svtPreset string
|
||||
switch preset {
|
||||
case "veryslow":
|
||||
svtPreset = "3"
|
||||
case "slower":
|
||||
svtPreset = "4"
|
||||
case "slow":
|
||||
svtPreset = "5"
|
||||
case "medium":
|
||||
svtPreset = "6"
|
||||
case "fast":
|
||||
svtPreset = "8"
|
||||
case "faster":
|
||||
svtPreset = "9"
|
||||
case "veryfast":
|
||||
svtPreset = "10"
|
||||
case "superfast":
|
||||
svtPreset = "11"
|
||||
case "ultrafast":
|
||||
svtPreset = "12"
|
||||
default:
|
||||
svtPreset = "8" // Fast preset for snippets
|
||||
}
|
||||
args = append(args, "-preset", svtPreset, "-crf", crfVal, "-maxrate", targetBitrate, "-bufsize", targetBitrate)
|
||||
}
|
||||
|
||||
// Audio codec
|
||||
|
|
@ -5105,7 +5131,31 @@ func (s *appState) executeSnippetJob(ctx context.Context, job *queue.Job, progre
|
|||
args = append(args, "-crf", crfVal, "-maxrate", targetBitrate, "-bufsize", targetBitrate)
|
||||
case "av1":
|
||||
args = append(args, "-c:v", "libsvtav1")
|
||||
args = append(args, "-crf", crfVal, "-maxrate", targetBitrate, "-bufsize", targetBitrate)
|
||||
// Map x264/x265 presets to SVT-AV1 presets (0-13, lower=slower/better)
|
||||
var svtPreset string
|
||||
switch preset {
|
||||
case "veryslow":
|
||||
svtPreset = "3"
|
||||
case "slower":
|
||||
svtPreset = "4"
|
||||
case "slow":
|
||||
svtPreset = "5"
|
||||
case "medium":
|
||||
svtPreset = "6"
|
||||
case "fast":
|
||||
svtPreset = "8"
|
||||
case "faster":
|
||||
svtPreset = "9"
|
||||
case "veryfast":
|
||||
svtPreset = "10"
|
||||
case "superfast":
|
||||
svtPreset = "11"
|
||||
case "ultrafast":
|
||||
svtPreset = "12"
|
||||
default:
|
||||
svtPreset = "8" // Fast preset for snippets
|
||||
}
|
||||
args = append(args, "-preset", svtPreset, "-crf", crfVal, "-maxrate", targetBitrate, "-bufsize", targetBitrate)
|
||||
case "copy":
|
||||
args = append(args, "-c:v", "copy")
|
||||
default:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user