Skip to content

best way to save what you love

api/ffmpeg: move stream type + url count check to remux()

wukko3dae5b2eb017
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,