(encoder: ConcreteGpuEncoder)
| 119 | const GPU_PROBE_HEIGHT = 240; |
| 120 | |
| 121 | export function getProbeArgs(encoder: ConcreteGpuEncoder): string[] { |
| 122 | const args = [ |
| 123 | "-hide_banner", |
| 124 | "-loglevel", |
| 125 | "error", |
| 126 | "-f", |
| 127 | "lavfi", |
| 128 | "-i", |
| 129 | `color=size=${GPU_PROBE_WIDTH}x${GPU_PROBE_HEIGHT}:rate=1:duration=1`, |
| 130 | "-frames:v", |
| 131 | "1", |
| 132 | "-an", |
| 133 | ]; |
| 134 | |
| 135 | if (encoder === "vaapi") { |
| 136 | args.push("-vaapi_device", "/dev/dri/renderD128", "-vf", "format=nv12,hwupload"); |
| 137 | } |
| 138 | |
| 139 | args.push("-c:v", getGpuEncoderName(encoder, "h264")); |
| 140 | |
| 141 | if (encoder === "amf") { |
| 142 | args.push("-rc", "cqp", "-qp_i", "28", "-qp_p", "28"); |
| 143 | } |
| 144 | |
| 145 | args.push("-f", "null", "-"); |
| 146 | return args; |
| 147 | } |
| 148 | |
| 149 | async function canUseGpuEncoder(encoder: ConcreteGpuEncoder): Promise<boolean> { |
| 150 | return new Promise((resolve) => { |
no test coverage detected