types: make streamVideoOnly more readable
This commit is contained in:
parent
b662f472dd
commit
4a9e4cd915
1 changed files with 9 additions and 1 deletions
|
@ -90,6 +90,7 @@ export async function streamLiveRender(streamInfo, res) {
|
||||||
'pipe', 'pipe'
|
'pipe', 'pipe'
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
const [,,, audioInput, muxOutput] = process.stdio;
|
const [,,, audioInput, muxOutput] = process.stdio;
|
||||||
|
|
||||||
res.setHeader('Connection', 'keep-alive');
|
res.setHeader('Connection', 'keep-alive');
|
||||||
|
@ -140,7 +141,9 @@ export function streamAudioOnly(streamInfo, res) {
|
||||||
'pipe'
|
'pipe'
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
const [,,, muxOutput] = process.stdio;
|
const [,,, muxOutput] = process.stdio;
|
||||||
|
|
||||||
res.setHeader('Connection', 'keep-alive');
|
res.setHeader('Connection', 'keep-alive');
|
||||||
res.setHeader('Content-Disposition', contentDisposition(`${streamInfo.filename}.${streamInfo.audioFormat}`));
|
res.setHeader('Content-Disposition', contentDisposition(`${streamInfo.filename}.${streamInfo.audioFormat}`));
|
||||||
|
|
||||||
|
@ -156,7 +159,7 @@ export function streamVideoOnly(streamInfo, res) {
|
||||||
const shutdown = () => (killProcess(process), closeResponse(res));
|
const shutdown = () => (killProcess(process), closeResponse(res));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let format = streamInfo.filename.split('.')[streamInfo.filename.split('.').length - 1], args = [
|
let args = [
|
||||||
'-loglevel', '-8',
|
'-loglevel', '-8',
|
||||||
'-threads', `${getThreads()}`,
|
'-threads', `${getThreads()}`,
|
||||||
'-i', streamInfo.urls,
|
'-i', streamInfo.urls,
|
||||||
|
@ -164,8 +167,11 @@ export function streamVideoOnly(streamInfo, res) {
|
||||||
]
|
]
|
||||||
if (streamInfo.mute) args.push('-an');
|
if (streamInfo.mute) args.push('-an');
|
||||||
if (streamInfo.service === "vimeo" || streamInfo.service === "rutube") args.push('-bsf:a', 'aac_adtstoasc');
|
if (streamInfo.service === "vimeo" || streamInfo.service === "rutube") args.push('-bsf:a', 'aac_adtstoasc');
|
||||||
|
|
||||||
|
let format = streamInfo.filename.split('.')[streamInfo.filename.split('.').length - 1];
|
||||||
if (format === "mp4") args.push('-movflags', 'faststart+frag_keyframe+empty_moov');
|
if (format === "mp4") args.push('-movflags', 'faststart+frag_keyframe+empty_moov');
|
||||||
args.push('-f', format, 'pipe:3');
|
args.push('-f', format, 'pipe:3');
|
||||||
|
|
||||||
process = spawn(ffmpeg, args, {
|
process = spawn(ffmpeg, args, {
|
||||||
windowsHide: true,
|
windowsHide: true,
|
||||||
stdio: [
|
stdio: [
|
||||||
|
@ -173,7 +179,9 @@ export function streamVideoOnly(streamInfo, res) {
|
||||||
'pipe'
|
'pipe'
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
const [,,, muxOutput] = process.stdio;
|
const [,,, muxOutput] = process.stdio;
|
||||||
|
|
||||||
res.setHeader('Connection', 'keep-alive');
|
res.setHeader('Connection', 'keep-alive');
|
||||||
res.setHeader('Content-Disposition', contentDisposition(streamInfo.filename));
|
res.setHeader('Content-Disposition', contentDisposition(streamInfo.filename));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue