Fixed 267U.pre2
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { createTempDir } from "../../misc/create-temp.js";
|
||||
import { convertToWebp } from "./image-processor.js";
|
||||
import FFmpeg from "fluent-ffmpeg";
|
||||
export async function GenerateVideoThumbnail(source) {
|
||||
const [dir, cleanup] = await createTempDir();
|
||||
try {
|
||||
await new Promise((res, rej)=>{
|
||||
FFmpeg({
|
||||
source
|
||||
}).on("end", res).on("error", rej).screenshot({
|
||||
folder: dir,
|
||||
filename: "out.png",
|
||||
count: 1,
|
||||
timestamps: [
|
||||
"5%"
|
||||
]
|
||||
});
|
||||
});
|
||||
return await convertToWebp(`${dir}/out.png`, 996, 560);
|
||||
} finally{
|
||||
cleanup();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user