From a5e34645c5884da9a60f0423d9a77e28eee8fc81 Mon Sep 17 00:00:00 2001 From: linyuchen Date: Sat, 20 Apr 2024 08:21:48 +0800 Subject: [PATCH] fix: ffmpeg path for video.ts --- src/common/utils/video.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/common/utils/video.ts b/src/common/utils/video.ts index ae639388..c2192d54 100644 --- a/src/common/utils/video.ts +++ b/src/common/utils/video.ts @@ -16,8 +16,7 @@ export async function getVideoInfo(filePath: string) { size: number, filePath: string }>((resolve, reject) => { - // todo: 从配置文件中读取ffmpeg路径 - const ffmpegPath = './ffmpeg'; + const ffmpegPath = process.env.FFMPEG_PATH; ffmpegPath && ffmpeg.setFfmpegPath(ffmpegPath); ffmpeg(filePath).ffprobe((err: any, metadata: any) => { if (err) { @@ -27,7 +26,7 @@ export async function getVideoInfo(filePath: string) { if (videoStream) { console.log(`视频尺寸: ${videoStream.width}x${videoStream.height}`); } else { - console.log('未找到视频流信息。'); + return reject('未找到视频流信息。'); } resolve({ width: videoStream.width, height: videoStream.height, @@ -85,4 +84,4 @@ export function checkFfmpeg(newPath: string | null = null): Promise { resolve(false); } }); -} \ No newline at end of file +}