mirror of
https://github.com/imputnet/cobalt.git
synced 2025-06-28 01:18:27 +00:00
api/ffmpeg: move stream type + url count check to remux()
& fix it cuz i broke it in last commit
This commit is contained in:
parent
52695cbd0f
commit
3dae5b2eb0
@ -64,12 +64,6 @@ const render = async (res, streamInfo, ffargs, estimateMultiplier) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
try {
|
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 = [
|
const args = [
|
||||||
'-loglevel', '-8',
|
'-loglevel', '-8',
|
||||||
...ffargs,
|
...ffargs,
|
||||||
@ -107,6 +101,11 @@ const remux = async (streamInfo, res) => {
|
|||||||
const urls = Array.isArray(streamInfo.urls) ? streamInfo.urls : [streamInfo.urls];
|
const urls = Array.isArray(streamInfo.urls) ? streamInfo.urls : [streamInfo.urls];
|
||||||
const args = urls.flatMap(url => ['-i', url]);
|
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) {
|
if (streamInfo.subtitles) {
|
||||||
args.push(
|
args.push(
|
||||||
'-i', streamInfo.subtitles,
|
'-i', streamInfo.subtitles,
|
||||||
|
Loading…
Reference in New Issue
Block a user