|
|
|
|
@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
|
exports.plugin = exports.details = void 0;
|
|
|
|
|
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
|
|
|
|
|
var details = function () { return ({
|
|
|
|
|
name: 'Check Multiple Video Streams',
|
|
|
|
|
description: 'This plugin checks if an input file has more than one video stream.',
|
|
|
|
|
name: 'Check Video Streams Count',
|
|
|
|
|
description: 'This plugin checks if the number of video streams is 1 or more.',
|
|
|
|
|
style: {
|
|
|
|
|
borderColor: 'orange',
|
|
|
|
|
},
|
|
|
|
|
@ -32,14 +32,20 @@ var plugin = function (args) {
|
|
|
|
|
var lib = require('../../../../../methods/lib')();
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
|
|
|
|
|
args.inputs = lib.loadDefaultValues(args.inputs, details);
|
|
|
|
|
var outputNumber = 2; // Default to 'Special case' (> 1 video tracks)
|
|
|
|
|
var ffProbeData = args.inputFileObj.ffProbeData;
|
|
|
|
|
if (!ffProbeData || !ffProbeData.streams) {
|
|
|
|
|
throw new Error('ffProbeData or ffProbeData.streams is not available.');
|
|
|
|
|
}
|
|
|
|
|
var videoStreams = ffProbeData.streams.filter(function (stream) { return stream.codec_type === 'video'; }).length;
|
|
|
|
|
if (videoStreams === 1) {
|
|
|
|
|
outputNumber = 1; // 'Success' (has exactly one video stream)
|
|
|
|
|
var outputNumber = 1; // Default to one video stream
|
|
|
|
|
if (videoStreams === 0) {
|
|
|
|
|
throw new Error('No video streams found in file.');
|
|
|
|
|
}
|
|
|
|
|
else if (videoStreams === 1) {
|
|
|
|
|
outputNumber = 1; // One video stream
|
|
|
|
|
}
|
|
|
|
|
else if (videoStreams > 1) {
|
|
|
|
|
outputNumber = 3; // More than one video stream
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
outputFileObj: args.inputFileObj,
|