mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-09 07:29:04 -07:00
Added new tests & also fixed up a few issues
- Added check to ensure video bitrate is actually a number - Updated QSV decoders since VC1 & VP8 aren't supported on latest hardware (according to wikipedia...) & AV1 added - Added new video codec check which enables protection for 10 bit encoding, basically trying to encode from something like mpeg4 into 10bit could cause issues
This commit is contained in:
parent
cfc630d55e
commit
9494a2fcad
2 changed files with 460 additions and 31 deletions
|
|
@ -28,11 +28,8 @@ const details = () => ({
|
|||
true. If it is then these will be reconverted again if they exceed the bitrate specified in "hevc_max_bitrate".
|
||||
This plugin will also attempt to use mkvpropedit to generate accurate bitrate metadata in MKV files.
|
||||
It's not required to enable mkvpropedit but highly recommended to ensure accurate bitrates are used when
|
||||
encoding your media.
|
||||
\n\n==NOTE== Intel ARC cards are reportedly working successfully with this plugin, however please bare in mind that
|
||||
I've not officially tested with them yet and your results might vary. Don't just assume it will work and if it does
|
||||
ensure you properly test your files & workflow!`,
|
||||
Version: '1.2',
|
||||
encoding your media.`,
|
||||
Version: '1.21',
|
||||
Tags: 'pre-processing,ffmpeg,video only,qsv,h265,hevc,mkvpropedit,configurable',
|
||||
Inputs: [
|
||||
{
|
||||
|
|
@ -330,10 +327,9 @@ let bitrateSettings = '';
|
|||
let inflatedCutoff = 0;
|
||||
let main10 = false;
|
||||
let high10 = false;
|
||||
let oldFormat = false;
|
||||
let videoBR = 0;
|
||||
|
||||
// Finds the first video stream and get video bitrate
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const plugin = (file, librarySettings, inputs, otherArguments) => {
|
||||
const lib = require('../methods/lib')();
|
||||
|
|
@ -390,8 +386,10 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|||
// Strings for easy to read dates in info log
|
||||
let statsThresString = new Date(statsThres);
|
||||
statsThresString = statsThresString.toUTCString();
|
||||
statsThresString = `${statsThresString.slice(0, 22)}:00 GMT`;
|
||||
let datStatsString = new Date(datStats);
|
||||
datStatsString = datStatsString.toUTCString();
|
||||
datStatsString = `${datStatsString.slice(0, 22)}:00 GMT`;
|
||||
response.infoLog += `Checking file stats - If stats are older than ${intStatsDays} days we'll grab new stats.\n
|
||||
Stats threshold: ${statsThresString}\n
|
||||
Current stats date: ${datStatsString}\n`;
|
||||
|
|
@ -437,7 +435,7 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|||
videoBR = Number(file.mediaInfo.track[i + 1].BitRate) / 1000;
|
||||
|
||||
// If MediaInfo fails somehow fallback to ffprobe - Try two types of tags that might exist
|
||||
if (videoBR <= 0) {
|
||||
if (videoBR <= 0 || Number.isNaN(videoBR)) {
|
||||
if (Number(file.ffProbeData.streams[i].tags.BPS) > 0) {
|
||||
videoBR = file.ffProbeData.streams[i].tags.BPS / 1000;
|
||||
} else {
|
||||
|
|
@ -450,20 +448,21 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|||
}
|
||||
}
|
||||
}
|
||||
// Check if duration info is filled, if so convert time format to minutes.
|
||||
if (Number.isNaN(file.meta.Duration) === false) {
|
||||
// If duration is a number then convert seconds to minutes
|
||||
duration = file.meta.Duration / 60;
|
||||
} else if (typeof file.meta.Duration !== 'undefined') {
|
||||
// Get seconds by using a Date & then convert to minutes
|
||||
duration = file.meta.Duration;
|
||||
duration = (new Date(`1970-01-01T${duration}Z`).getTime() / 1000) / 60;
|
||||
} else { // If not filled then get duration of video stream and do the same.
|
||||
duration = file.ffProbeData.streams[videoIdx].tags.DURATION;
|
||||
duration = (new Date(`1970-01-01T${duration}Z`).getTime() / 1000) / 60;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if duration info is filled, if so convert time format to minutes.
|
||||
// If not filled then get duration of video stream and do the same.
|
||||
if (typeof file.meta.Duration !== 'undefined') {
|
||||
duration = file.meta.Duration;
|
||||
// Get seconds by using a Date & then convert to minutes
|
||||
duration = (new Date(`1970-01-01T${duration}Z`).getTime() / 1000) / 60;
|
||||
} else {
|
||||
duration = file.ffProbeData.streams[videoIdx].tags.DURATION;
|
||||
duration = (new Date(`1970-01-01T${duration}Z`).getTime() / 1000) / 60;
|
||||
}
|
||||
|
||||
if (Number.isNaN(videoBR) || videoBR <= 0) {
|
||||
// Work out currentBitrate using "Bitrate = file size / (number of minutes * .0075)"
|
||||
currentBitrate = Math.round(file.file_size / (duration * 0.0075));
|
||||
|
|
@ -710,8 +709,28 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|||
}
|
||||
}
|
||||
|
||||
// Some video codecs won't play nice with 10 bit via QSV, whitelist safe ones here
|
||||
switch (file.video_codec_name) {
|
||||
case 'mpeg2':
|
||||
break;
|
||||
case 'h264':
|
||||
break;
|
||||
case 'mjpeg':
|
||||
break;
|
||||
case 'hevc':
|
||||
break;
|
||||
case 'vp9':
|
||||
break;
|
||||
case 'av1':
|
||||
break;
|
||||
default:
|
||||
oldFormat = true;
|
||||
}
|
||||
|
||||
// Are we encoding to 10 bit? If so enable correct profile & pixel format.
|
||||
if (high10 === true) { // This is used if we have High10 files. SW decode and use standard -pix_fmt p010le
|
||||
if (high10 === true || (oldFormat === true && main10 === true)) {
|
||||
// This is used if we have High10 or Main10 is enabled & odd format files.
|
||||
// SW decode and use standard -pix_fmt p010le
|
||||
extraArguments += '-profile:v main10 -pix_fmt p010le ';
|
||||
response.infoLog += '10 bit encode enabled. Setting Main10 Profile & 10 bit pixel format \n';
|
||||
} else if (main10 === true) { // Pixel formate method when using HW decode
|
||||
|
|
@ -764,21 +783,18 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|||
case 'h264':
|
||||
response.preset += '-c:v h264_qsv';
|
||||
break;
|
||||
case 'vc1':
|
||||
response.preset += '-c:v vc1_qsv';
|
||||
break;
|
||||
case 'mjpeg':
|
||||
response.preset += '-c:v mjpeg_qsv';
|
||||
break;
|
||||
case 'vp8':
|
||||
response.preset += '-c:v vp8_qsv';
|
||||
break;
|
||||
case 'hevc':
|
||||
response.preset += '-c:v hevc_qsv';
|
||||
break;
|
||||
case 'vp9': // Should be supported by 8th Gen +
|
||||
response.preset += '-c:v vp9_qsv';
|
||||
break;
|
||||
case 'av1': // Should be supported by 11th gen +
|
||||
response.preset += '-c:v av1_qsv';
|
||||
break;
|
||||
default:
|
||||
response.preset += '';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,14 @@
|
|||
const _ = require('lodash');
|
||||
const run = require('../helpers/run');
|
||||
|
||||
// Date stuff for mkvpropedit
|
||||
const intStatsDays = 7; // Use 1 week threshold for new stats
|
||||
let statsThresString = new Date(new Date().setDate(new Date().getDate() - intStatsDays)).toUTCString();
|
||||
statsThresString = `${statsThresString.slice(0, 22)}:00 GMT`;
|
||||
let datStatsString = new Date().toUTCString();
|
||||
datStatsString = `${datStatsString.slice(0, 22)}:00 GMT`;
|
||||
const tests = [
|
||||
// Test 0
|
||||
{
|
||||
input: {
|
||||
file: _.cloneDeep(require('../sampleData/media/sampleH264_1.json')),
|
||||
|
|
@ -65,6 +72,7 @@ const tests = [
|
|||
},
|
||||
},
|
||||
},
|
||||
// Test 1
|
||||
{
|
||||
input: {
|
||||
file: _.cloneDeep(require('../sampleData/media/sampleH264_1.json')),
|
||||
|
|
@ -134,15 +142,245 @@ const tests = [
|
|||
},
|
||||
},
|
||||
},
|
||||
// Test 2
|
||||
{
|
||||
input: {
|
||||
file: _.cloneDeep(require('../sampleData/media/sampleH264_1.json')),
|
||||
file: (() => {
|
||||
const file = _.cloneDeep(require('../sampleData/media/sampleH264_2.json'));
|
||||
file.ffProbeData.streams[0].profile = 'High 10';
|
||||
file.mediaInfo.track[0].extra.JBDONEDATE = new Date().toISOString();
|
||||
return file;
|
||||
})(),
|
||||
librarySettings: {},
|
||||
inputs: {
|
||||
container: 'mkv',
|
||||
encoder_speedpreset: 'fast',
|
||||
},
|
||||
otherArguments: {},
|
||||
},
|
||||
output: {
|
||||
linux: {
|
||||
processFile: true,
|
||||
preset: '-fflags +genpts <io> -map 0 -c:v hevc_qsv -b:v 3227k -minrate 2420k -maxrate 4034k -bufsize 6454k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -profile:v main10 -pix_fmt p010le -map_metadata:g -1 -metadata JBDONEDATE=2674800000',
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: "Checking file stats - If stats are older than 7 days we'll grab new stats.\n"
|
||||
+ '\n'
|
||||
+ ` Stats threshold: ${statsThresString}\n`
|
||||
+ '\n'
|
||||
+ ` Current stats date: ${datStatsString}\n`
|
||||
+ '☑ File stats are upto date! - Continuing...\n'
|
||||
+ '☑ It looks like the current video bitrate is 6454kbps. \n'
|
||||
+ 'Input file is 10bit using High10. Disabling hardware decoding to avoid problems. \n'
|
||||
+ '10 bit encode enabled. Setting Main10 Profile & 10 bit pixel format \n'
|
||||
+ 'Container for output selected as mkv. \n'
|
||||
+ 'Encode variable bitrate settings: \n'
|
||||
+ 'Target = 3227k \n'
|
||||
+ 'Minimum = 2420k \n'
|
||||
+ 'Maximum = 4034k \n'
|
||||
+ 'File Transcoding... \n',
|
||||
container: '.mkv',
|
||||
},
|
||||
win32: {
|
||||
processFile: true,
|
||||
preset: '-fflags +genpts <io> -map 0 -c:v hevc_qsv -load_plugin hevc_hw -b:v 3227k -minrate 2420k -maxrate 4034k -bufsize 6454k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -profile:v main10 -pix_fmt p010le -map_metadata:g -1 -metadata JBDONEDATE=2674800000',
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: "Checking file stats - If stats are older than 7 days we'll grab new stats.\n"
|
||||
+ '\n'
|
||||
+ ` Stats threshold: ${statsThresString}\n`
|
||||
+ '\n'
|
||||
+ ` Current stats date: ${datStatsString}\n`
|
||||
+ '☑ File stats are upto date! - Continuing...\n'
|
||||
+ '☑ It looks like the current video bitrate is 6454kbps. \n'
|
||||
+ 'Input file is 10bit using High10. Disabling hardware decoding to avoid problems. \n'
|
||||
+ '10 bit encode enabled. Setting Main10 Profile & 10 bit pixel format \n'
|
||||
+ 'Container for output selected as mkv. \n'
|
||||
+ 'Encode variable bitrate settings: \n'
|
||||
+ 'Target = 3227k \n'
|
||||
+ 'Minimum = 2420k \n'
|
||||
+ 'Maximum = 4034k \n'
|
||||
+ 'File Transcoding... \n',
|
||||
container: '.mkv',
|
||||
},
|
||||
darwin: {
|
||||
processFile: true,
|
||||
preset: '-fflags +genpts <io> -map 0 -c:v hevc_videotoolbox -b:v 3227k -minrate 2420k -maxrate 4034k -bufsize 6454k -preset fast -c:a copy -c:s copy -profile:v main10 -pix_fmt p010le -map_metadata:g -1 -metadata JBDONEDATE=2674800000',
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: "Checking file stats - If stats are older than 7 days we'll grab new stats.\n"
|
||||
+ '\n'
|
||||
+ ` Stats threshold: ${statsThresString}\n`
|
||||
+ '\n'
|
||||
+ ` Current stats date: ${datStatsString}\n`
|
||||
+ '☑ File stats are upto date! - Continuing...\n'
|
||||
+ '☑ It looks like the current video bitrate is 6454kbps. \n'
|
||||
+ 'Input file is 10bit using High10. Disabling hardware decoding to avoid problems. \n'
|
||||
+ '10 bit encode enabled. Setting Main10 Profile & 10 bit pixel format \n'
|
||||
+ 'Container for output selected as mkv. \n'
|
||||
+ 'Encode variable bitrate settings: \n'
|
||||
+ 'Target = 3227k \n'
|
||||
+ 'Minimum = 2420k \n'
|
||||
+ 'Maximum = 4034k \n'
|
||||
+ '==ALERT== OS detected as MAC - This will use VIDEOTOOLBOX to encode which is NOT QSV\n'
|
||||
+ 'cmds set in extra_qsv_options will be IGNORED!\n'
|
||||
+ 'File Transcoding... \n',
|
||||
container: '.mkv',
|
||||
},
|
||||
},
|
||||
},
|
||||
// Test 3
|
||||
{
|
||||
input: {
|
||||
file: (() => {
|
||||
const file = _.cloneDeep(require('../sampleData/media/sampleH265_1.json'));
|
||||
file.mediaInfo.track[1].BitRate = 12059590;
|
||||
file.ffProbeData.streams[0].profile = 'Main 10';
|
||||
file.mediaInfo.track[0].extra.JBDONEDATE = new Date().toISOString();
|
||||
return file;
|
||||
})(),
|
||||
librarySettings: {},
|
||||
inputs: {
|
||||
container: 'mkv',
|
||||
encoder_speedpreset: 'fast',
|
||||
reconvert_hevc: 'true',
|
||||
hevc_max_bitrate: '6000',
|
||||
bitrate_cutoff: '4000',
|
||||
},
|
||||
otherArguments: {},
|
||||
},
|
||||
output: {
|
||||
linux: {
|
||||
processFile: true,
|
||||
preset: '-fflags +genpts -hwaccel qsv -hwaccel_output_format qsv \n'
|
||||
+ ' -init_hw_device qsv:hw_any,child_device_type=vaapi -c:v hevc_qsv<io> -map 0 -c:v hevc_qsv -load_plugin hevc_hw -b:v 6030k -minrate 4523k -maxrate 7538k -bufsize 12060k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -profile:v main10 -vf scale_qsv=format=p010le -map_metadata:g -1 -metadata JBDONEDATE=2674800000',
|
||||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: "Checking file stats - If stats are older than 7 days we'll grab new stats.\n"
|
||||
+ '\n'
|
||||
+ ` Stats threshold: ${statsThresString}\n`
|
||||
+ '\n'
|
||||
+ ` Current stats date: ${datStatsString}\n`
|
||||
+ '☑ File stats are upto date! - Continuing...\n'
|
||||
+ '☑ It looks like the current video bitrate is 12060kbps. \n'
|
||||
+ 'Reconvert_hevc is true & the file is already HEVC, VP9 or AV1. Using HEVC specific cutoff of 6000kbps. \n'
|
||||
+ '☒ The file is still above this new cutoff! Reconverting. \n'
|
||||
+ '10 bit encode enabled. Setting Main10 Profile & 10 bit pixel format \n'
|
||||
+ 'Container for output selected as mkv. \n'
|
||||
+ 'Encode variable bitrate settings: \n'
|
||||
+ 'Target = 6030k \n'
|
||||
+ 'Minimum = 4523k \n'
|
||||
+ 'Maximum = 7538k \n'
|
||||
+ 'File Transcoding... \n',
|
||||
container: '.mkv',
|
||||
},
|
||||
win32: {
|
||||
processFile: true,
|
||||
preset: '-fflags +genpts -hwaccel qsv -hwaccel_output_format qsv \n'
|
||||
+ ' -init_hw_device qsv:hw_any,child_device_type=d3d11va -c:v hevc_qsv<io> -map 0 -c:v hevc_qsv -load_plugin hevc_hw -b:v 6030k -minrate 4523k -maxrate 7538k -bufsize 12060k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -profile:v main10 -vf scale_qsv=format=p010le -map_metadata:g -1 -metadata JBDONEDATE=2674800000',
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: "Checking file stats - If stats are older than 7 days we'll grab new stats.\n"
|
||||
+ '\n'
|
||||
+ ` Stats threshold: ${statsThresString}\n`
|
||||
+ '\n'
|
||||
+ ` Current stats date: ${datStatsString}\n`
|
||||
+ '☑ File stats are upto date! - Continuing...\n'
|
||||
+ '☑ It looks like the current video bitrate is 12060kbps. \n'
|
||||
+ 'Reconvert_hevc is true & the file is already HEVC, VP9 or AV1. Using HEVC specific cutoff of 6000kbps. \n'
|
||||
+ '☒ The file is still above this new cutoff! Reconverting. \n'
|
||||
+ '10 bit encode enabled. Setting Main10 Profile & 10 bit pixel format \n'
|
||||
+ 'Container for output selected as mkv. \n'
|
||||
+ 'Encode variable bitrate settings: \n'
|
||||
+ 'Target = 6030k \n'
|
||||
+ 'Minimum = 4523k \n'
|
||||
+ 'Maximum = 7538k \n'
|
||||
+ 'File Transcoding... \n',
|
||||
container: '.mkv',
|
||||
},
|
||||
darwin: {
|
||||
processFile: true,
|
||||
preset: '-fflags +genpts <io> -map 0 -c:v hevc_videotoolbox -b:v 6030k -minrate 4523k -maxrate 7538k -bufsize 12060k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -profile:v main10 -vf scale_qsv=format=p010le -map_metadata:g -1 -metadata JBDONEDATE=2674800000',
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: "Checking file stats - If stats are older than 7 days we'll grab new stats.\n"
|
||||
+ '\n'
|
||||
+ ` Stats threshold: ${statsThresString}\n`
|
||||
+ '\n'
|
||||
+ ` Current stats date: ${datStatsString}\n`
|
||||
+ '☑ File stats are upto date! - Continuing...\n'
|
||||
+ '☑ It looks like the current video bitrate is 12060kbps. \n'
|
||||
+ 'Reconvert_hevc is true & the file is already HEVC, VP9 or AV1. Using HEVC specific cutoff of 6000kbps. \n'
|
||||
+ '☒ The file is still above this new cutoff! Reconverting. \n'
|
||||
+ '10 bit encode enabled. Setting Main10 Profile & 10 bit pixel format \n'
|
||||
+ 'Container for output selected as mkv. \n'
|
||||
+ 'Encode variable bitrate settings: \n'
|
||||
+ 'Target = 6030k \n'
|
||||
+ 'Minimum = 4523k \n'
|
||||
+ 'Maximum = 7538k \n'
|
||||
+ '==ALERT== OS detected as MAC - This will use VIDEOTOOLBOX to encode which is NOT QSV\n'
|
||||
+ 'cmds set in extra_qsv_options will be IGNORED!\n'
|
||||
+ 'File Transcoding... \n',
|
||||
container: '.mkv',
|
||||
},
|
||||
},
|
||||
},
|
||||
// Test 4
|
||||
{
|
||||
input: {
|
||||
file: (() => {
|
||||
const file = _.cloneDeep(require('../sampleData/media/sampleH265_1.json'));
|
||||
file.mediaInfo.track[1].BitRate = 5000000;
|
||||
file.ffProbeData.streams[0].profile = 'Main 10';
|
||||
file.mediaInfo.track[0].extra.JBDONEDATE = new Date().toISOString();
|
||||
return file;
|
||||
})(),
|
||||
librarySettings: {},
|
||||
inputs: {
|
||||
container: 'mkv',
|
||||
encoder_speedpreset: 'fast',
|
||||
reconvert_hevc: 'true',
|
||||
hevc_max_bitrate: '6000',
|
||||
bitrate_cutoff: '4000',
|
||||
},
|
||||
otherArguments: {},
|
||||
},
|
||||
output: {
|
||||
processFile: false,
|
||||
preset: '',
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: "Checking file stats - If stats are older than 7 days we'll grab new stats.\n"
|
||||
+ '\n'
|
||||
+ ` Stats threshold: ${statsThresString}\n`
|
||||
+ '\n'
|
||||
+ ` Current stats date: ${datStatsString}\n`
|
||||
+ '☑ File stats are upto date! - Continuing...\n'
|
||||
+ '☑ It looks like the current video bitrate is 5000kbps. \n'
|
||||
+ 'Reconvert_hevc is true & the file is already HEVC, VP9 or AV1. Using HEVC specific cutoff of 6000kbps. \n'
|
||||
+ '☑ The file is NOT above this new cutoff. Exiting plugin. \n',
|
||||
container: '.mkv',
|
||||
},
|
||||
},
|
||||
// Test 5
|
||||
{
|
||||
input: {
|
||||
file: (() => {
|
||||
const file = _.cloneDeep(require('../sampleData/media/sampleH265_1.json'));
|
||||
file.container = 'mp4';
|
||||
return file;
|
||||
})(),
|
||||
librarySettings: {},
|
||||
inputs: {
|
||||
container: 'mp4',
|
||||
encoder_speedpreset: 'fast',
|
||||
enable_10bit: 'true',
|
||||
bitrate_cutoff: '2000',
|
||||
bitrate_cutoff: '3500',
|
||||
},
|
||||
otherArguments: {},
|
||||
},
|
||||
|
|
@ -153,12 +391,187 @@ const tests = [
|
|||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: 'Input file is not MKV so cannot use mkvpropedit to get new file stats. Continuing but file stats will likely be inaccurate...\n'
|
||||
+ '☑ It looks like the current video bitrate is 1206kbps. \n'
|
||||
+ '☑ Current bitrate is below set cutoff of 2000kbps. \n'
|
||||
+ '==WARNING== Failed to get an accurate video bitrate, falling back to old method to get OVERALL file bitrate of 3059kbps. Bitrate calculations for video encode will likely be inaccurate... \n'
|
||||
+ '☑ Current bitrate is below set cutoff of 3500kbps. \n'
|
||||
+ 'Cancelling plugin. \n',
|
||||
container: '.mp4',
|
||||
},
|
||||
},
|
||||
// Test 6
|
||||
{
|
||||
input: {
|
||||
file: (() => {
|
||||
const file = _.cloneDeep(require('../sampleData/media/sampleH264_2.json'));
|
||||
file.mediaInfo.track[0].extra.JBDONEDATE = new Date().toISOString();
|
||||
file.ffProbeData.streams[3].codec_name = 'hdmv_pgs_subtitle';
|
||||
file.ffProbeData.streams[4].codec_name = 'eia_608';
|
||||
file.ffProbeData.streams[5].codec_name = 'subrip';
|
||||
file.ffProbeData.streams[6].codec_name = 'timed_id3';
|
||||
return file;
|
||||
})(),
|
||||
librarySettings: {},
|
||||
inputs: {
|
||||
container: 'mp4',
|
||||
encoder_speedpreset: 'fast',
|
||||
force_conform: 'true',
|
||||
},
|
||||
otherArguments: {},
|
||||
},
|
||||
output: {
|
||||
linux: {
|
||||
processFile: true,
|
||||
preset: '-fflags +genpts -hwaccel qsv -hwaccel_output_format qsv \n'
|
||||
+ ' -init_hw_device qsv:hw_any,child_device_type=vaapi -c:v h264_qsv<io> -map 0 -c:v hevc_qsv -load_plugin hevc_hw -b:v 3227k -minrate 2420k -maxrate 4034k -bufsize 6454k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -map -0:3 -map -0:4 -map -0:5 -map -0:6 -map_metadata:g -1 -metadata JBDONEDATE=2674800000',
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: "Checking file stats - If stats are older than 7 days we'll grab new stats.\n"
|
||||
+ '\n'
|
||||
+ ` Stats threshold: ${statsThresString}\n`
|
||||
+ '\n'
|
||||
+ ` Current stats date: ${datStatsString}\n`
|
||||
+ '☑ File stats are upto date! - Continuing...\n'
|
||||
+ '☑ It looks like the current video bitrate is 6454kbps. \n'
|
||||
+ 'Container for output selected as mp4. \n'
|
||||
+ 'Encode variable bitrate settings: \n'
|
||||
+ 'Target = 3227k \n'
|
||||
+ 'Minimum = 2420k \n'
|
||||
+ 'Maximum = 4034k \n'
|
||||
+ 'File Transcoding... \n',
|
||||
container: '.mp4',
|
||||
},
|
||||
win32: {
|
||||
processFile: true,
|
||||
preset: '-fflags +genpts -hwaccel qsv -hwaccel_output_format qsv \n'
|
||||
+ ' -init_hw_device qsv:hw_any,child_device_type=d3d11va -c:v h264_qsv<io> -map 0 -c:v hevc_qsv -load_plugin hevc_hw -b:v 3227k -minrate 2420k -maxrate 4034k -bufsize 6454k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -map -0:3 -map -0:4 -map -0:5 -map -0:6 -map_metadata:g -1 -metadata JBDONEDATE=2674800000',
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: "Checking file stats - If stats are older than 7 days we'll grab new stats.\n"
|
||||
+ '\n'
|
||||
+ ` Stats threshold: ${statsThresString}\n`
|
||||
+ '\n'
|
||||
+ ` Current stats date: ${datStatsString}\n`
|
||||
+ '☑ File stats are upto date! - Continuing...\n'
|
||||
+ '☑ It looks like the current video bitrate is 6454kbps. \n'
|
||||
+ 'Container for output selected as mp4. \n'
|
||||
+ 'Encode variable bitrate settings: \n'
|
||||
+ 'Target = 3227k \n'
|
||||
+ 'Minimum = 2420k \n'
|
||||
+ 'Maximum = 4034k \n'
|
||||
+ 'File Transcoding... \n',
|
||||
container: '.mp4',
|
||||
},
|
||||
darwin: {
|
||||
processFile: true,
|
||||
preset: '-fflags +genpts -hwaccel videotoolbox<io> -map 0 -c:v hevc_videotoolbox<io> -map 0 -c:v hevc_qsv -load_plugin hevc_hw -b:v 3227k -minrate 2420k -maxrate 4034k -bufsize 6454k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -map -0:3 -map -0:4 -map -0:5 -map -0:6 -map_metadata:g -1 -metadata JBDONEDATE=2674800000',
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: "Checking file stats - If stats are older than 7 days we'll grab new stats.\n"
|
||||
+ '\n'
|
||||
+ ` Stats threshold: ${statsThresString}\n`
|
||||
+ '\n'
|
||||
+ ` Current stats date: ${datStatsString}\n`
|
||||
+ '☑ File stats are upto date! - Continuing...\n'
|
||||
+ '☑ It looks like the current video bitrate is 6454kbps. \n'
|
||||
+ 'Container for output selected as mp4. \n'
|
||||
+ 'Encode variable bitrate settings: \n'
|
||||
+ 'Target = 3227k \n'
|
||||
+ 'Minimum = 2420k \n'
|
||||
+ 'Maximum = 4034k \n'
|
||||
+ 'File Transcoding... \n',
|
||||
container: '.mp4',
|
||||
},
|
||||
},
|
||||
},
|
||||
// Test 7
|
||||
{
|
||||
input: {
|
||||
file: (() => {
|
||||
const file = _.cloneDeep(require('../sampleData/media/sampleH264_2.json'));
|
||||
file.mediaInfo.track[0].extra.JBDONEDATE = new Date().toISOString();
|
||||
file.ffProbeData.streams[3].codec_name = 'mov_text';
|
||||
file.ffProbeData.streams[4].codec_name = 'eia_608';
|
||||
file.ffProbeData.streams[5].codec_name = 'timed_id3';
|
||||
return file;
|
||||
})(),
|
||||
librarySettings: {},
|
||||
inputs: {
|
||||
container: 'mkv',
|
||||
encoder_speedpreset: 'fast',
|
||||
force_conform: 'true',
|
||||
},
|
||||
otherArguments: {},
|
||||
},
|
||||
output: {
|
||||
linux: {
|
||||
processFile: true,
|
||||
preset: '-fflags +genpts -hwaccel qsv -hwaccel_output_format qsv \n'
|
||||
+ ' -init_hw_device qsv:hw_any,child_device_type=vaapi -c:v h264_qsv<io> -map 0 -c:v hevc_qsv -load_plugin hevc_hw -b:v 3227k -minrate 2420k -maxrate 4034k -bufsize 6454k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -map -0:d -map -0:3 -map -0:4 -map -0:5 -map_metadata:g -1 -metadata JBDONEDATE=2674800000',
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: "Checking file stats - If stats are older than 7 days we'll grab new stats.\n"
|
||||
+ '\n'
|
||||
+ ` Stats threshold: ${statsThresString}\n`
|
||||
+ '\n'
|
||||
+ ` Current stats date: ${datStatsString}\n`
|
||||
+ '☑ File stats are upto date! - Continuing...\n'
|
||||
+ '☑ It looks like the current video bitrate is 6454kbps. \n'
|
||||
+ 'Container for output selected as mkv. \n'
|
||||
+ 'Encode variable bitrate settings: \n'
|
||||
+ 'Target = 3227k \n'
|
||||
+ 'Minimum = 2420k \n'
|
||||
+ 'Maximum = 4034k \n'
|
||||
+ 'File Transcoding... \n',
|
||||
container: '.mkv',
|
||||
},
|
||||
win32: {
|
||||
processFile: true,
|
||||
preset: '-fflags +genpts -hwaccel qsv -hwaccel_output_format qsv \n'
|
||||
+ ' -init_hw_device qsv:hw_any,child_device_type=d3d11va -c:v h264_qsv<io> -map 0 -c:v hevc_qsv -load_plugin hevc_hw -b:v 3227k -minrate 2420k -maxrate 4034k -bufsize 6454k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -map -0:d -map -0:3 -map -0:4 -map -0:5 -map_metadata:g -1 -metadata JBDONEDATE=2674800000',
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: "Checking file stats - If stats are older than 7 days we'll grab new stats.\n"
|
||||
+ '\n'
|
||||
+ ` Stats threshold: ${statsThresString}\n`
|
||||
+ '\n'
|
||||
+ ` Current stats date: ${datStatsString}\n`
|
||||
+ '☑ File stats are upto date! - Continuing...\n'
|
||||
+ '☑ It looks like the current video bitrate is 6454kbps. \n'
|
||||
+ 'Container for output selected as mkv. \n'
|
||||
+ 'Encode variable bitrate settings: \n'
|
||||
+ 'Target = 3227k \n'
|
||||
+ 'Minimum = 2420k \n'
|
||||
+ 'Maximum = 4034k \n'
|
||||
+ 'File Transcoding... \n',
|
||||
container: '.mkv',
|
||||
},
|
||||
darwin: {
|
||||
processFile: true,
|
||||
preset: '-fflags +genpts -hwaccel videotoolbox<io> -map 0 -c:v hevc_videotoolbox<io> -map 0 -c:v hevc_qsv -load_plugin hevc_hw -b:v 3227k -minrate 2420k -maxrate 4034k -bufsize 6454k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -map -0:d -map -0:3 -map -0:4 -map -0:5 -map_metadata:g -1 -metadata JBDONEDATE=2674800000',
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: "Checking file stats - If stats are older than 7 days we'll grab new stats.\n"
|
||||
+ '\n'
|
||||
+ ` Stats threshold: ${statsThresString}\n`
|
||||
+ '\n'
|
||||
+ ` Current stats date: ${datStatsString}\n`
|
||||
+ '☑ File stats are upto date! - Continuing...\n'
|
||||
+ '☑ It looks like the current video bitrate is 6454kbps. \n'
|
||||
+ 'Container for output selected as mkv. \n'
|
||||
+ 'Encode variable bitrate settings: \n'
|
||||
+ 'Target = 3227k \n'
|
||||
+ 'Minimum = 2420k \n'
|
||||
+ 'Maximum = 4034k \n'
|
||||
+ 'File Transcoding... \n',
|
||||
container: '.mkv',
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
void run(tests);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue