From 96de8feba72c56ab45220572c6e044de2ea65410 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sun, 22 May 2022 13:24:52 +0100 Subject: [PATCH] Tdarr_Plugin_DOOM_NVENC_Tiered_MKV_CleanAll test --- ...r_Plugin_DOOM_NVENC_Tiered_MKV_CleanAll.js | 6 +- ...r_Plugin_DOOM_NVENC_Tiered_MKV_CleanAll.js | 75 +++++++++++++++++++ 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 tests/Community/Tdarr_Plugin_DOOM_NVENC_Tiered_MKV_CleanAll.js diff --git a/Community/Tdarr_Plugin_DOOM_NVENC_Tiered_MKV_CleanAll.js b/Community/Tdarr_Plugin_DOOM_NVENC_Tiered_MKV_CleanAll.js index b7817c0..2d9345a 100644 --- a/Community/Tdarr_Plugin_DOOM_NVENC_Tiered_MKV_CleanAll.js +++ b/Community/Tdarr_Plugin_DOOM_NVENC_Tiered_MKV_CleanAll.js @@ -1,6 +1,5 @@ /* eslint-disable */ -// tdarrSkipTest const details = () => { return { id: "Tdarr_Plugin_DOOM_NVENC_Tiered_MKV_CleanAll", @@ -441,10 +440,15 @@ function buildVideoConfiguration(inputs, file, logger) { /* Determine tiered bitrate variables */ var tier = tiered[file.video_resolution]; + console.log(file.video_resolution); + console.log(tier); + bitratecheck = parseInt(tier["bitrate"]); if (bitrateprobe !== null && bitrateprobe < bitratecheck) { + console.log('here1') bitratetarget = parseInt((bitrateprobe * inputs.target_pct_reduction) / 1000); } else { + console.log('here2') bitratetarget = parseInt(tier["bitrate"] / 1000); } bitratemax = bitratetarget + tier["max_increase"]; diff --git a/tests/Community/Tdarr_Plugin_DOOM_NVENC_Tiered_MKV_CleanAll.js b/tests/Community/Tdarr_Plugin_DOOM_NVENC_Tiered_MKV_CleanAll.js new file mode 100644 index 0000000..6557f17 --- /dev/null +++ b/tests/Community/Tdarr_Plugin_DOOM_NVENC_Tiered_MKV_CleanAll.js @@ -0,0 +1,75 @@ +/* eslint max-len: 0 */ +const _ = require('lodash'); +const run = require('../helpers/run'); + +const tests = [ + { + input: { + file: _.cloneDeep(require('../sampleData/media/sampleH264_1.json')), + librarySettings: {}, + inputs: {}, + otherArguments: {}, + }, + output: { + container: '.mkv', + FFmpegMode: true, + handBrakeMode: false, + infoLog: '☒ Removing audio track in language und\n' + + '☒ *** All audio tracks would have been removed. Defaulting to keeping all tracks for this file.\n' + + '☒ Transcoding to HEVC using NVidia NVENC\n' + + '☑ No subtitle processing necessary', + processFile: true, + preset: ' -c:v h264_cuvid,-map 0 -map -0:d -c:v hevc_nvenc -qmin 0 -cq:v 30 -b:v 602k -maxrate:v 2602k -preset medium -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy -max_muxing_queue_size 9999 -bf 5 -analyzeduration 2147483647 -probesize 2147483647', + reQueueAfter: true, + }, + }, + { + input: { + file: _.cloneDeep(require('../sampleData/media/sampleH265_1.json')), + librarySettings: {}, + inputs: {}, + otherArguments: {}, + }, + output: { + container: '.mkv', + FFmpegMode: true, + handBrakeMode: false, + infoLog: '☑ File is in HEVC codec and in MKV\n' + + '☑ No video processing necessary\n' + + '☑ No subtitle processing necessary\n' + + '☑ No need to process file', + processFile: false, + preset: ',-map 0 -map -0:d -c:v copy -c:a copy -c:s copy -max_muxing_queue_size 9999 -bf 5 -analyzeduration 2147483647 -probesize 2147483647', + reQueueAfter: true, + }, + }, + { + input: { + file: (() => { + const file = _.cloneDeep(require('../sampleData/media/sampleH264_1.json')); + file.ffProbeData.streams[0].bit_rate = undefined; + return file; + })(), + librarySettings: {}, + inputs: { + target_bitrate_720p: '1500000', + }, + otherArguments: {}, + }, + output: { + container: '.mkv', + FFmpegMode: true, + handBrakeMode: false, + infoLog: '☒ Removing audio track in language und\n' + + '☒ *** All audio tracks would have been removed. Defaulting to keeping all tracks for this file.\n' + + '☒ Transcoding to HEVC using NVidia NVENC\n' + + '☑ No subtitle processing necessary', + processFile: true, + preset: ' -c:v h264_cuvid,-map 0 -map -0:d -c:v hevc_nvenc -qmin 0 -cq:v 30 -b:v 1500k -maxrate:v 3500k -preset medium -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy -max_muxing_queue_size 9999 -bf 5 -analyzeduration 2147483647 -probesize 2147483647', + reQueueAfter: true, + }, + }, + +]; + +run(tests);