From d8a86dc6d562cf05ab293f7788aeeaabf56b5bf2 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Tue, 27 Jun 2023 06:07:49 +0100 Subject: [PATCH] Adjust bframes options --- .../Tdarr_Plugin_00td_action_transcode.js | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Community/Tdarr_Plugin_00td_action_transcode.js b/Community/Tdarr_Plugin_00td_action_transcode.js index 6a2e01b..5d11405 100644 --- a/Community/Tdarr_Plugin_00td_action_transcode.js +++ b/Community/Tdarr_Plugin_00td_action_transcode.js @@ -90,7 +90,7 @@ const details = () => ({ false`, }, { - name: 'enable_bframes', + name: 'bframes_enabled', type: 'boolean', defaultValue: false, inputUI: { @@ -109,6 +109,15 @@ const details = () => ({ \\nExample:\\n false`, }, + { + name: 'bframes_value', + type: 'number', + defaultValue: 5, + inputUI: { + type: 'text', + }, + tooltip: 'Specify number of bframes to use.', + }, { name: 'force_conform', type: 'boolean', @@ -133,6 +142,11 @@ const details = () => ({ ], }); +const bframeSupport = [ + 'hevc_nvenc', + 'h264_nvenc', +]; + const hasEncoder = async ({ ffmpegPath, encoder, @@ -358,9 +372,9 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { } // Check if b frame variable is true. - if (encoder === 'hevc_nvenc' && inputs.enable_bframes === true) { + if (bframeSupport.includes(encoder) && inputs.bframes_enabled === true) { // If set to true then add b frames argument - extraArguments += '-bf 5 '; + extraArguments += `-bf ${inputs.bframes_value} `; } // Go through each stream in the file.