Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 10th gen + qsv #495

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions FlowPlugins/FlowHelpers/1.0.0/hardwareUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,23 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getEncoder = exports.getBestNvencDevice = exports.hasEncoder = void 0;
var os_1 = __importDefault(require("os"));
var hasEncoder = function (_a) {
var ffmpegPath = _a.ffmpegPath, encoder = _a.encoder, inputArgs = _a.inputArgs, filter = _a.filter, args = _a.args;
var ffmpegPath = _a.ffmpegPath, encoder = _a.encoder, inputArgs = _a.inputArgs, outputArgs = _a.outputArgs, 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) {
Expand All @@ -63,7 +76,7 @@ var hasEncoder = function (_a) {
return [4 /*yield*/, new Promise(function (resolve) {
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");
+ " -c:v ".concat(encoder, " ").concat(outputArgs.join(' ') || '', " -f null /dev/null");
args.jobLog("Checking for encoder ".concat(encoder, " with command:"));
args.jobLog(command);
exec(command, function (
Expand Down Expand Up @@ -197,7 +210,7 @@ var getEncoder = function (_a) {
'-hwaccel',
'qsv',
],
outputArgs: [],
outputArgs: __spreadArray([], (os_1.default.platform() === 'win32' ? ['-load_plugin', 'hevc_hw'] : []), true),
filter: '',
},
{
Expand Down Expand Up @@ -312,6 +325,7 @@ var getEncoder = function (_a) {
ffmpegPath: args.ffmpegPath,
encoder: gpuEncoder.encoder,
inputArgs: gpuEncoder.inputArgs,
outputArgs: gpuEncoder.outputArgs,
filter: gpuEncoder.filter,
args: args,
})];
Expand Down
10 changes: 8 additions & 2 deletions FlowPluginsTs/FlowHelpers/1.0.0/hardwareUtils.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import os from 'os';
import { IpluginInputArgs } from './interfaces/interfaces';

export const hasEncoder = async ({
ffmpegPath,
encoder,
inputArgs,
outputArgs,
filter,
args,
}: {
ffmpegPath: string,
encoder: string,
inputArgs: string[],
outputArgs: string[],
filter: string,
args: IpluginInputArgs,
}): Promise<boolean> => {
Expand All @@ -19,7 +22,7 @@ export const hasEncoder = async ({
isEnabled = await new Promise((resolve) => {
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`;
+ ` -c:v ${encoder} ${outputArgs.join(' ') || ''} -f null /dev/null`;

args.jobLog(`Checking for encoder ${encoder} with command:`);
args.jobLog(command);
Expand Down Expand Up @@ -180,7 +183,9 @@ export const getEncoder = async ({
'-hwaccel',
'qsv',
],
outputArgs: [],
outputArgs: [
...(os.platform() === 'win32' ? ['-load_plugin', 'hevc_hw'] : []),
],
filter: '',
},
{
Expand Down Expand Up @@ -303,6 +308,7 @@ export const getEncoder = async ({
ffmpegPath: args.ffmpegPath,
encoder: gpuEncoder.encoder,
inputArgs: gpuEncoder.inputArgs,
outputArgs: gpuEncoder.outputArgs,
filter: gpuEncoder.filter,
args,
});
Expand Down