mirror of
https://github.com/imputnet/cobalt.git
synced 2025-06-28 09:28:29 +00:00
api/stream/types: add subtitles & metadata to remux
This commit is contained in:
parent
254ad961d3
commit
a5838f3c05
@ -189,6 +189,8 @@ const remux = async (streamInfo, res) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const format = streamInfo.filename.split('.').pop();
|
||||||
|
|
||||||
let args = [
|
let args = [
|
||||||
'-loglevel', '-8',
|
'-loglevel', '-8',
|
||||||
'-headers', toRawHeaders(getHeaders(streamInfo.service)),
|
'-headers', toRawHeaders(getHeaders(streamInfo.service)),
|
||||||
@ -198,10 +200,16 @@ const remux = async (streamInfo, res) => {
|
|||||||
args.push('-seekable', '0')
|
args.push('-seekable', '0')
|
||||||
}
|
}
|
||||||
|
|
||||||
args.push(
|
args.push('-i', streamInfo.urls);
|
||||||
'-i', streamInfo.urls,
|
|
||||||
'-c:v', 'copy',
|
if (streamInfo.subtitles) {
|
||||||
)
|
args.push(
|
||||||
|
'-i', streamInfo.subtitles,
|
||||||
|
'-c:s', format === 'mp4' ? 'mov_text' : 'webvtt',
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
args.push('-c:v', 'copy');
|
||||||
|
|
||||||
if (streamInfo.type === "mute") {
|
if (streamInfo.type === "mute") {
|
||||||
args.push('-an');
|
args.push('-an');
|
||||||
@ -214,11 +222,14 @@ const remux = async (streamInfo, res) => {
|
|||||||
args.push('-bsf:a', 'aac_adtstoasc');
|
args.push('-bsf:a', 'aac_adtstoasc');
|
||||||
}
|
}
|
||||||
|
|
||||||
let format = streamInfo.filename.split('.').pop();
|
|
||||||
if (format === "mp4") {
|
if (format === "mp4") {
|
||||||
args.push('-movflags', 'faststart+frag_keyframe+empty_moov')
|
args.push('-movflags', 'faststart+frag_keyframe+empty_moov')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (streamInfo.metadata) {
|
||||||
|
args = args.concat(convertMetadataToFFmpeg(streamInfo.metadata));
|
||||||
|
}
|
||||||
|
|
||||||
args.push('-f', format, 'pipe:3');
|
args.push('-f', format, 'pipe:3');
|
||||||
|
|
||||||
process = spawn(...getCommand(args), {
|
process = spawn(...getCommand(args), {
|
||||||
|
Loading…
Reference in New Issue
Block a user