mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
13 lines
420 B
TypeScript
13 lines
420 B
TypeScript
import { ffmpeg } from './ffmpeg.ts';
|
|
|
|
export function extractVideoFrame(file: URL, ss: string = '00:00:01'): Promise<Uint8Array> {
|
|
const output = ffmpeg(file, {
|
|
'ss': ss, // Seek to timestamp
|
|
'frames:v': '1', // Extract only 1 frame
|
|
'q:v': '2', // High-quality JPEG (lower = better quality)
|
|
'f': 'image2', // Force image format
|
|
'loglevel': 'fatal',
|
|
});
|
|
|
|
return new Response(output).bytes();
|
|
}
|