From 0abbfb91866b32caae100e051ee81f8a57506dcf Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Fri, 17 Mar 2023 08:53:15 +0000 Subject: [PATCH] options to use original container --- Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js | 16 +++++++++-- .../Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js | 16 +++++++++-- .../Tdarr_Plugin_MC93_Migz1FFMPEG.js | 28 +++++++++++++++++++ .../Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js | 28 +++++++++++++++++++ 4 files changed, 82 insertions(+), 6 deletions(-) diff --git a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js index c6627e4..2c64d04 100644 --- a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js +++ b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js @@ -19,14 +19,17 @@ const details = () => ({ inputUI: { type: 'text', }, - tooltip: `Specify output container of file + tooltip: `Specify output container of file. Use 'original' wihout qoutes to keep original container. \\n Ensure that all stream types you may have are supported by your chosen container. \\n mkv is recommended. \\nExample:\\n mkv \\nExample:\\n - mp4`, + mp4 + + \\nExample:\\n + original`, }, { name: 'bitrate_cutoff', @@ -128,7 +131,14 @@ const plugin = (file, librarySettings, inputs, otherArguments) => { response.processFile = false; return response; } - response.container = `.${inputs.container}`; + + if (inputs.container === 'original') { + // eslint-disable-next-line no-param-reassign + inputs.container = `${file.container}`; + response.container = `.${file.container}`; + } else { + response.container = `.${inputs.container}`; + } // Check if file is a video. If it isn't then exit plugin. if (file.fileMedium !== 'video') { diff --git a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js index 04ff7fc..dd51c0d 100644 --- a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js +++ b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js @@ -18,14 +18,17 @@ const details = () => ({ inputUI: { type: 'text', }, - tooltip: `Specify output container of file. + tooltip: `Specify output container of file. Use 'original' wihout qoutes to keep original container. \\n Ensure that all stream types you may have are supported by your chosen container. \\n mkv is recommended. \\nExample:\\n mkv \\nExample:\\n - mp4`, + mp4 + + \\nExample:\\n + original`, }, { name: 'bitrate_cutoff', @@ -107,7 +110,14 @@ const plugin = (file, librarySettings, inputs, otherArguments) => { response.processFile = false; return response; } - response.container = `.${inputs.container}`; + + if (inputs.container === 'original') { + // eslint-disable-next-line no-param-reassign + inputs.container = `${file.container}`; + response.container = `.${file.container}`; + } else { + response.container = `.${inputs.container}`; + } // Check if file is a video. If it isn't then exit plugin. if (file.fileMedium !== 'video') { diff --git a/tests/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js b/tests/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js index a329f18..4ef125b 100644 --- a/tests/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js +++ b/tests/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js @@ -120,6 +120,34 @@ const tests = [ container: '.mp4', }, }, + { + input: { + file: _.cloneDeep(require('../sampleData/media/sampleH264_2.json')), + librarySettings: {}, + inputs: { + container: 'original', + enable_10bit: 'true', + force_conform: 'true', + bitrate_cutoff: '1000', + }, + otherArguments: {}, + }, + output: { + processFile: true, + preset: '-c:v h264_cuvid, -map 0 -c:v hevc_nvenc -cq:v 19 -b:v 3933k -minrate 2753k -maxrate 5112k -bufsize 7866k -spatial_aq:v 1 -rc-lookahead:v 32 -c:a copy -c:s copy -max_muxing_queue_size 9999 -map -0:d -pix_fmt p010le ', + handBrakeMode: false, + FFmpegMode: true, + reQueueAfter: true, + infoLog: 'Container for output selected as mkv. \n' + + 'Current bitrate = 7866 \n' + + 'Bitrate settings: \n' + + 'Target = 3933 \n' + + 'Minimum = 2753 \n' + + 'Maximum = 5112 \n' + + 'File is not hevc or vp9. Transcoding. \n', + container: '.mkv', + }, + }, { input: { file: _.cloneDeep(require('../sampleData/media/sampleH265_1.json')), diff --git a/tests/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js b/tests/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js index 6e1afa3..590723b 100644 --- a/tests/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js +++ b/tests/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js @@ -120,6 +120,34 @@ const tests = [ container: '.mp4', }, }, + { + input: { + file: _.cloneDeep(require('../sampleData/media/sampleH264_2.json')), + librarySettings: {}, + inputs: { + container: 'original', + enable_10bit: 'true', + force_conform: 'true', + bitrate_cutoff: '1000', + }, + otherArguments: {}, + }, + output: { + processFile: true, + preset: ',-map 0 -c:v libx265 -b:v 3933k -minrate 2753k -maxrate 5112k -bufsize 7866k -c:a copy -c:s copy -max_muxing_queue_size 9999 -map -0:d -pix_fmt p010le ', + handBrakeMode: false, + FFmpegMode: true, + reQueueAfter: true, + infoLog: 'Container for output selected as mkv. \n' + + 'Current bitrate = 7866 \n' + + 'Bitrate settings: \n' + + 'Target = 3933 \n' + + 'Minimum = 2753 \n' + + 'Maximum = 5112 \n' + + 'File is not hevc or vp9. Transcoding. \n', + container: '.mkv', + }, + }, { input: { file: _.cloneDeep(require('../sampleData/media/sampleH265_1.json')),