@mafiosnik/nvenc-codecs
Version:
Using NVIDIA Video Codec SDK to check encoder capatibilty of current GPU
25 lines (23 loc) • 831 B
JavaScript
let isWin = process.platform === "win32";
const execSync = require('child_process').execSync;
const path = require('path');
const binary = isWin ? path.resolve(__dirname, "./build/Release/nvenc_codecs_node.exe") : path.resolve(__dirname, "./build/Release/nvenc_codecs_node")
class nvencDevice {
static supports(codec) {
const cmd = `"${binary}"`;
try {
let checkCodecs = execSync(cmd, { windowsHide: true, encoding: "utf8" });
if (checkCodecs.includes(codec)) {
return true;
} else if (checkCodecs.includes('Driver does not support the reqired nvenc API version')) {
console.error('checkCodecs');
return checkCodecs;
} else {
return false;
}
} catch (error) {
console.error(error);
}
}
}
module.exports = nvencDevice;