Merge branch 'HaveAGitGat:master' into master

This commit is contained in:
Aune 2022-06-13 19:00:01 +02:00 committed by GitHub
commit 61a375a320
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 360 additions and 9 deletions

View file

@ -1,10 +1,11 @@
/* eslint max-len: 0 */
const _ = require('lodash');
const run = require('../helpers/run');
const tests = [
{
input: {
file: require('../sampleData/media/sampleH264_1.json'),
file: _.cloneDeep(require('../sampleData/media/sampleH264_1.json')),
librarySettings: {},
inputs: {},
otherArguments: {},
@ -15,7 +16,7 @@ const tests = [
container: '.mp4',
handBrakeMode: false,
FFmpegMode: true,
infoLog: 'Streams are in the correct order!',
infoLog: 'File is mp4 and already has the video stream in the correct order! Due to FFmpeg issues when reordering streams in mp4 files, other stream ordering will be skipped',
},
},
{
@ -47,7 +48,7 @@ const tests = [
// }))
input: {
file: require('../sampleData/media/sampleH264_2.json'),
file: _.cloneDeep(require('../sampleData/media/sampleH264_2.json')),
librarySettings: {},
inputs: {
processOrder: 'codecs,channels,languages,streamTypes',
@ -67,6 +68,93 @@ const tests = [
infoLog: 'Streams are not in the correct order!',
},
},
{
input: {
file: (() => {
const file = _.cloneDeep(require('../sampleData/media/sampleH264_2.json'));
const s4 = file.ffProbeData.streams[4];
// eslint-disable-next-line prefer-destructuring
file.ffProbeData.streams[4] = file.ffProbeData.streams[5];
file.ffProbeData.streams[5] = s4;
return file;
})(),
librarySettings: {},
inputs: {
processOrder: 'codecs,channels,languages,streamTypes',
languages: 'eng,fre',
streamTypes: 'video,audio,subtitle',
codecs: 'flac,ac3,eac3,aac',
channels: '7.1,5.1,2,1',
},
otherArguments: {},
},
output: {
processFile: false,
preset: '',
container: '.mkv',
handBrakeMode: false,
FFmpegMode: true,
infoLog: 'Streams are in the correct order!',
},
},
{
input: {
file: (() => {
const file = _.cloneDeep(require('../sampleData/media/sampleH264_2.json'));
file.container = 'mp4';
return file;
})(),
librarySettings: {},
inputs: {
processOrder: 'codecs,channels,languages,streamTypes',
languages: 'fre,eng',
streamTypes: 'video,audio,subtitle',
codecs: 'ac3,flac,eac3,aac',
channels: '7.1,5.1,2,1',
},
otherArguments: {},
},
output: {
processFile: false,
preset: '',
container: '.mp4',
handBrakeMode: false,
FFmpegMode: true,
infoLog: 'File is mp4 and already has the video stream in the correct order! Due to FFmpeg issues when reordering streams in mp4 files, other stream ordering will be skipped',
},
},
{
input: {
file: (() => {
const file = _.cloneDeep(require('../sampleData/media/sampleH264_2.json'));
const s0 = file.ffProbeData.streams[0];
// eslint-disable-next-line prefer-destructuring
file.ffProbeData.streams[0] = file.ffProbeData.streams[1];
file.ffProbeData.streams[1] = s0;
file.container = 'mp4';
return file;
})(),
librarySettings: {},
inputs: {
processOrder: 'codecs,channels,languages,streamTypes',
languages: 'fre,eng',
streamTypes: 'video,audio,subtitle',
codecs: 'ac3,flac,eac3,aac',
channels: '7.1,5.1,2,1',
},
otherArguments: {},
},
output: {
processFile: true,
preset: ',-map 0:v? -map 0:a? -map 0:s? -map 0:d? -map 0:t? -c copy',
container: '.mp4',
handBrakeMode: false,
FFmpegMode: true,
infoLog: 'File is mp4 and contains video but video is not first stream, remuxing',
},
},
];
run(tests);

View file

@ -0,0 +1,106 @@
/* 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: false,
preset: '',
container: '.mp4',
handBrakeMode: false,
FFmpegMode: true,
reQueueAfter: false,
infoLog: 'No input entered in plugin, skipping',
},
},
{
input: {
file: _.cloneDeep(require('../sampleData/media/sampleH264_1.json')),
librarySettings: {},
inputs: {
channelCounts: '8',
},
otherArguments: {},
},
output: {
processFile: false,
preset: '',
container: '.mp4',
handBrakeMode: false,
FFmpegMode: true,
reQueueAfter: false,
infoLog: 'File only has 1 audio stream, skipping plugin',
},
},
{
input: {
file: _.cloneDeep(require('../sampleData/media/sampleH264_2.json')),
librarySettings: {},
inputs: {
channelCounts: '8',
},
otherArguments: {},
},
output: {
processFile: false,
preset: ', -map 0 -c copy -max_muxing_queue_size 9999',
container: '.mkv',
handBrakeMode: false,
FFmpegMode: true,
reQueueAfter: false,
infoLog: 'No audio streams to remove!',
},
},
{
input: {
file: _.cloneDeep(require('../sampleData/media/sampleH264_2.json')),
librarySettings: {},
inputs: {
channelCounts: '2',
},
otherArguments: {},
},
output: {
processFile: false,
preset: ', -map 0 -c copy -max_muxing_queue_size 9999',
container: '.mkv',
handBrakeMode: false,
FFmpegMode: true,
reQueueAfter: false,
infoLog: 'The number of audio streams to remove equals the total number of audio streams, skipping plugin',
},
},
{
input: {
file: (() => {
const file = _.cloneDeep(require('../sampleData/media/sampleH264_2.json'));
file.ffProbeData.streams[1].channels = 8;
file.ffProbeData.streams[2].channels = 6;
return file;
})(),
librarySettings: {},
inputs: {
channelCounts: '8,6',
},
otherArguments: {},
},
output: {
processFile: true,
preset: ', -map 0 -c copy -max_muxing_queue_size 9999 -map -0:1 -map -0:2 ',
container: '.mkv',
handBrakeMode: false,
FFmpegMode: true,
reQueueAfter: false,
infoLog: ' Removing stream 1 which has 8 channels. Removing stream 2 which has 6 channels.',
},
},
];
run(tests);

View file

@ -1,10 +1,11 @@
/* eslint max-len: 0 */
const _ = require('lodash');
const run = require('../helpers/run');
const tests = [
{
input: {
file: require('../sampleData/media/sampleH264_2.json'),
file: _.cloneDeep(require('../sampleData/media/sampleH264_2.json')),
librarySettings: {},
inputs: {},
otherArguments: {},
@ -21,7 +22,7 @@ const tests = [
},
{
input: {
file: require('../sampleData/media/sampleH264_2.json'),
file: _.cloneDeep(require('../sampleData/media/sampleH264_2.json')),
librarySettings: {},
inputs: {
preferred_language: 'fre',
@ -30,7 +31,53 @@ const tests = [
},
output: {
processFile: true,
preset: ', -c copy -map 0:v -map 0:a:3 -disposition:a:0 default -map 0:a:0 -map 0:a:1 -disposition:a:1 0 -map 0:a:2 -disposition:a:2 0 -disposition:a:3 0 -map 0:a:4 -disposition:a:4 0 -map 0:s? -map 0:d? ',
preset: ', -c copy -map 0:v? -map 0:a:3 -disposition:a:0 default -map 0:a:0 -map 0:a:1 -disposition:a:1 0 -map 0:a:2 -disposition:a:2 0 -disposition:a:3 0 -map 0:a:4 -disposition:a:4 0 -map 0:s? -map 0:d? ',
container: '.mkv',
handBrakeMode: false,
FFmpegMode: true,
reQueueAfter: true,
infoLog: '☒ Desired audio lang is not first audio stream, moving! \n',
},
},
{
input: {
file: (() => {
const file = _.cloneDeep(require('../sampleData/media/sampleH264_2.json'));
file.ffProbeData.streams[0].codec_type = 'audio';
return file;
})(),
librarySettings: {},
inputs: {
preferred_language: 'fre',
},
otherArguments: {},
},
output: {
processFile: false,
preset: '',
container: '.mp4',
handBrakeMode: false,
FFmpegMode: false,
reQueueAfter: false,
infoLog: '☑ Preferred language is already first audio track! \n',
},
},
{
input: {
file: (() => {
const file = _.cloneDeep(require('../sampleData/media/sampleH264_2.json'));
file.ffProbeData.streams[0].codec_type = 'audio';
return file;
})(),
librarySettings: {},
inputs: {
preferred_language: 'eng',
},
otherArguments: {},
},
output: {
processFile: true,
preset: ', -c copy -map 0:v? -map 0:a:1 -disposition:a:0 default -map 0:a:0 -disposition:a:1 0 -map 0:a:2 -disposition:a:2 0 -map 0:a:3 -disposition:a:3 0 -map 0:a:4 -disposition:a:4 0 -map 0:a:5 -disposition:a:5 0 -map 0:s? -map 0:d? ',
container: '.mkv',
handBrakeMode: false,
FFmpegMode: true,