feat(transcode): optimize video chunks for embedding by forcing 1 FPS and dropping audio

This commit is contained in:
yiling
2026-06-18 19:53:19 +08:00
parent 212ac3bc0e
commit 718d9d5b51
3 changed files with 21 additions and 6 deletions
+10 -3
View File
@@ -558,7 +558,7 @@ export async function transcodeVideoChunkActivity(
): Promise<{ chunkKey: string }> {
const chunkTmp = path.join(os.tmpdir(), `video-chunk-${Date.now()}.mp4`)
try {
// Slice video segment using ffmpeg
// Slice video segment using ffmpeg, force 1fps and remove audio for gemini-embedding-2 optimization
await execFileAsync('ffmpeg', [
'-y',
'-loglevel',
@@ -569,8 +569,15 @@ export async function transcodeVideoChunkActivity(
params.startTime.toString(),
'-t',
(params.endTime - params.startTime).toString(),
'-c',
'copy',
'-vf',
'fps=1',
'-c:v',
'libx264',
'-preset',
'ultrafast',
'-crf',
'28',
'-an',
chunkTmp,
])