fixup ffmpeg commands with docker image
This commit is contained in:
@@ -359,6 +359,11 @@ function createPlayback(session) {
|
||||
let started = false;
|
||||
let closed = false;
|
||||
let readyTimer = null;
|
||||
const stderrTailLogger = createLineLogger((line) => {
|
||||
if (!shouldSuppressFfmpegLogLine(line)) {
|
||||
stderr = appendTail(stderr, `${line}\n`);
|
||||
}
|
||||
});
|
||||
|
||||
const playback = {
|
||||
get closed() {
|
||||
@@ -466,7 +471,7 @@ function createPlayback(session) {
|
||||
frameStream.on('data', handleFrameData);
|
||||
|
||||
ffmpeg.stderr.on('data', (chunk) => {
|
||||
stderr = appendTail(stderr, chunk);
|
||||
stderrTailLogger.write(chunk);
|
||||
logger.stderr(chunk);
|
||||
});
|
||||
|
||||
@@ -477,6 +482,7 @@ function createPlayback(session) {
|
||||
});
|
||||
|
||||
ffmpeg.on('close', (code, signal) => {
|
||||
stderrTailLogger.flush();
|
||||
logger.close(code, signal, stopReason, stderr);
|
||||
finishPlayback(1000, 'ffmpeg exited', code, signal);
|
||||
});
|
||||
@@ -658,7 +664,7 @@ function getListeningPort() {
|
||||
|
||||
function buildPlaybackArgs(session, inputUrl) {
|
||||
const { fps, quality, width } = session.options;
|
||||
const videoFilter = `fps=${fps},scale='min(${width},iw)':-2:flags=bicubic`;
|
||||
const videoFilter = `fps=${fps},scale=w='min(${width},iw)':h=-2:flags=bicubic:out_range=pc,format=yuvj420p`;
|
||||
|
||||
return [
|
||||
'-hide_banner',
|
||||
@@ -692,6 +698,10 @@ function buildPlaybackArgs(session, inputUrl) {
|
||||
videoFilter,
|
||||
'-codec:v',
|
||||
'mjpeg',
|
||||
'-pix_fmt',
|
||||
'yuvj420p',
|
||||
'-color_range',
|
||||
'pc',
|
||||
'-q:v',
|
||||
String(quality),
|
||||
'-f',
|
||||
@@ -710,6 +720,10 @@ function createFfmpegLogger(kind, sessionId, pid) {
|
||||
const startedAt = Date.now();
|
||||
const label = `${kind}:${shortId(sessionId)}`;
|
||||
const lineLogger = createLineLogger((line) => {
|
||||
if (shouldSuppressFfmpegLogLine(line)) {
|
||||
return;
|
||||
}
|
||||
|
||||
logWarn(`ffmpeg stderr kind=${label} pid=${pid ?? 'unknown'} line="${oneLine(redactSecrets(line))}"`);
|
||||
});
|
||||
|
||||
@@ -734,6 +748,10 @@ function createFfmpegLogger(kind, sessionId, pid) {
|
||||
};
|
||||
}
|
||||
|
||||
function shouldSuppressFfmpegLogLine(line) {
|
||||
return line.includes('deprecated pixel format used, make sure you did set range correctly');
|
||||
}
|
||||
|
||||
function createLineLogger(callback) {
|
||||
let buffer = '';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user