From 1ea7adc3cab1dc4d172567a5c2f09c1e6efdb49e Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Fri, 29 Nov 2024 16:02:37 +0800 Subject: [PATCH] log more ffmpeg commands to cli --- src/main/ffmpeg.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/ffmpeg.ts b/src/main/ffmpeg.ts index be2b5e6f..59e80b95 100644 --- a/src/main/ffmpeg.ts +++ b/src/main/ffmpeg.ts @@ -138,6 +138,7 @@ export async function runFfmpegWithProgress({ ffmpegArgs, duration, onProgress } duration?: number | undefined, onProgress: (a: number) => void, }) { + logger.info(getFfCommandLine('ffmpeg', ffmpegArgs)); const process = runFfmpegProcess(ffmpegArgs); assert(process.stderr != null); 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=-`, '-f', 'null', '-', ]; + logger.info(getFfCommandLine('ffmpeg', args)); const process = runFfmpegProcess(args, { buffer: false }); const times = [0]; @@ -291,6 +293,7 @@ async function detectIntervals({ filePath, customArgs, onProgress, from, to, mat ...customArgs, '-f', 'null', '-', ]; + logger.info(getFfCommandLine('ffmpeg', args)); const process = runFfmpegProcess(args, { buffer: false }); let segments: { start: number, end: number }[] = []; @@ -435,6 +438,7 @@ export async function captureFrames({ from, to, videoPath, outPathTemplate, qual '-y', outPathTemplate, ]; + logger.info(getFfCommandLine('ffmpeg', args)); const process = runFfmpegProcess(args, { buffer: false }); 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, }) { const ffmpegQuality = getFffmpegJpegQuality(quality); - await runFfmpegProcess([ + const args = [ '-ss', String(timestamp), '-i', videoPath, '-vframes', '1', '-q:v', String(ffmpegQuality), '-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); + logger.info(getFfCommandLine('ffmpeg', ffmpegArgs)); const process = runFfmpegProcess(ffmpegArgs); 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 }); } @@ -678,6 +684,7 @@ export async function downloadMediaUrl(url: string, outPath: string) { outPath, ]; + logger.info(getFfCommandLine('ffmpeg', args)); await runFfmpegProcess(args); }