mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-16 10:45:53 -07:00
Add Tdarr_Plugin_A47j_FFMPEG_NVENC_HEVC_Video_Only test
This commit is contained in:
parent
7f51f3e057
commit
a9408f921e
4 changed files with 119 additions and 6 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
|
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
|
||||||
/* eslint-disable no-restricted-globals */
|
/* eslint-disable no-restricted-globals */
|
||||||
|
|
||||||
// tdarrSkipTest
|
|
||||||
const details = () => ({
|
const details = () => ({
|
||||||
id: 'Tdarr_Plugin_A47j_FFMPEG_NVENC_HEVC_Video_Only',
|
id: 'Tdarr_Plugin_A47j_FFMPEG_NVENC_HEVC_Video_Only',
|
||||||
Stage: 'Pre-processing',
|
Stage: 'Pre-processing',
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,112 @@
|
||||||
|
/* 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: {
|
||||||
|
processFile: true,
|
||||||
|
preset: '-vsync 0 -hwaccel cuda -hwaccel_output_format cuda -c:v h264_cuvid ,-map 0:v -map 0:a -map 0:s? -map -:d? -c copy -c:v:0 hevc_nvenc -preset medium -profile:v main10 -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -max_muxing_queue_size 4096 -b:v 967680 -maxrate 1257984 -minrate 677376 -bufsize 1205959 -map_metadata:g -1',
|
||||||
|
container: '.mp4',
|
||||||
|
handBrakeMode: false,
|
||||||
|
FFmpegMode: true,
|
||||||
|
reQueueAfter: true,
|
||||||
|
infoLog: 'No valid resolution selected, defaulting to 8KUHD.\n'
|
||||||
|
+ 'Video details: h264-720p \n'
|
||||||
|
+ ' 1280x720x25@8 bits.\n'
|
||||||
|
+ 'Video bitrate is 1206Kbps, overall is 1591Kbps. Calculated target is 1613Kbps.\n'
|
||||||
|
+ '☒H264 Resolution is 720p, bitrate was 1206Kbps. HEVC target bitrate will be 968Kbps.\n'
|
||||||
|
+ '☒Transcoding to HEVC.',
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
input: {
|
||||||
|
file: _.cloneDeep(require('../sampleData/media/sampleH265_1.json')),
|
||||||
|
librarySettings: {},
|
||||||
|
inputs: {
|
||||||
|
ffmpegPreset: 'veryslow',
|
||||||
|
container: 'mkv',
|
||||||
|
},
|
||||||
|
otherArguments: {},
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
processFile: true,
|
||||||
|
preset: '-vsync 0 -hwaccel cuda -hwaccel_output_format cuda -c:v hevc_cuvid ,-map 0:v -map 0:a -map 0:s? -map -:d? -c copy -c:v:0 hevc_nvenc -preset veryslow -profile:v main10 -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -max_muxing_queue_size 4096 -b:v 3207442 -maxrate 4717440 -minrate 2540160 -bufsize 3628800 -map_metadata:g -1',
|
||||||
|
container: '.mkv',
|
||||||
|
handBrakeMode: false,
|
||||||
|
FFmpegMode: true,
|
||||||
|
reQueueAfter: true,
|
||||||
|
infoLog: 'No valid resolution selected, defaulting to 8KUHD.\n'
|
||||||
|
+ 'Video details: hevc-1080p \n'
|
||||||
|
+ ' 1920x1080x25@8 bits.\n'
|
||||||
|
+ 'Video bitrate is NaNKbps, overall is 3207Kbps. Calculated target is 3629Kbps.\n'
|
||||||
|
+ '☒HEVC Bitrate for 1080p could not be determined, \n'
|
||||||
|
+ ' using sensible default of 3207Kbps.\n'
|
||||||
|
+ '☒Transcoding to HEVC.',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: {
|
||||||
|
file: _.cloneDeep(require('../sampleData/media/sampleH265_1.json')),
|
||||||
|
librarySettings: {},
|
||||||
|
inputs: {
|
||||||
|
maxResolution: '720p',
|
||||||
|
ffmpegPreset: 'veryslow',
|
||||||
|
container: 'mkv',
|
||||||
|
},
|
||||||
|
otherArguments: {},
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
processFile: true,
|
||||||
|
preset: '-vsync 0 -hwaccel cuda -hwaccel_output_format cuda -c:v hevc_cuvid -resize 1280x720 ,-map 0:v -map 0:a -map 0:s? -map -:d? -c copy -c:v:0 hevc_nvenc -preset veryslow -profile:v main10 -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -max_muxing_queue_size 4096 -b:v 1612800 -maxrate 2096640 -minrate 1128960 -bufsize 1612800 -map_metadata:g -1',
|
||||||
|
container: '.mkv',
|
||||||
|
handBrakeMode: false,
|
||||||
|
FFmpegMode: true,
|
||||||
|
reQueueAfter: true,
|
||||||
|
infoLog: 'Resizing to 1280x720.\n'
|
||||||
|
+ 'Video details: hevc-1080p \n'
|
||||||
|
+ ' 1920x1080x25@8 bits.\n'
|
||||||
|
+ 'Video bitrate is NaNKbps, overall is 3207Kbps. Calculated target is 1613Kbps.\n'
|
||||||
|
+ '☒HEVC Bitrate for 1080p could not be determined, \n'
|
||||||
|
+ ' using sensible default of 1613Kbps.\n'
|
||||||
|
+ '☒Transcoding to HEVC.',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: {
|
||||||
|
file: (() => {
|
||||||
|
// modify so no processing needed
|
||||||
|
const file = _.cloneDeep(require('../sampleData/media/sampleH264_2.json'));
|
||||||
|
file.ffProbeData.streams[0].codec_name = 'hevc';
|
||||||
|
return file;
|
||||||
|
})(),
|
||||||
|
librarySettings: {},
|
||||||
|
inputs: {
|
||||||
|
maxResolution: '1080p',
|
||||||
|
ffmpegPreset: 'veryslow',
|
||||||
|
container: 'mkv',
|
||||||
|
compressionFactor: '1',
|
||||||
|
},
|
||||||
|
otherArguments: {},
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
processFile: false,
|
||||||
|
preset: '-vsync 0 -hwaccel cuda -hwaccel_output_format cuda -c:v hevc_cuvid ,-map 0:v -map 0:a -map 0:s? -map -:d? -c copy -c:v:0 hevc_nvenc -preset veryslow -profile:v main10 -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -max_muxing_queue_size 4096 ',
|
||||||
|
container: '.mkv',
|
||||||
|
handBrakeMode: false,
|
||||||
|
FFmpegMode: true,
|
||||||
|
reQueueAfter: true,
|
||||||
|
infoLog: 'Video details: hevc-1080p \n'
|
||||||
|
+ ' 1918x1080x25@8 bits.\n'
|
||||||
|
+ 'Video bitrate is 6454Kbps, overall is 8249Kbps. Calculated target is 51786Kbps.\n'
|
||||||
|
+ '☑HEVC Bitrate is within limits.\n',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
run(tests);
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const chai = require('chai');
|
const chai = require('chai');
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
const importFresh = require('import-fresh');
|
||||||
|
|
||||||
const scriptName = path.basename(process.mainModule.filename);
|
const scriptName = path.basename(process.mainModule.filename);
|
||||||
// eslint-disable-next-line import/no-dynamic-require
|
|
||||||
const { plugin } = require(`../../Community/${scriptName}`);
|
|
||||||
|
|
||||||
const run = async (tests) => {
|
const run = async (tests) => {
|
||||||
try {
|
try {
|
||||||
|
|
@ -15,6 +14,9 @@ const run = async (tests) => {
|
||||||
|
|
||||||
let testOutput;
|
let testOutput;
|
||||||
let errorEncountered = false;
|
let errorEncountered = false;
|
||||||
|
// eslint-disable-next-line import/no-dynamic-require
|
||||||
|
const { plugin } = importFresh(`../../Community/${scriptName}`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
testOutput = await plugin(
|
testOutput = await plugin(
|
||||||
|
|
@ -24,13 +26,13 @@ const run = async (tests) => {
|
||||||
_.cloneDeep(test.input.otherArguments),
|
_.cloneDeep(test.input.otherArguments),
|
||||||
);
|
);
|
||||||
} catch (err1) {
|
} catch (err1) {
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.error(err1);
|
|
||||||
errorEncountered = err1;
|
errorEncountered = err1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (test.error && test.error.shouldThrow) {
|
if (test.error && test.error.shouldThrow) {
|
||||||
if (errorEncountered !== false) {
|
if (errorEncountered !== false) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log(errorEncountered);
|
||||||
chai.assert.deepEqual(errorEncountered.message, test.output);
|
chai.assert.deepEqual(errorEncountered.message, test.output);
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Expected plugin error but none was thrown!');
|
throw new Error('Expected plugin error but none was thrown!');
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ const fs = require('fs');
|
||||||
const chalk = require('chalk');
|
const chalk = require('chalk');
|
||||||
const childProcess = require('child_process');
|
const childProcess = require('child_process');
|
||||||
|
|
||||||
const filenames = fs.readdirSync(`${process.cwd()}/Community`);
|
const filenames = fs.readdirSync(`${process.cwd()}/Community`).reverse();
|
||||||
|
|
||||||
const run = async () => {
|
const run = async () => {
|
||||||
for (let i = 0; i < filenames.length; i += 1) {
|
for (let i = 0; i < filenames.length; i += 1) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue