From 3dae5b2eb017b684e06c436cea1bac9048e8faea Mon Sep 17 00:00:00 2001 From: wukko Date: Wed, 25 Jun 2025 19:57:23 +0600 Subject: [PATCH] api/ffmpeg: move stream type + url count check to remux() & fix it cuz i broke it in last commit --- api/src/stream/ffmpeg.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/api/src/stream/ffmpeg.js b/api/src/stream/ffmpeg.js index dff4abab..4a72a309 100644 --- a/api/src/stream/ffmpeg.js +++ b/api/src/stream/ffmpeg.js @@ -64,12 +64,6 @@ const render = async (res, streamInfo, ffargs, estimateMultiplier) => { ); try { - // if the streamInfo.urls is an array but doesn't have 2 urls, - // then something went wrong - if (urls.length !== 2) { - return shutdown(); - } - const args = [ '-loglevel', '-8', ...ffargs, @@ -107,6 +101,11 @@ const remux = async (streamInfo, res) => { const urls = Array.isArray(streamInfo.urls) ? streamInfo.urls : [streamInfo.urls]; const args = urls.flatMap(url => ['-i', url]); + // if the stream type is merge, we expect two URLs + if (streamInfo.type === 'merge' && urls.length !== 2) { + return closeResponse(res); + } + if (streamInfo.subtitles) { args.push( '-i', streamInfo.subtitles,