mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
17 lines
478 B
TypeScript
17 lines
478 B
TypeScript
import { ffmpeg } from './ffmpeg.ts';
|
|
|
|
export async function ffmpegDim(
|
|
input: ReadableStream<Uint8Array>,
|
|
): Promise<{ width: number; height: number } | undefined> {
|
|
const result = ffmpeg(input, {
|
|
'vf': 'showinfo', // Output as JSON
|
|
'f': 'null', // Tell FFmpeg not to produce an output file
|
|
});
|
|
|
|
const text = await new Response(result).json();
|
|
console.log(text);
|
|
const output = JSON.parse(text);
|
|
|
|
const [stream] = output.streams ?? [];
|
|
return stream;
|
|
}
|