feat(transcode): set loglevel to warning for all ffmpeg commands

This commit is contained in:
yiling
2026-06-18 11:57:38 +08:00
parent 46815736e2
commit d84950d372
4 changed files with 14 additions and 6 deletions
+2
View File
@@ -140,6 +140,8 @@ export async function generateEmbeddingActivity(params: GenerateEmbeddingParams)
const chunkTmp = path.join(os.tmpdir(), `video-chunk-${Date.now()}.mp4`)
await execFileAsync('ffmpeg', [
'-y',
'-loglevel',
'warning',
'-i',
tmpFile,
'-ss',
+5 -5
View File
@@ -154,7 +154,7 @@ export class TranscodeService {
args.push('-movflags', '+faststart', '-max_muxing_queue_size', '1024', params.outputFile)
await execFileAsync('ffmpeg', ['-y', ...args])
await execFileAsync('ffmpeg', ['-y', '-loglevel', 'warning', ...args])
}
async transcodeImage(
@@ -222,12 +222,12 @@ export class TranscodeService {
'1024',
outputPoster,
]
await execFileAsync('ffmpeg', ['-y', ...args])
await execFileAsync('ffmpeg', ['-y', '-loglevel', 'warning', ...args])
}
async extractAudio(inputFile: string, outputFile: string, bitrate: string): Promise<void> {
const args = ['-i', inputFile, '-vn', '-acodec', 'libmp3lame', '-b:a', bitrate, outputFile]
await execFileAsync('ffmpeg', ['-y', ...args])
await execFileAsync('ffmpeg', ['-y', '-loglevel', 'warning', ...args])
}
async extractVideoFrames(params: ExtractVideoFramesParams): Promise<string[]> {
@@ -252,7 +252,7 @@ export class TranscodeService {
'80',
outputPattern,
]
await execFileAsync('ffmpeg', ['-y', ...args])
await execFileAsync('ffmpeg', ['-y', '-loglevel', 'warning', ...args])
const files = fs.readdirSync(params.outputDir)
return files
@@ -370,7 +370,7 @@ export class TranscodeService {
'80',
localShotPath,
]
await execFileAsync('ffmpeg', ['-y', ...args])
await execFileAsync('ffmpeg', ['-y', '-loglevel', 'warning', ...args])
// 5. Overlay annotations if timestamp matches commentTimestamp exactly
if (
@@ -379,7 +379,11 @@ describe('Transcode Activities', () => {
// Mock child_process.execFile to simulate ffmpeg succeeding
// eslint-disable-next-line @typescript-eslint/no-explicit-any
;(child_process.execFile as any).mockImplementation(
(file: string, args: string[], cb: any) => {
(
file: string,
args: string[],
cb: (err: Error | null, result: { stdout: string; stderr: string }) => void,
) => {
cb(null, { stdout: '', stderr: '' })
},
)
@@ -561,6 +561,8 @@ export async function transcodeVideoChunkActivity(
// Slice video segment using ffmpeg
await execFileAsync('ffmpeg', [
'-y',
'-loglevel',
'warning',
'-i',
params.filePath,
'-ss',