|
|
|
@ -1,6 +1,7 @@
|
|
|
|
"use strict";
|
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
exports.plugin = exports.details = void 0;
|
|
|
|
exports.plugin = exports.details = void 0;
|
|
|
|
|
|
|
|
var fileUtils_1 = require("../../../../FlowHelpers/1.0.0/fileUtils");
|
|
|
|
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
|
|
|
|
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
|
|
|
|
var details = function () { return ({
|
|
|
|
var details = function () { return ({
|
|
|
|
name: 'Ensure Audio Stream',
|
|
|
|
name: 'Ensure Audio Stream',
|
|
|
|
@ -63,6 +64,45 @@ var details = function () { return ({
|
|
|
|
},
|
|
|
|
},
|
|
|
|
tooltip: 'Enter the desired number of channels',
|
|
|
|
tooltip: 'Enter the desired number of channels',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
label: 'Enable Bitrate',
|
|
|
|
|
|
|
|
name: 'enableBitrate',
|
|
|
|
|
|
|
|
type: 'boolean',
|
|
|
|
|
|
|
|
defaultValue: 'false',
|
|
|
|
|
|
|
|
inputUI: {
|
|
|
|
|
|
|
|
type: 'dropdown',
|
|
|
|
|
|
|
|
options: [
|
|
|
|
|
|
|
|
'false',
|
|
|
|
|
|
|
|
'true',
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
tooltip: 'Toggle whether to enable setting audio bitrate',
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
label: 'Bitrate',
|
|
|
|
|
|
|
|
name: 'bitrate',
|
|
|
|
|
|
|
|
type: 'string',
|
|
|
|
|
|
|
|
defaultValue: '128k',
|
|
|
|
|
|
|
|
inputUI: {
|
|
|
|
|
|
|
|
type: 'text',
|
|
|
|
|
|
|
|
displayConditions: {
|
|
|
|
|
|
|
|
logic: 'AND',
|
|
|
|
|
|
|
|
sets: [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
logic: 'AND',
|
|
|
|
|
|
|
|
inputs: [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
name: 'enableBitrate',
|
|
|
|
|
|
|
|
value: 'true',
|
|
|
|
|
|
|
|
condition: '===',
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
tooltip: 'Specify the audio bitrate for newly added channels',
|
|
|
|
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
outputs: [
|
|
|
|
outputs: [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -80,7 +120,7 @@ var getHighest = function (first, second) {
|
|
|
|
return second;
|
|
|
|
return second;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var attemptMakeStream = function (_a) {
|
|
|
|
var attemptMakeStream = function (_a) {
|
|
|
|
var args = _a.args, langTag = _a.langTag, streams = _a.streams, audioCodec = _a.audioCodec, audioEncoder = _a.audioEncoder, wantedChannelCount = _a.wantedChannelCount;
|
|
|
|
var args = _a.args, langTag = _a.langTag, streams = _a.streams, audioCodec = _a.audioCodec, audioEncoder = _a.audioEncoder, wantedChannelCount = _a.wantedChannelCount, enableBitrate = _a.enableBitrate, bitrate = _a.bitrate;
|
|
|
|
var langMatch = function (stream) {
|
|
|
|
var langMatch = function (stream) {
|
|
|
|
var _a;
|
|
|
|
var _a;
|
|
|
|
return ((langTag === 'und'
|
|
|
|
return ((langTag === 'und'
|
|
|
|
@ -131,6 +171,10 @@ var attemptMakeStream = function (_a) {
|
|
|
|
streamCopy.index = streams.length;
|
|
|
|
streamCopy.index = streams.length;
|
|
|
|
streamCopy.outputArgs.push('-c:{outputIndex}', audioEncoder);
|
|
|
|
streamCopy.outputArgs.push('-c:{outputIndex}', audioEncoder);
|
|
|
|
streamCopy.outputArgs.push('-ac', "".concat(targetChannels));
|
|
|
|
streamCopy.outputArgs.push('-ac', "".concat(targetChannels));
|
|
|
|
|
|
|
|
if (enableBitrate) {
|
|
|
|
|
|
|
|
var ffType = (0, fileUtils_1.getFfType)(streamCopy.codec_type);
|
|
|
|
|
|
|
|
streamCopy.outputArgs.push("-b:".concat(ffType, ":{outputTypeIndex}"), "".concat(bitrate));
|
|
|
|
|
|
|
|
}
|
|
|
|
// eslint-disable-next-line no-param-reassign
|
|
|
|
// eslint-disable-next-line no-param-reassign
|
|
|
|
args.variables.ffmpegCommand.shouldProcess = true;
|
|
|
|
args.variables.ffmpegCommand.shouldProcess = true;
|
|
|
|
streams.push(streamCopy);
|
|
|
|
streams.push(streamCopy);
|
|
|
|
@ -144,6 +188,8 @@ var plugin = function (args) {
|
|
|
|
var audioEncoder = String(args.inputs.audioEncoder);
|
|
|
|
var audioEncoder = String(args.inputs.audioEncoder);
|
|
|
|
var langTag = String(args.inputs.language).toLowerCase();
|
|
|
|
var langTag = String(args.inputs.language).toLowerCase();
|
|
|
|
var wantedChannelCount = Number(args.inputs.channels);
|
|
|
|
var wantedChannelCount = Number(args.inputs.channels);
|
|
|
|
|
|
|
|
var enableBitrate = Boolean(args.inputs.enableBitrate);
|
|
|
|
|
|
|
|
var bitrate = String(args.inputs.bitrate);
|
|
|
|
var streams = args.variables.ffmpegCommand.streams;
|
|
|
|
var streams = args.variables.ffmpegCommand.streams;
|
|
|
|
var audioCodec = audioEncoder;
|
|
|
|
var audioCodec = audioEncoder;
|
|
|
|
if (audioEncoder === 'dca') {
|
|
|
|
if (audioEncoder === 'dca') {
|
|
|
|
@ -162,6 +208,8 @@ var plugin = function (args) {
|
|
|
|
audioCodec: audioCodec,
|
|
|
|
audioCodec: audioCodec,
|
|
|
|
audioEncoder: audioEncoder,
|
|
|
|
audioEncoder: audioEncoder,
|
|
|
|
wantedChannelCount: wantedChannelCount,
|
|
|
|
wantedChannelCount: wantedChannelCount,
|
|
|
|
|
|
|
|
enableBitrate: enableBitrate,
|
|
|
|
|
|
|
|
bitrate: bitrate,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if (!addedOrExists) {
|
|
|
|
if (!addedOrExists) {
|
|
|
|
attemptMakeStream({
|
|
|
|
attemptMakeStream({
|
|
|
|
@ -171,6 +219,8 @@ var plugin = function (args) {
|
|
|
|
audioCodec: audioCodec,
|
|
|
|
audioCodec: audioCodec,
|
|
|
|
audioEncoder: audioEncoder,
|
|
|
|
audioEncoder: audioEncoder,
|
|
|
|
wantedChannelCount: wantedChannelCount,
|
|
|
|
wantedChannelCount: wantedChannelCount,
|
|
|
|
|
|
|
|
enableBitrate: enableBitrate,
|
|
|
|
|
|
|
|
bitrate: bitrate,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
|