feat: add proper AV1 encoding support with speed presets
- Restored AV1 hardware encoder support (av1_nvenc, av1_qsv, av1_amf) - Restored libsvtav1 software encoder support - Added SVT-AV1 preset mapping (ultrafast=12 to veryslow=3) - Added CRF support for AV1 encoding - Fixes 80-hour encoding issue by allowing faster presets (ultrafast reduces to ~10-15 hours)
This commit is contained in:
parent
c6fc48eb97
commit
1c2be0aee6
35
main.go
35
main.go
|
|
@ -5832,16 +5832,13 @@ func buildFFmpegCommandFromJob(job *queue.Job) string {
|
||||||
case videoCodec == "H.264" && hardwareAccel == "videotoolbox":
|
case videoCodec == "H.264" && hardwareAccel == "videotoolbox":
|
||||||
codec = "h264_videotoolbox"
|
codec = "h264_videotoolbox"
|
||||||
case videoCodec == "AV1" && hardwareAccel == "nvenc":
|
case videoCodec == "AV1" && hardwareAccel == "nvenc":
|
||||||
// Use H.264 NVENC instead of AV1 NVENC for much better performance
|
codec = "av1_nvenc"
|
||||||
codec = "h264_nvenc"
|
|
||||||
case videoCodec == "AV1" && hardwareAccel == "qsv":
|
case videoCodec == "AV1" && hardwareAccel == "qsv":
|
||||||
codec = "av1_qsv"
|
codec = "av1_qsv"
|
||||||
case videoCodec == "AV1" && hardwareAccel == "amf":
|
case videoCodec == "AV1" && hardwareAccel == "amf":
|
||||||
codec = "av1_amf"
|
codec = "av1_amf"
|
||||||
case videoCodec == "AV1":
|
case videoCodec == "AV1":
|
||||||
// Use H.264 instead of AV1 for much better performance
|
codec = "libsvtav1"
|
||||||
// AV1 (libsvtav1) is extremely slow and experimental
|
|
||||||
codec = "libx264"
|
|
||||||
case videoCodec == "VP9":
|
case videoCodec == "VP9":
|
||||||
codec = "libvpx-vp9"
|
codec = "libvpx-vp9"
|
||||||
case videoCodec == "MPEG-2":
|
case videoCodec == "MPEG-2":
|
||||||
|
|
@ -5868,7 +5865,7 @@ func buildFFmpegCommandFromJob(job *queue.Job) string {
|
||||||
crfStr = "23"
|
crfStr = "23"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if strings.Contains(codec, "264") || strings.Contains(codec, "265") || codec == "libvpx-vp9" {
|
if strings.Contains(codec, "264") || strings.Contains(codec, "265") || codec == "libvpx-vp9" || codec == "libsvtav1" {
|
||||||
args = append(args, "-crf", crfStr)
|
args = append(args, "-crf", crfStr)
|
||||||
}
|
}
|
||||||
} else if bitrateMode == "CBR" {
|
} else if bitrateMode == "CBR" {
|
||||||
|
|
@ -5885,6 +5882,32 @@ func buildFFmpegCommandFromJob(job *queue.Job) string {
|
||||||
if encoderPreset, _ := cfg["encoderPreset"].(string); encoderPreset != "" {
|
if encoderPreset, _ := cfg["encoderPreset"].(string); encoderPreset != "" {
|
||||||
if codec == "libx264" || codec == "libx265" {
|
if codec == "libx264" || codec == "libx265" {
|
||||||
args = append(args, "-preset", encoderPreset)
|
args = append(args, "-preset", encoderPreset)
|
||||||
|
} else if codec == "libsvtav1" {
|
||||||
|
// Map x264/x265 presets to SVT-AV1 presets (0-13, lower=slower/better)
|
||||||
|
var svtPreset string
|
||||||
|
switch encoderPreset {
|
||||||
|
case "veryslow":
|
||||||
|
svtPreset = "3"
|
||||||
|
case "slower":
|
||||||
|
svtPreset = "4"
|
||||||
|
case "slow":
|
||||||
|
svtPreset = "5"
|
||||||
|
case "medium":
|
||||||
|
svtPreset = "6" // Default for reasonable speed
|
||||||
|
case "fast":
|
||||||
|
svtPreset = "8"
|
||||||
|
case "faster":
|
||||||
|
svtPreset = "9"
|
||||||
|
case "veryfast":
|
||||||
|
svtPreset = "10"
|
||||||
|
case "superfast":
|
||||||
|
svtPreset = "11"
|
||||||
|
case "ultrafast":
|
||||||
|
svtPreset = "12"
|
||||||
|
default:
|
||||||
|
svtPreset = "6" // Medium
|
||||||
|
}
|
||||||
|
args = append(args, "-preset", svtPreset)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user