From 0f82b5826fc14535974538239c2ad2e6892a1f26 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Tue, 25 Feb 2025 23:02:51 +0000 Subject: [PATCH] feat: update error message when no stream data --- .../ffmpegCommand/ffmpegCommandStart/1.0.0/index.js | 11 ++++++++++- .../ffmpegCommand/ffmpegCommandStart/1.0.0/index.ts | 12 +++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandStart/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandStart/1.0.0/index.js index e9f79cf31..6bb86446f 100644 --- a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandStart/1.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandStart/1.0.0/index.js @@ -43,10 +43,19 @@ var plugin = function (args) { // eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign args.inputs = lib.loadDefaultValues(args.inputs, details); var container = (0, fileUtils_1.getContainer)(args.inputFileObj._id); + var streams = []; + try { + streams = JSON.parse(JSON.stringify(args.inputFileObj.ffProbeData.streams)); + } + catch (err) { + var message = "Error parsing FFprobe streams, it seems FFprobe could not scan the file: ".concat(JSON.stringify(err)); + args.jobLog(message); + throw new Error(message); + } var ffmpegCommand = { init: true, inputFiles: [], - streams: JSON.parse(JSON.stringify(args.inputFileObj.ffProbeData.streams)).map(function (stream) { return (__assign(__assign({}, stream), { removed: false, mapArgs: [ + streams: streams.map(function (stream) { return (__assign(__assign({}, stream), { removed: false, mapArgs: [ '-map', "0:".concat(stream.index), ], inputArgs: [], outputArgs: [] })); }), diff --git a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandStart/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandStart/1.0.0/index.ts index 1cb6c2f1d..75f6ca745 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandStart/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandStart/1.0.0/index.ts @@ -39,10 +39,20 @@ const plugin = (args:IpluginInputArgs):IpluginOutputArgs => { const container = getContainer(args.inputFileObj._id); + let streams = []; + + try { + streams = JSON.parse(JSON.stringify(args.inputFileObj.ffProbeData.streams)); + } catch (err) { + const message = `Error parsing FFprobe streams, it seems FFprobe could not scan the file: ${JSON.stringify(err)}`; + args.jobLog(message); + throw new Error(message); + } + const ffmpegCommand = { init: true, inputFiles: [], - streams: JSON.parse(JSON.stringify(args.inputFileObj.ffProbeData.streams)).map((stream:Istreams) => ({ + streams: streams.map((stream:Istreams) => ({ ...stream, removed: false, mapArgs: [