Add support to upload custom file

This commit is contained in:
2023-12-15 19:53:36 +08:00
parent efcb276c45
commit cf38e9e981
12 changed files with 252 additions and 43 deletions

View File

@@ -11,6 +11,34 @@ export async function check_ffmpeg_binary(p: string) {
return o.code === 0;
}
export async function fb_get_size(i: string) {
const cmd = new Deno.Command("ffprobe", {
stdout: "piped",
stderr: "piped",
args: [
"-v",
"error",
"-select_streams",
"v:0",
"-show_entries",
"stream=width,height",
"-of",
"csv=s=x:p=0",
i,
],
});
const c = cmd.spawn();
const o = await c.output();
if (o.code !== 0) {
return null;
}
const s = (new TextDecoder()).decode(o.stdout).trim().split("x");
return {
width: parseInt(s[0]),
height: parseInt(s[1]),
};
}
export async function fb_generate_thumbnail(
p: string,
i: string,