log more ffmpeg commands to cli

pull/2263/head
Mikael Finstad 2 years ago
parent 19a39fd1be
commit 1ea7adc3ca
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26

@ -138,6 +138,7 @@ export async function runFfmpegWithProgress({ ffmpegArgs, duration, onProgress }
duration?: number | undefined, duration?: number | undefined,
onProgress: (a: number) => void, onProgress: (a: number) => void,
}) { }) {
logger.info(getFfCommandLine('ffmpeg', ffmpegArgs));
const process = runFfmpegProcess(ffmpegArgs); const process = runFfmpegProcess(ffmpegArgs);
assert(process.stderr != null); assert(process.stderr != null);
handleProgress(process, duration, onProgress); handleProgress(process, duration, onProgress);
@ -258,6 +259,7 @@ export async function detectSceneChanges({ filePath, minChange, onProgress, from
'-filter_complex', `select='gt(scene,${minChange})',metadata=print:file=-`, '-filter_complex', `select='gt(scene,${minChange})',metadata=print:file=-`,
'-f', 'null', '-', '-f', 'null', '-',
]; ];
logger.info(getFfCommandLine('ffmpeg', args));
const process = runFfmpegProcess(args, { buffer: false }); const process = runFfmpegProcess(args, { buffer: false });
const times = [0]; const times = [0];
@ -291,6 +293,7 @@ async function detectIntervals({ filePath, customArgs, onProgress, from, to, mat
...customArgs, ...customArgs,
'-f', 'null', '-', '-f', 'null', '-',
]; ];
logger.info(getFfCommandLine('ffmpeg', args));
const process = runFfmpegProcess(args, { buffer: false }); const process = runFfmpegProcess(args, { buffer: false });
let segments: { start: number, end: number }[] = []; let segments: { start: number, end: number }[] = [];
@ -435,6 +438,7 @@ export async function captureFrames({ from, to, videoPath, outPathTemplate, qual
'-y', outPathTemplate, '-y', outPathTemplate,
]; ];
logger.info(getFfCommandLine('ffmpeg', args));
const process = runFfmpegProcess(args, { buffer: false }); const process = runFfmpegProcess(args, { buffer: false });
handleProgress(process, to - from, onProgress); handleProgress(process, to - from, onProgress);
@ -446,13 +450,15 @@ export async function captureFrame({ timestamp, videoPath, outPath, quality }: {
timestamp: number, videoPath: string, outPath: string, quality: number, timestamp: number, videoPath: string, outPath: string, quality: number,
}) { }) {
const ffmpegQuality = getFffmpegJpegQuality(quality); const ffmpegQuality = getFffmpegJpegQuality(quality);
await runFfmpegProcess([ const args = [
'-ss', String(timestamp), '-ss', String(timestamp),
'-i', videoPath, '-i', videoPath,
'-vframes', '1', '-vframes', '1',
'-q:v', String(ffmpegQuality), '-q:v', String(ffmpegQuality),
'-y', outPath, '-y', outPath,
]); ];
logger.info(getFfCommandLine('ffmpeg', args));
await runFfmpegProcess(args);
} }
@ -571,6 +577,7 @@ export async function html5ify({ outPath, filePath: filePathArg, speed, hasAudio
]; ];
const duration = await getDuration(filePathArg); const duration = await getDuration(filePathArg);
logger.info(getFfCommandLine('ffmpeg', ffmpegArgs));
const process = runFfmpegProcess(ffmpegArgs); const process = runFfmpegProcess(ffmpegArgs);
if (duration) handleProgress(process, duration, onProgress); if (duration) handleProgress(process, duration, onProgress);
@ -597,8 +604,7 @@ export function readOneJpegFrame({ path, seekTo, videoStreamIndex }: { path: str
'-', '-',
]; ];
// console.log(args); // logger.info(getFfCommandLine('ffmpeg', args));
return runFfmpegProcess(args, undefined, { logCli: true }); return runFfmpegProcess(args, undefined, { logCli: true });
} }
@ -678,6 +684,7 @@ export async function downloadMediaUrl(url: string, outPath: string) {
outPath, outPath,
]; ];
logger.info(getFfCommandLine('ffmpeg', args));
await runFfmpegProcess(args); await runFfmpegProcess(args);
} }

Loading…
Cancel
Save