mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
13 lines
391 B
TypeScript
13 lines
391 B
TypeScript
import { ffprobe } from './ffprobe.ts';
|
|
|
|
export async function getVideoDimensions(path: string): Promise<{ width: number; height: number } | null> {
|
|
const stream = ffprobe(path, {
|
|
'v': 'error',
|
|
'select_streams': 'v:0',
|
|
'show_entries': 'stream=width,height',
|
|
'of': 'json',
|
|
});
|
|
|
|
const { streams: [result] } = await new Response(stream).json();
|
|
return result ?? null;
|
|
}
|