feat: add automatic GPU detection for hardware encoding
Implemented automatic hardware encoder selection when hardware acceleration is set to 'auto'. The system now detects the GPU vendor and automatically selects the appropriate encoder: - NVIDIA GPU → nvenc (h264_nvenc, hevc_nvenc, av1_nvenc) - AMD GPU → amf (h264_amf, hevc_amf, av1_amf) - Intel GPU → qsv (h264_qsv, hevc_qsv, av1_qsv) - No compatible GPU → none (software encoding) Detection uses the existing sysinfo.Detect() function which identifies GPUs via nvidia-smi, lspci, wmic, and system_profiler depending on the platform. Location: main.go line 5867-5883
This commit is contained in:
parent
8676b0408f
commit
46d1a18378
20
main.go
20
main.go
|
|
@ -5862,6 +5862,26 @@ func buildFFmpegCommandFromJob(job *queue.Job) string {
|
|||
// Determine codec (simplified)
|
||||
codec := "libx264"
|
||||
hardwareAccel, _ := cfg["hardwareAccel"].(string)
|
||||
|
||||
// Resolve "auto" to actual GPU vendor
|
||||
if hardwareAccel == "auto" {
|
||||
hwInfo := sysinfo.Detect()
|
||||
switch hwInfo.GPUVendor {
|
||||
case "nvidia":
|
||||
hardwareAccel = "nvenc"
|
||||
logging.Debug(logging.CatFFMPEG, "auto hardware accel resolved to nvenc (detected NVIDIA GPU)")
|
||||
case "amd":
|
||||
hardwareAccel = "amf"
|
||||
logging.Debug(logging.CatFFMPEG, "auto hardware accel resolved to amf (detected AMD GPU)")
|
||||
case "intel":
|
||||
hardwareAccel = "qsv"
|
||||
logging.Debug(logging.CatFFMPEG, "auto hardware accel resolved to qsv (detected Intel GPU)")
|
||||
default:
|
||||
hardwareAccel = "none"
|
||||
logging.Debug(logging.CatFFMPEG, "auto hardware accel resolved to none (no compatible GPU detected)")
|
||||
}
|
||||
}
|
||||
|
||||
switch {
|
||||
case videoCodec == "H.265" && hardwareAccel == "nvenc":
|
||||
codec = "hevc_nvenc"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user