From 6068c51bb010e38afdb3b07b631cea9525c0128c Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Fri, 31 Dec 2021 19:52:19 +0000 Subject: [PATCH] Create Tdarr_Plugin_0house_action_handbrake_ffmpeg_custom.js --- ...n_0house_action_handbrake_ffmpeg_custom.js | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 Community/Tdarr_Plugin_0house_action_handbrake_ffmpeg_custom.js diff --git a/Community/Tdarr_Plugin_0house_action_handbrake_ffmpeg_custom.js b/Community/Tdarr_Plugin_0house_action_handbrake_ffmpeg_custom.js new file mode 100644 index 0000000..5ffb4f7 --- /dev/null +++ b/Community/Tdarr_Plugin_0house_action_handbrake_ffmpeg_custom.js @@ -0,0 +1,97 @@ +const details = () => ({ + id: 'Tdarr_Plugin_0house_action_handbrake_ffmpeg_custom', + Stage: 'Pre-processing', + Name: 'HandBrake or FFmpeg custom arguments', + Type: 'Video', + Operation: 'Transcode', + Description: ` + Set HandBrake or FFmpeg arguments. This action has no built-in filter so be sure to set a codec filter + to prevent a transcoding loop. + `, + Version: '1.00', + Tags: 'action', + Inputs: [ + { + name: 'cli', + type: 'string', + defaultValue: 'ffmpeg', + inputUI: { + type: 'dropdown', + options: [ + 'ffmpeg', + 'handbrake', + ], + }, + tooltip: + 'Enter the desired video encoder', + }, + { + name: 'arguments', + type: 'string', + defaultValue: ' -map 0 -c copy', + inputUI: { + type: 'text', + }, + tooltip: + ` +When using FFmpeg, you need to separate the input and output args with . FFmpeg Examples: + +-r 1-r 24 +-sn -c:v copy -c:a copy +-c:v libx265 -crf 23 -ac 6 -c:a aac -preset veryfast +-map 0 -c copy -c:v libx265 -c:a aac +-c:v h264_cuvid-c:v hevc_nvenc -preset slow -c:a copy + + +HandBrake examples: + +-e x264 -q 20 -B +-Z "Very Fast 1080p30" +-Z "Fast 1080p30" -e nvenc_h265 +-Z "Very Fast 1080p30" --all-subtitles --all-audio +-Z "Very Fast 480p30" + +--preset-import-file "C:/Users/HaveAGitGat/Desktop/testpreset.json" -Z "My Preset" +`, + }, + { + name: 'container', + type: 'string', + defaultValue: 'mkv', + inputUI: { + type: 'text', + }, + tooltip: + 'Enter the desired container', + }, + ], +}); + +// eslint-disable-next-line no-unused-vars +const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); + // eslint-disable-next-line no-unused-vars,no-param-reassign + inputs = lib.loadDefaultValues(inputs, details); + const response = { + processFile: false, + preset: '', + container: '', + handBrakeMode: false, + FFmpegMode: false, + reQueueAfter: false, + infoLog: '', + }; + + response.preset = inputs.arguments; + response.container = `.${inputs.container}`; + response.handbrakeMode = inputs.cli === 'handbrake'; + response.ffmpegMode = inputs.cli === 'ffmpeg'; + response.reQueueAfter = true; + response.processFile = true; + response.infoLog += 'File is being transcoded using custom arguments \n'; + return response; +}; + +module.exports.details = details; +module.exports.plugin = plugin;