From 0ba6ceb1827ef8af17dea304110e5799fa1be178 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Tue, 25 Jun 2024 06:57:04 +0300 Subject: [PATCH 1/5] Add ffmpegCommand.init to ensure "Begin" command has been used --- .../ffmpegCommandExecute/1.0.0/index.ts | 3 +++ .../ffmpegCommandStart/1.0.0/index.ts | 1 + .../FlowHelpers/1.0.0/interfaces/flowUtils.ts | 14 ++++++++++++++ .../FlowHelpers/1.0.0/interfaces/interfaces.ts | 1 + 4 files changed, 19 insertions(+) create mode 100644 FlowPluginsTs/FlowHelpers/1.0.0/interfaces/flowUtils.ts diff --git a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandExecute/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandExecute/1.0.0/index.ts index 3a85dd6cd..29435685f 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandExecute/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandExecute/1.0.0/index.ts @@ -180,6 +180,9 @@ const plugin = async (args: IpluginInputArgs): Promise => { args.logOutcome('tSuc'); + // eslint-disable-next-line no-param-reassign + args.variables.ffmpegCommand.init = false; + return { outputFileObj: { _id: outputFilePath, diff --git a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandStart/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandStart/1.0.0/index.ts index a2824072a..1cb6c2f1d 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandStart/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandStart/1.0.0/index.ts @@ -40,6 +40,7 @@ const plugin = (args:IpluginInputArgs):IpluginOutputArgs => { const container = getContainer(args.inputFileObj._id); const ffmpegCommand = { + init: true, inputFiles: [], streams: JSON.parse(JSON.stringify(args.inputFileObj.ffProbeData.streams)).map((stream:Istreams) => ({ ...stream, diff --git a/FlowPluginsTs/FlowHelpers/1.0.0/interfaces/flowUtils.ts b/FlowPluginsTs/FlowHelpers/1.0.0/interfaces/flowUtils.ts new file mode 100644 index 000000000..73291a823 --- /dev/null +++ b/FlowPluginsTs/FlowHelpers/1.0.0/interfaces/flowUtils.ts @@ -0,0 +1,14 @@ +import { IpluginInputArgs } from './interfaces'; + +// eslint-disable-next-line import/prefer-default-export +export const checkFfmpegCommandInit = (args: IpluginInputArgs): void => { + if (!args?.variables?.ffmpegCommand?.init) { + throw new Error( + 'FFmpeg command plugins not used correctly.' + + ' Please use the "Begin Command" plugin before using this plugin.' + + ' Afterwards, use the "Execute" plugin to execute the built FFmpeg command.' + + ' Once the "Execute" plugin has been used, you need to use a new "Begin Command"' + + ' plugin to start a new FFmpeg command.', + ); + } +}; diff --git a/FlowPluginsTs/FlowHelpers/1.0.0/interfaces/interfaces.ts b/FlowPluginsTs/FlowHelpers/1.0.0/interfaces/interfaces.ts index d39b3a0da..490d3e962 100644 --- a/FlowPluginsTs/FlowHelpers/1.0.0/interfaces/interfaces.ts +++ b/FlowPluginsTs/FlowHelpers/1.0.0/interfaces/interfaces.ts @@ -87,6 +87,7 @@ export interface IffmpegCommandStream extends Istreams { } export interface IffmpegCommand { + init: boolean, inputFiles: string[], streams: IffmpegCommandStream[] container: string, From 69afa93e70f19ab950f69fe2add645492a72988a Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Tue, 25 Jun 2024 06:58:27 +0300 Subject: [PATCH 2/5] Add checkFfmpegCommandInit(() to ffmpeg command plugins --- .../ffmpegCommand/ffmpegCommand10BitVideo/1.0.0/index.ts | 3 +++ .../ffmpegCommand/ffmpegCommandCropBlackBars/1.0.0/index.ts | 3 +++ .../ffmpegCommand/ffmpegCommandCustomArguments/1.0.0/index.ts | 3 +++ .../ffmpegCommandEnsureAudioStream/1.0.0/index.ts | 3 +++ .../ffmpegCommand/ffmpegCommandHdrToSdr/1.0.0/index.ts | 3 +++ .../ffmpegCommand/ffmpegCommandNormalizeAudio/1.0.0/index.ts | 3 +++ .../ffmpegCommandRemoveDataStreams/1.0.0/index.ts | 3 +++ .../ffmpegCommandRemoveStreamByProperty/1.0.0/index.ts | 3 +++ .../ffmpegCommand/ffmpegCommandRemoveSubtitles/1.0.0/index.ts | 3 +++ .../ffmpegCommand/ffmpegCommandRorderStreams/1.0.0/index.ts | 3 +++ .../ffmpegCommand/ffmpegCommandSetContainer/1.0.0/index.ts | 3 +++ .../ffmpegCommand/ffmpegCommandSetVdeoFramerate/1.0.0/index.ts | 3 +++ .../ffmpegCommandSetVdeoResolution/1.0.0/index.ts | 3 +++ .../ffmpegCommand/ffmpegCommandSetVideoBitrate/1.0.0/index.ts | 3 +++ .../ffmpegCommand/ffmpegCommandSetVideoEncoder/1.0.0/index.ts | 3 +++ 15 files changed, 45 insertions(+) diff --git a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommand10BitVideo/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommand10BitVideo/1.0.0/index.ts index a72bd7fad..03d2e9f90 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommand10BitVideo/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommand10BitVideo/1.0.0/index.ts @@ -4,6 +4,7 @@ import { IpluginInputArgs, IpluginOutputArgs, } from '../../../../FlowHelpers/1.0.0/interfaces/interfaces'; +import { checkFfmpegCommandInit } from '../../../../FlowHelpers/1.0.0/interfaces/flowUtils'; /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ const details = () :IpluginDetails => ({ @@ -33,6 +34,8 @@ const plugin = (args:IpluginInputArgs):IpluginOutputArgs => { // eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign args.inputs = lib.loadDefaultValues(args.inputs, details); + checkFfmpegCommandInit(args); + for (let i = 0; i < args.variables.ffmpegCommand.streams.length; i += 1) { const stream = args.variables.ffmpegCommand.streams[i]; if (stream.codec_type === 'video') { diff --git a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandCropBlackBars/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandCropBlackBars/1.0.0/index.ts index 9f05381fb..9c54868f2 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandCropBlackBars/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandCropBlackBars/1.0.0/index.ts @@ -1,3 +1,4 @@ +import { checkFfmpegCommandInit } from '../../../../FlowHelpers/1.0.0/interfaces/flowUtils'; import { IpluginDetails, IpluginInputArgs, @@ -33,6 +34,8 @@ const plugin = (args:IpluginInputArgs):IpluginOutputArgs => { // eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign args.inputs = lib.loadDefaultValues(args.inputs, details); + checkFfmpegCommandInit(args); + return { outputFileObj: args.inputFileObj, outputNumber: 1, diff --git a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandCustomArguments/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandCustomArguments/1.0.0/index.ts index 37215090a..74ac04e0b 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandCustomArguments/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandCustomArguments/1.0.0/index.ts @@ -1,3 +1,4 @@ +import { checkFfmpegCommandInit } from '../../../../FlowHelpers/1.0.0/interfaces/flowUtils'; import { IpluginDetails, IpluginInputArgs, @@ -54,6 +55,8 @@ const plugin = (args:IpluginInputArgs):IpluginOutputArgs => { // eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign args.inputs = lib.loadDefaultValues(args.inputs, details); + checkFfmpegCommandInit(args); + const inputArguments = String(args.inputs.inputArguments); const outputArguments = String(args.inputs.outputArguments); diff --git a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandEnsureAudioStream/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandEnsureAudioStream/1.0.0/index.ts index ff3b084a9..49efcbe49 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandEnsureAudioStream/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandEnsureAudioStream/1.0.0/index.ts @@ -1,4 +1,5 @@ import { getFfType } from '../../../../FlowHelpers/1.0.0/fileUtils'; +import { checkFfmpegCommandInit } from '../../../../FlowHelpers/1.0.0/interfaces/flowUtils'; import { IffmpegCommandStream, IpluginDetails, @@ -270,6 +271,8 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => { // eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign args.inputs = lib.loadDefaultValues(args.inputs, details); + checkFfmpegCommandInit(args); + const audioEncoder = String(args.inputs.audioEncoder); const langTag = String(args.inputs.language).toLowerCase(); const wantedChannelCount = Number(args.inputs.channels); diff --git a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandHdrToSdr/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandHdrToSdr/1.0.0/index.ts index 16022748d..3383db4a8 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandHdrToSdr/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandHdrToSdr/1.0.0/index.ts @@ -1,3 +1,4 @@ +import { checkFfmpegCommandInit } from '../../../../FlowHelpers/1.0.0/interfaces/flowUtils'; import { IpluginDetails, IpluginInputArgs, @@ -32,6 +33,8 @@ const plugin = (args:IpluginInputArgs):IpluginOutputArgs => { // eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign args.inputs = lib.loadDefaultValues(args.inputs, details); + checkFfmpegCommandInit(args); + args.variables.ffmpegCommand.streams.forEach((stream) => { if (stream.codec_type === 'video') { stream.outputArgs.push('-vf', 'zscale=t=linear:npl=100,format=yuv420p'); diff --git a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandNormalizeAudio/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandNormalizeAudio/1.0.0/index.ts index fd925f3d3..e427d14aa 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandNormalizeAudio/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandNormalizeAudio/1.0.0/index.ts @@ -1,3 +1,4 @@ +import { checkFfmpegCommandInit } from '../../../../FlowHelpers/1.0.0/interfaces/flowUtils'; import { IpluginDetails, IpluginInputArgs, @@ -33,6 +34,8 @@ const plugin = (args:IpluginInputArgs):IpluginOutputArgs => { // eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign args.inputs = lib.loadDefaultValues(args.inputs, details); + checkFfmpegCommandInit(args); + return { outputFileObj: args.inputFileObj, outputNumber: 1, diff --git a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRemoveDataStreams/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRemoveDataStreams/1.0.0/index.ts index 041da601d..c4b5ba000 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRemoveDataStreams/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRemoveDataStreams/1.0.0/index.ts @@ -1,5 +1,6 @@ /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ +import { checkFfmpegCommandInit } from '../../../../FlowHelpers/1.0.0/interfaces/flowUtils'; import { IpluginDetails, IpluginInputArgs, @@ -35,6 +36,8 @@ const plugin = (args:IpluginInputArgs):IpluginOutputArgs => { // eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign args.inputs = lib.loadDefaultValues(args.inputs, details); + checkFfmpegCommandInit(args); + args.variables.ffmpegCommand.streams.forEach((stream) => { if (stream.codec_type === 'data') { stream.removed = true; diff --git a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRemoveStreamByProperty/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRemoveStreamByProperty/1.0.0/index.ts index 2a2d62751..7d034983a 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRemoveStreamByProperty/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRemoveStreamByProperty/1.0.0/index.ts @@ -1,3 +1,4 @@ +import { checkFfmpegCommandInit } from '../../../../FlowHelpers/1.0.0/interfaces/flowUtils'; import { IpluginDetails, IpluginInputArgs, @@ -84,6 +85,8 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => { // eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign args.inputs = lib.loadDefaultValues(args.inputs, details); + checkFfmpegCommandInit(args); + const propertyToCheck = String(args.inputs.propertyToCheck).trim(); const valuesToRemove = String(args.inputs.valuesToRemove).trim().split(',').map((item) => item.trim()); const condition = String(args.inputs.condition); diff --git a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRemoveSubtitles/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRemoveSubtitles/1.0.0/index.ts index f25661563..c36125327 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRemoveSubtitles/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRemoveSubtitles/1.0.0/index.ts @@ -1,5 +1,6 @@ /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ +import { checkFfmpegCommandInit } from '../../../../FlowHelpers/1.0.0/interfaces/flowUtils'; import { IpluginDetails, IpluginInputArgs, @@ -34,6 +35,8 @@ const plugin = (args:IpluginInputArgs):IpluginOutputArgs => { // eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign args.inputs = lib.loadDefaultValues(args.inputs, details); + checkFfmpegCommandInit(args); + args.variables.ffmpegCommand.streams.forEach((stream) => { if (stream.codec_type === 'subtitle') { stream.removed = true; diff --git a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRorderStreams/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRorderStreams/1.0.0/index.ts index a1f3a11a9..1ca8dd7f3 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRorderStreams/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRorderStreams/1.0.0/index.ts @@ -1,3 +1,4 @@ +import { checkFfmpegCommandInit } from '../../../../FlowHelpers/1.0.0/interfaces/flowUtils'; import { IffmpegCommandStream, IpluginDetails, @@ -109,6 +110,8 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => { // eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign args.inputs = lib.loadDefaultValues(args.inputs, details); + checkFfmpegCommandInit(args); + let streams: IffmpegCommandStream[] = JSON.parse(JSON.stringify(args.variables.ffmpegCommand.streams)); streams.forEach((stream, index) => { diff --git a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetContainer/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetContainer/1.0.0/index.ts index b573af3f5..cfdcf4f06 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetContainer/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetContainer/1.0.0/index.ts @@ -1,6 +1,7 @@ /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ import { getContainer } from '../../../../FlowHelpers/1.0.0/fileUtils'; +import { checkFfmpegCommandInit } from '../../../../FlowHelpers/1.0.0/interfaces/flowUtils'; import { IpluginDetails, IpluginInputArgs, @@ -64,6 +65,8 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => { // eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign args.inputs = lib.loadDefaultValues(args.inputs, details); + checkFfmpegCommandInit(args); + const newContainer = String(args.inputs.container); const { forceConform } = args.inputs; diff --git a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVdeoFramerate/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVdeoFramerate/1.0.0/index.ts index 37021be51..bf76158f5 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVdeoFramerate/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVdeoFramerate/1.0.0/index.ts @@ -1,3 +1,4 @@ +import { checkFfmpegCommandInit } from '../../../../FlowHelpers/1.0.0/interfaces/flowUtils'; import { IpluginDetails, IpluginInputArgs, @@ -44,6 +45,8 @@ const plugin = (args:IpluginInputArgs):IpluginOutputArgs => { // eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign args.inputs = lib.loadDefaultValues(args.inputs, details); + checkFfmpegCommandInit(args); + const desiredFrameRate = Number(args.inputs.framerate); args.jobLog(`Desired framerate: ${desiredFrameRate}`); diff --git a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVdeoResolution/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVdeoResolution/1.0.0/index.ts index 8f44b1f32..6069a9277 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVdeoResolution/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVdeoResolution/1.0.0/index.ts @@ -1,3 +1,4 @@ +import { checkFfmpegCommandInit } from '../../../../FlowHelpers/1.0.0/interfaces/flowUtils'; import { IpluginDetails, IpluginInputArgs, @@ -77,6 +78,8 @@ const plugin = (args:IpluginInputArgs):IpluginOutputArgs => { // eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign args.inputs = lib.loadDefaultValues(args.inputs, details); + checkFfmpegCommandInit(args); + for (let i = 0; i < args.variables.ffmpegCommand.streams.length; i += 1) { const stream = args.variables.ffmpegCommand.streams[i]; diff --git a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVideoBitrate/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVideoBitrate/1.0.0/index.ts index 178768552..535087286 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVideoBitrate/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVideoBitrate/1.0.0/index.ts @@ -4,6 +4,7 @@ import { IpluginOutputArgs, } from '../../../../FlowHelpers/1.0.0/interfaces/interfaces'; import { getFfType } from '../../../../FlowHelpers/1.0.0/fileUtils'; +import { checkFfmpegCommandInit } from '../../../../FlowHelpers/1.0.0/interfaces/flowUtils'; /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ const details = (): IpluginDetails => ({ @@ -120,6 +121,8 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => { // eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign args.inputs = lib.loadDefaultValues(args.inputs, details); + checkFfmpegCommandInit(args); + const { useInputBitrate } = args.inputs; const targetBitratePercent = String(args.inputs.targetBitratePercent); const fallbackBitrate = String(args.inputs.fallbackBitrate); diff --git a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVideoEncoder/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVideoEncoder/1.0.0/index.ts index 10dacd31c..3591ce070 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVideoEncoder/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVideoEncoder/1.0.0/index.ts @@ -1,6 +1,7 @@ /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ import { getEncoder } from '../../../../FlowHelpers/1.0.0/hardwareUtils'; +import { checkFfmpegCommandInit } from '../../../../FlowHelpers/1.0.0/interfaces/flowUtils'; import { IpluginDetails, IpluginInputArgs, @@ -181,6 +182,8 @@ const plugin = async (args: IpluginInputArgs): Promise => { // eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign args.inputs = lib.loadDefaultValues(args.inputs, details); + checkFfmpegCommandInit(args); + const hardwareDecoding = args.inputs.hardwareDecoding === true; const hardwareType = String(args.inputs.hardwareType); args.variables.ffmpegCommand.hardwareDecoding = hardwareDecoding; From f7ee4d8b4418e86980f12fdb51bcac67f531b284 Mon Sep 17 00:00:00 2001 From: HaveAGitGat Date: Tue, 25 Jun 2024 04:00:21 +0000 Subject: [PATCH 3/5] Apply auto-build changes --- .../ffmpegCommand10BitVideo/1.0.0/index.js | 2 ++ .../ffmpegCommandCropBlackBars/1.0.0/index.js | 2 ++ .../ffmpegCommandCustomArguments/1.0.0/index.js | 2 ++ .../ffmpegCommandEnsureAudioStream/1.0.0/index.js | 2 ++ .../ffmpegCommandExecute/1.0.0/index.js | 2 ++ .../ffmpegCommandHdrToSdr/1.0.0/index.js | 2 ++ .../ffmpegCommandNormalizeAudio/1.0.0/index.js | 2 ++ .../ffmpegCommandRemoveDataStreams/1.0.0/index.js | 2 ++ .../1.0.0/index.js | 2 ++ .../ffmpegCommandRemoveSubtitles/1.0.0/index.js | 2 ++ .../ffmpegCommandRorderStreams/1.0.0/index.js | 2 ++ .../ffmpegCommandSetContainer/1.0.0/index.js | 2 ++ .../ffmpegCommandSetVdeoFramerate/1.0.0/index.js | 2 ++ .../ffmpegCommandSetVdeoResolution/1.0.0/index.js | 2 ++ .../ffmpegCommandSetVideoBitrate/1.0.0/index.js | 2 ++ .../ffmpegCommandSetVideoEncoder/1.0.0/index.js | 2 ++ .../ffmpegCommandStart/1.0.0/index.js | 1 + .../FlowHelpers/1.0.0/interfaces/flowUtils.js | 15 +++++++++++++++ 18 files changed, 48 insertions(+) create mode 100644 FlowPlugins/FlowHelpers/1.0.0/interfaces/flowUtils.js diff --git a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommand10BitVideo/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommand10BitVideo/1.0.0/index.js index 90f7d2bbc..52954fc8c 100644 --- a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommand10BitVideo/1.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommand10BitVideo/1.0.0/index.js @@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); exports.plugin = exports.details = void 0; var os_1 = __importDefault(require("os")); +var flowUtils_1 = require("../../../../FlowHelpers/1.0.0/interfaces/flowUtils"); /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ var details = function () { return ({ name: '10 Bit Video', @@ -32,6 +33,7 @@ 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); + (0, flowUtils_1.checkFfmpegCommandInit)(args); for (var i = 0; i < args.variables.ffmpegCommand.streams.length; i += 1) { var stream = args.variables.ffmpegCommand.streams[i]; if (stream.codec_type === 'video') { diff --git a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandCropBlackBars/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandCropBlackBars/1.0.0/index.js index 20439f7e3..7a713c6ae 100644 --- a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandCropBlackBars/1.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandCropBlackBars/1.0.0/index.js @@ -1,6 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.plugin = exports.details = void 0; +var flowUtils_1 = require("../../../../FlowHelpers/1.0.0/interfaces/flowUtils"); /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ var details = function () { return ({ name: 'Crop Black Bars', @@ -29,6 +30,7 @@ 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); + (0, flowUtils_1.checkFfmpegCommandInit)(args); return { outputFileObj: args.inputFileObj, outputNumber: 1, diff --git a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandCustomArguments/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandCustomArguments/1.0.0/index.js index 4bb3829ef..050df9141 100644 --- a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandCustomArguments/1.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandCustomArguments/1.0.0/index.js @@ -1,6 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.plugin = exports.details = void 0; +var flowUtils_1 = require("../../../../FlowHelpers/1.0.0/interfaces/flowUtils"); /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ var details = function () { return ({ name: 'Custom Arguments', @@ -50,6 +51,7 @@ 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); + (0, flowUtils_1.checkFfmpegCommandInit)(args); var inputArguments = String(args.inputs.inputArguments); var outputArguments = String(args.inputs.outputArguments); if (inputArguments) { diff --git a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandEnsureAudioStream/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandEnsureAudioStream/1.0.0/index.js index 0acee6a7f..2d2deb81d 100644 --- a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandEnsureAudioStream/1.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandEnsureAudioStream/1.0.0/index.js @@ -2,6 +2,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.plugin = exports.details = void 0; var fileUtils_1 = require("../../../../FlowHelpers/1.0.0/fileUtils"); +var flowUtils_1 = require("../../../../FlowHelpers/1.0.0/interfaces/flowUtils"); /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ var details = function () { return ({ name: 'Ensure Audio Stream', @@ -224,6 +225,7 @@ 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); + (0, flowUtils_1.checkFfmpegCommandInit)(args); var audioEncoder = String(args.inputs.audioEncoder); var langTag = String(args.inputs.language).toLowerCase(); var wantedChannelCount = Number(args.inputs.channels); diff --git a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandExecute/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandExecute/1.0.0/index.js index 49605db2e..8139245f2 100644 --- a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandExecute/1.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandExecute/1.0.0/index.js @@ -193,6 +193,8 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function throw new Error('FFmpeg failed'); } args.logOutcome('tSuc'); + // eslint-disable-next-line no-param-reassign + args.variables.ffmpegCommand.init = false; return [2 /*return*/, { outputFileObj: { _id: outputFilePath, diff --git a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandHdrToSdr/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandHdrToSdr/1.0.0/index.js index 6cda6f2b0..cdb7db056 100644 --- a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandHdrToSdr/1.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandHdrToSdr/1.0.0/index.js @@ -1,6 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.plugin = exports.details = void 0; +var flowUtils_1 = require("../../../../FlowHelpers/1.0.0/interfaces/flowUtils"); /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ var details = function () { return ({ name: 'HDR to SDR', @@ -28,6 +29,7 @@ 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); + (0, flowUtils_1.checkFfmpegCommandInit)(args); args.variables.ffmpegCommand.streams.forEach(function (stream) { if (stream.codec_type === 'video') { stream.outputArgs.push('-vf', 'zscale=t=linear:npl=100,format=yuv420p'); diff --git a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandNormalizeAudio/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandNormalizeAudio/1.0.0/index.js index 26fcf9ca4..61a8eda08 100644 --- a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandNormalizeAudio/1.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandNormalizeAudio/1.0.0/index.js @@ -1,6 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.plugin = exports.details = void 0; +var flowUtils_1 = require("../../../../FlowHelpers/1.0.0/interfaces/flowUtils"); /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ var details = function () { return ({ name: 'Normalize Audio', @@ -29,6 +30,7 @@ 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); + (0, flowUtils_1.checkFfmpegCommandInit)(args); return { outputFileObj: args.inputFileObj, outputNumber: 1, diff --git a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRemoveDataStreams/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRemoveDataStreams/1.0.0/index.js index dea876d78..9161089bc 100644 --- a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRemoveDataStreams/1.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRemoveDataStreams/1.0.0/index.js @@ -2,6 +2,7 @@ /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ Object.defineProperty(exports, "__esModule", { value: true }); exports.plugin = exports.details = void 0; +var flowUtils_1 = require("../../../../FlowHelpers/1.0.0/interfaces/flowUtils"); /* eslint-disable no-param-reassign */ var details = function () { return ({ name: 'Remove Data Streams', @@ -29,6 +30,7 @@ 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); + (0, flowUtils_1.checkFfmpegCommandInit)(args); args.variables.ffmpegCommand.streams.forEach(function (stream) { if (stream.codec_type === 'data') { stream.removed = true; diff --git a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRemoveStreamByProperty/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRemoveStreamByProperty/1.0.0/index.js index 67b26a235..a4bfac061 100644 --- a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRemoveStreamByProperty/1.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRemoveStreamByProperty/1.0.0/index.js @@ -1,6 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.plugin = exports.details = void 0; +var flowUtils_1 = require("../../../../FlowHelpers/1.0.0/interfaces/flowUtils"); /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ var details = function () { return ({ name: 'Remove Stream By Property', @@ -63,6 +64,7 @@ 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); + (0, flowUtils_1.checkFfmpegCommandInit)(args); var propertyToCheck = String(args.inputs.propertyToCheck).trim(); var valuesToRemove = String(args.inputs.valuesToRemove).trim().split(',').map(function (item) { return item.trim(); }); var condition = String(args.inputs.condition); diff --git a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRemoveSubtitles/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRemoveSubtitles/1.0.0/index.js index 49b4a0b9f..ea722d3a8 100644 --- a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRemoveSubtitles/1.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRemoveSubtitles/1.0.0/index.js @@ -2,6 +2,7 @@ /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ Object.defineProperty(exports, "__esModule", { value: true }); exports.plugin = exports.details = void 0; +var flowUtils_1 = require("../../../../FlowHelpers/1.0.0/interfaces/flowUtils"); /* eslint-disable no-param-reassign */ var details = function () { return ({ name: 'Remove Subtitles', @@ -29,6 +30,7 @@ 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); + (0, flowUtils_1.checkFfmpegCommandInit)(args); args.variables.ffmpegCommand.streams.forEach(function (stream) { if (stream.codec_type === 'subtitle') { stream.removed = true; diff --git a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRorderStreams/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRorderStreams/1.0.0/index.js index 101d047e7..9c828a2f9 100644 --- a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRorderStreams/1.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandRorderStreams/1.0.0/index.js @@ -1,6 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.plugin = exports.details = void 0; +var flowUtils_1 = require("../../../../FlowHelpers/1.0.0/interfaces/flowUtils"); /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ var details = function () { return ({ name: 'Reorder Streams', @@ -79,6 +80,7 @@ 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); + (0, flowUtils_1.checkFfmpegCommandInit)(args); var streams = JSON.parse(JSON.stringify(args.variables.ffmpegCommand.streams)); streams.forEach(function (stream, index) { // eslint-disable-next-line no-param-reassign diff --git a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetContainer/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetContainer/1.0.0/index.js index e6b1c357f..af48a2d19 100644 --- a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetContainer/1.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetContainer/1.0.0/index.js @@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.plugin = exports.details = void 0; var fileUtils_1 = require("../../../../FlowHelpers/1.0.0/fileUtils"); +var flowUtils_1 = require("../../../../FlowHelpers/1.0.0/interfaces/flowUtils"); /* eslint-disable no-param-reassign */ var details = function () { return ({ name: 'Set Container', @@ -55,6 +56,7 @@ 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); + (0, flowUtils_1.checkFfmpegCommandInit)(args); var newContainer = String(args.inputs.container); var forceConform = args.inputs.forceConform; if ((0, fileUtils_1.getContainer)(args.inputFileObj._id) !== newContainer) { diff --git a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVdeoFramerate/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVdeoFramerate/1.0.0/index.js index e96f23dd3..fdb27ac62 100644 --- a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVdeoFramerate/1.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVdeoFramerate/1.0.0/index.js @@ -1,6 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.plugin = exports.details = void 0; +var flowUtils_1 = require("../../../../FlowHelpers/1.0.0/interfaces/flowUtils"); /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ var details = function () { return ({ name: 'Set Video Framerate', @@ -40,6 +41,7 @@ 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); + (0, flowUtils_1.checkFfmpegCommandInit)(args); var desiredFrameRate = Number(args.inputs.framerate); args.jobLog("Desired framerate: ".concat(desiredFrameRate)); args.variables.ffmpegCommand.streams.forEach(function (stream) { diff --git a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVdeoResolution/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVdeoResolution/1.0.0/index.js index 88e8ca6f5..5e63ad259 100644 --- a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVdeoResolution/1.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVdeoResolution/1.0.0/index.js @@ -1,6 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.plugin = exports.details = void 0; +var flowUtils_1 = require("../../../../FlowHelpers/1.0.0/interfaces/flowUtils"); /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ var details = function () { return ({ name: 'Set Video Resolution', @@ -65,6 +66,7 @@ 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); + (0, flowUtils_1.checkFfmpegCommandInit)(args); for (var i = 0; i < args.variables.ffmpegCommand.streams.length; i += 1) { var stream = args.variables.ffmpegCommand.streams[i]; if (stream.codec_type === 'video') { diff --git a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVideoBitrate/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVideoBitrate/1.0.0/index.js index 4ba49f96b..7ccb3530b 100644 --- a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVideoBitrate/1.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVideoBitrate/1.0.0/index.js @@ -2,6 +2,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.plugin = exports.details = void 0; var fileUtils_1 = require("../../../../FlowHelpers/1.0.0/fileUtils"); +var flowUtils_1 = require("../../../../FlowHelpers/1.0.0/interfaces/flowUtils"); /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ var details = function () { return ({ name: 'Set Video Bitrate', @@ -115,6 +116,7 @@ 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); + (0, flowUtils_1.checkFfmpegCommandInit)(args); var useInputBitrate = args.inputs.useInputBitrate; var targetBitratePercent = String(args.inputs.targetBitratePercent); var fallbackBitrate = String(args.inputs.fallbackBitrate); diff --git a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVideoEncoder/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVideoEncoder/1.0.0/index.js index a7e09b0b8..34f90f3e1 100644 --- a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVideoEncoder/1.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetVideoEncoder/1.0.0/index.js @@ -39,6 +39,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) { Object.defineProperty(exports, "__esModule", { value: true }); exports.plugin = exports.details = void 0; var hardwareUtils_1 = require("../../../../FlowHelpers/1.0.0/hardwareUtils"); +var flowUtils_1 = require("../../../../FlowHelpers/1.0.0/interfaces/flowUtils"); /* eslint-disable no-param-reassign */ var details = function () { return ({ name: 'Set Video Encoder', @@ -217,6 +218,7 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function lib = require('../../../../../methods/lib')(); // eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign args.inputs = lib.loadDefaultValues(args.inputs, details); + (0, flowUtils_1.checkFfmpegCommandInit)(args); hardwareDecoding = args.inputs.hardwareDecoding === true; hardwareType = String(args.inputs.hardwareType); args.variables.ffmpegCommand.hardwareDecoding = hardwareDecoding; diff --git a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandStart/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandStart/1.0.0/index.js index d00a4acd8..e9f79cf31 100644 --- a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandStart/1.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandStart/1.0.0/index.js @@ -44,6 +44,7 @@ var plugin = function (args) { args.inputs = lib.loadDefaultValues(args.inputs, details); var container = (0, fileUtils_1.getContainer)(args.inputFileObj._id); var ffmpegCommand = { + init: true, inputFiles: [], streams: JSON.parse(JSON.stringify(args.inputFileObj.ffProbeData.streams)).map(function (stream) { return (__assign(__assign({}, stream), { removed: false, mapArgs: [ '-map', diff --git a/FlowPlugins/FlowHelpers/1.0.0/interfaces/flowUtils.js b/FlowPlugins/FlowHelpers/1.0.0/interfaces/flowUtils.js new file mode 100644 index 000000000..1b137a8a7 --- /dev/null +++ b/FlowPlugins/FlowHelpers/1.0.0/interfaces/flowUtils.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.checkFfmpegCommandInit = void 0; +// eslint-disable-next-line import/prefer-default-export +var checkFfmpegCommandInit = function (args) { + var _a, _b; + if (!((_b = (_a = args === null || args === void 0 ? void 0 : args.variables) === null || _a === void 0 ? void 0 : _a.ffmpegCommand) === null || _b === void 0 ? void 0 : _b.init)) { + throw new Error('FFmpeg command plugins not used correctly.' + + ' Please use the "Begin Command" plugin before using this plugin.' + + ' Afterwards, use the "Execute" plugin to execute the built FFmpeg command.' + + ' Once the "Execute" plugin has been used, you need to use a new "Begin Command"' + + ' plugin to start a new FFmpeg command.'); + } +}; +exports.checkFfmpegCommandInit = checkFfmpegCommandInit; From b15ef9fb5fe4ab351b80d72b5067734be51164f8 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Tue, 25 Jun 2024 07:03:51 +0300 Subject: [PATCH 4/5] Use checkFfmpegCommandInit() in Execute plugin --- .../ffmpegCommand/ffmpegCommandExecute/1.0.0/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandExecute/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandExecute/1.0.0/index.ts index 29435685f..7c1838519 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandExecute/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandExecute/1.0.0/index.ts @@ -6,6 +6,7 @@ import { } from '../../../../FlowHelpers/1.0.0/interfaces/interfaces'; import { CLI } from '../../../../FlowHelpers/1.0.0/cliUtils'; import { getFileName, getPluginWorkDir } from '../../../../FlowHelpers/1.0.0/fileUtils'; +import { checkFfmpegCommandInit } from '../../../../FlowHelpers/1.0.0/interfaces/flowUtils'; /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ const details = (): IpluginDetails => ({ @@ -68,6 +69,8 @@ const plugin = async (args: IpluginInputArgs): Promise => { // eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign args.inputs = lib.loadDefaultValues(args.inputs, details); + checkFfmpegCommandInit(args); + const cliArgs: string[] = []; cliArgs.push('-y'); From de4bf6b49502cd18373d90dcbe52f3231eb05832 Mon Sep 17 00:00:00 2001 From: HaveAGitGat Date: Tue, 25 Jun 2024 04:06:11 +0000 Subject: [PATCH 5/5] Apply auto-build changes --- .../ffmpegCommand/ffmpegCommandExecute/1.0.0/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandExecute/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandExecute/1.0.0/index.js index 8139245f2..f48dee6f9 100644 --- a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandExecute/1.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandExecute/1.0.0/index.js @@ -48,6 +48,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.plugin = exports.details = void 0; var cliUtils_1 = require("../../../../FlowHelpers/1.0.0/cliUtils"); var fileUtils_1 = require("../../../../FlowHelpers/1.0.0/fileUtils"); +var flowUtils_1 = require("../../../../FlowHelpers/1.0.0/interfaces/flowUtils"); /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ var details = function () { return ({ name: 'Execute', @@ -103,6 +104,7 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function lib = require('../../../../../methods/lib')(); // eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign args.inputs = lib.loadDefaultValues(args.inputs, details); + (0, flowUtils_1.checkFfmpegCommandInit)(args); cliArgs = []; cliArgs.push('-y'); cliArgs.push('-i');