From bd74a0e96821a58361594449d7a6e06056d49278 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Wed, 4 Oct 2023 07:22:06 +0100 Subject: [PATCH] Add encoder detection logging --- FlowPlugins/FlowHelpers/1.0.0/hardwareUtils.js | 6 +++++- FlowPluginsTs/FlowHelpers/1.0.0/hardwareUtils.ts | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/FlowPlugins/FlowHelpers/1.0.0/hardwareUtils.js b/FlowPlugins/FlowHelpers/1.0.0/hardwareUtils.js index 1c987e7ff..fe39337c8 100644 --- a/FlowPlugins/FlowHelpers/1.0.0/hardwareUtils.js +++ b/FlowPlugins/FlowHelpers/1.0.0/hardwareUtils.js @@ -49,7 +49,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) { Object.defineProperty(exports, "__esModule", { value: true }); exports.getEncoder = exports.getBestNvencDevice = exports.hasEncoder = void 0; var hasEncoder = function (_a) { - var ffmpegPath = _a.ffmpegPath, encoder = _a.encoder, inputArgs = _a.inputArgs, filter = _a.filter; + var ffmpegPath = _a.ffmpegPath, encoder = _a.encoder, inputArgs = _a.inputArgs, filter = _a.filter, args = _a.args; return __awaiter(void 0, void 0, void 0, function () { var exec, isEnabled, err_1; return __generator(this, function (_b) { @@ -64,6 +64,8 @@ var hasEncoder = function (_a) { var command = "".concat(ffmpegPath, " ").concat(inputArgs.join(' ') || '', " -f lavfi -i color=c=black:s=256x256:d=1:r=30") + " ".concat(filter || '') + " -c:v ".concat(encoder, " -f null /dev/null"); + args.jobLog("Checking for encoder ".concat(encoder, " with command:")); + args.jobLog(command); exec(command, function ( // eslint-disable-next-line error) { @@ -76,6 +78,7 @@ var hasEncoder = function (_a) { })]; case 2: isEnabled = _b.sent(); + args.jobLog("Encoder ".concat(encoder, " is ").concat(isEnabled ? 'enabled' : 'disabled')); return [3 /*break*/, 4]; case 3: err_1 = _b.sent(); @@ -310,6 +313,7 @@ var getEncoder = function (_a) { encoder: gpuEncoder.encoder, inputArgs: gpuEncoder.inputArgs, filter: gpuEncoder.filter, + args: args, })]; case 2: // eslint-disable-next-line no-await-in-loop diff --git a/FlowPluginsTs/FlowHelpers/1.0.0/hardwareUtils.ts b/FlowPluginsTs/FlowHelpers/1.0.0/hardwareUtils.ts index 36fc5251f..fe00c97bb 100644 --- a/FlowPluginsTs/FlowHelpers/1.0.0/hardwareUtils.ts +++ b/FlowPluginsTs/FlowHelpers/1.0.0/hardwareUtils.ts @@ -5,11 +5,13 @@ export const hasEncoder = async ({ encoder, inputArgs, filter, + args, }: { ffmpegPath: string, encoder: string, inputArgs: string[], filter: string, + args: IpluginInputArgs, }): Promise => { const { exec } = require('child_process'); let isEnabled = false; @@ -18,6 +20,10 @@ export const hasEncoder = async ({ const command = `${ffmpegPath} ${inputArgs.join(' ') || ''} -f lavfi -i color=c=black:s=256x256:d=1:r=30` + ` ${filter || ''}` + ` -c:v ${encoder} -f null /dev/null`; + + args.jobLog(`Checking for encoder ${encoder} with command:`); + args.jobLog(command); + exec(command, ( // eslint-disable-next-line error: any, @@ -31,6 +37,8 @@ export const hasEncoder = async ({ resolve(true); }); }); + + args.jobLog(`Encoder ${encoder} is ${isEnabled ? 'enabled' : 'disabled'}`); } catch (err) { // eslint-disable-next-line no-console console.log(err); @@ -296,6 +304,7 @@ export const getEncoder = async ({ encoder: gpuEncoder.encoder, inputArgs: gpuEncoder.inputArgs, filter: gpuEncoder.filter, + args, }); }