mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-23 20:48:38 +00:00
feat(transcode): optimize video chunks for embedding by forcing 1 FPS and dropping audio
This commit is contained in:
@@ -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,
|
||||
])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user