mirror of
https://github.com/AlexxIT/go2rtc.git
synced 2025-10-05 08:16:55 +08:00
41 lines
909 B
Go
41 lines
909 B
Go
package ffmpeg
|
|
|
|
func ProbeHardware(name string) string {
|
|
switch name {
|
|
case "h264":
|
|
if run("-init_hw_device", "cuda",
|
|
"-f", "lavfi", "-i", "testsrc2", "-t", "1",
|
|
"-c", "h264_nvenc", "-f", "null", "-") {
|
|
return EngineCUDA
|
|
}
|
|
|
|
if run("-init_hw_device", "dxva2",
|
|
"-f", "lavfi", "-i", "testsrc2", "-t", "1",
|
|
"-c", "h264_qsv", "-f", "null", "-") {
|
|
return EngineDXVA2
|
|
}
|
|
|
|
case "h265":
|
|
if run("-init_hw_device", "cuda",
|
|
"-f", "lavfi", "-i", "testsrc2", "-t", "1",
|
|
"-c", "hevc_nvenc", "-f", "null", "-") {
|
|
return EngineCUDA
|
|
}
|
|
|
|
if run("-init_hw_device", "dxva2",
|
|
"-f", "lavfi", "-i", "testsrc2", "-t", "1",
|
|
"-c", "hevc_qsv", "-f", "null", "-") {
|
|
return EngineDXVA2
|
|
}
|
|
|
|
case "mjpeg":
|
|
if run("-init_hw_device", "dxva2",
|
|
"-f", "lavfi", "-i", "testsrc2", "-t", "1",
|
|
"-c", "mjpeg_qsv", "-f", "null", "-") {
|
|
return EngineDXVA2
|
|
}
|
|
}
|
|
|
|
return EngineSoftware
|
|
}
|