From 599ae068a4a22ca0750b5a0cfef5bca63cbe34ba Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Tue, 27 Jun 2023 06:18:34 +0100 Subject: [PATCH] Adjust gpu inputs --- .../Tdarr_Plugin_00td_action_transcode.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Community/Tdarr_Plugin_00td_action_transcode.js b/Community/Tdarr_Plugin_00td_action_transcode.js index 5d11405..4dd9e2d 100644 --- a/Community/Tdarr_Plugin_00td_action_transcode.js +++ b/Community/Tdarr_Plugin_00td_action_transcode.js @@ -25,7 +25,19 @@ const details = () => ({ tooltip: 'Specify the codec to use', }, { - name: 'use_gpu', + name: 'target_bitrate_multiplier', + type: 'number', + defaultValue: 0.5, + inputUI: { + type: 'text', + }, + tooltip: ` + Specify the multiplier to use to calculate the target bitrate. + Default of 0.5 will roughly half the size of the file. + `, + }, + { + name: 'try_use_gpu', type: 'boolean', defaultValue: true, inputUI: { @@ -180,7 +192,7 @@ const getEncoder = async ({ otherArguments, }) => { let { encoder } = inputs; - if (inputs.use_gpu && (inputs.encoder === 'hevc' || inputs.encoder === 'h264')) { + if (inputs.try_use_gpu && (inputs.encoder === 'hevc' || inputs.encoder === 'h264')) { const gpuEncoders = [ { encoder: 'hevc_nvenc', @@ -293,7 +305,7 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { // Use the same calculation used for currentBitrate but divide it in half to get targetBitrate. // Logic of h265 can be half the bitrate as h264 without losing quality. - const targetBitrate = currentBitrate / 2; + const targetBitrate = currentBitrate * inputs.target_bitrate_multiplier; // Allow some leeway under and over the targetBitrate. const minimumBitrate = (targetBitrate * 0.7);