mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-17 11:16:26 -07:00
Merge pull request #552 from HaveAGitGat/logging
Add reasoning for why no GPU encoding
This commit is contained in:
commit
59f7a36184
2 changed files with 30 additions and 4 deletions
|
|
@ -210,13 +210,14 @@ var encoderFilter = function (encoder, targetCodec) {
|
||||||
var getEncoder = function (_a) {
|
var getEncoder = function (_a) {
|
||||||
var targetCodec = _a.targetCodec, hardwareEncoding = _a.hardwareEncoding, hardwareType = _a.hardwareType, args = _a.args;
|
var targetCodec = _a.targetCodec, hardwareEncoding = _a.hardwareEncoding, hardwareType = _a.hardwareType, args = _a.args;
|
||||||
return __awaiter(void 0, void 0, void 0, function () {
|
return __awaiter(void 0, void 0, void 0, function () {
|
||||||
var gpuEncoders, filteredGpuEncoders, idx, _i, filteredGpuEncoders_1, gpuEncoder, _b, enabledDevices, res;
|
var supportedGpuEncoders, gpuEncoders, filteredGpuEncoders, idx, _i, filteredGpuEncoders_1, gpuEncoder, _b, enabledDevices, res;
|
||||||
return __generator(this, function (_c) {
|
return __generator(this, function (_c) {
|
||||||
switch (_c.label) {
|
switch (_c.label) {
|
||||||
case 0:
|
case 0:
|
||||||
|
supportedGpuEncoders = ['hevc', 'h264', 'av1'];
|
||||||
if (!(args.workerType
|
if (!(args.workerType
|
||||||
&& args.workerType.includes('gpu')
|
&& args.workerType.includes('gpu')
|
||||||
&& hardwareEncoding && (['hevc', 'h264', 'av1'].includes(targetCodec)))) return [3 /*break*/, 5];
|
&& hardwareEncoding && (supportedGpuEncoders.includes(targetCodec)))) return [3 /*break*/, 5];
|
||||||
gpuEncoders = [
|
gpuEncoders = [
|
||||||
{
|
{
|
||||||
encoder: 'hevc_nvenc',
|
encoder: 'hevc_nvenc',
|
||||||
|
|
@ -387,8 +388,19 @@ var getEncoder = function (_a) {
|
||||||
enabledDevices: enabledDevices,
|
enabledDevices: enabledDevices,
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
_c.label = 5;
|
return [3 /*break*/, 6];
|
||||||
case 5:
|
case 5:
|
||||||
|
if (!hardwareEncoding) {
|
||||||
|
args.jobLog('Hardware encoding is disabled in plugin input options');
|
||||||
|
}
|
||||||
|
if (!args.workerType || !args.workerType.includes('gpu')) {
|
||||||
|
args.jobLog('Worker type is not GPU');
|
||||||
|
}
|
||||||
|
if (!supportedGpuEncoders.includes(targetCodec)) {
|
||||||
|
args.jobLog("Target codec ".concat(targetCodec, " is not supported for GPU encoding"));
|
||||||
|
}
|
||||||
|
_c.label = 6;
|
||||||
|
case 6:
|
||||||
if (targetCodec === 'hevc') {
|
if (targetCodec === 'hevc') {
|
||||||
return [2 /*return*/, {
|
return [2 /*return*/, {
|
||||||
encoder: 'libx265',
|
encoder: 'libx265',
|
||||||
|
|
|
||||||
|
|
@ -186,10 +186,12 @@ export const getEncoder = async ({
|
||||||
hardwareType: string,
|
hardwareType: string,
|
||||||
args: IpluginInputArgs,
|
args: IpluginInputArgs,
|
||||||
}): Promise<IgetEncoder> => {
|
}): Promise<IgetEncoder> => {
|
||||||
|
const supportedGpuEncoders = ['hevc', 'h264', 'av1'];
|
||||||
|
|
||||||
if (
|
if (
|
||||||
args.workerType
|
args.workerType
|
||||||
&& args.workerType.includes('gpu')
|
&& args.workerType.includes('gpu')
|
||||||
&& hardwareEncoding && (['hevc', 'h264', 'av1'].includes(targetCodec))) {
|
&& hardwareEncoding && (supportedGpuEncoders.includes(targetCodec))) {
|
||||||
const gpuEncoders: IgpuEncoder[] = [
|
const gpuEncoders: IgpuEncoder[] = [
|
||||||
{
|
{
|
||||||
encoder: 'hevc_nvenc',
|
encoder: 'hevc_nvenc',
|
||||||
|
|
@ -371,6 +373,18 @@ export const getEncoder = async ({
|
||||||
enabledDevices,
|
enabledDevices,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (!hardwareEncoding) {
|
||||||
|
args.jobLog('Hardware encoding is disabled in plugin input options');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!args.workerType || !args.workerType.includes('gpu')) {
|
||||||
|
args.jobLog('Worker type is not GPU');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!supportedGpuEncoders.includes(targetCodec)) {
|
||||||
|
args.jobLog(`Target codec ${targetCodec} is not supported for GPU encoding`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetCodec === 'hevc') {
|
if (targetCodec === 'hevc') {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue