diff --git a/packages/backend/src/services/drive/generate-video-thumbnail.ts b/packages/backend/src/services/drive/generate-video-thumbnail.ts index 6e6666481d..b6ca4e152e 100644 --- a/packages/backend/src/services/drive/generate-video-thumbnail.ts +++ b/packages/backend/src/services/drive/generate-video-thumbnail.ts @@ -6,6 +6,8 @@ import FFmpeg from 'fluent-ffmpeg'; export async function GenerateVideoThumbnail(source: string): Promise { const [dir, cleanup] = await createTempDir(); + const outFile = `${dir}/out.png`; + try { await new Promise((res, rej) => { FFmpeg({ @@ -22,8 +24,9 @@ export async function GenerateVideoThumbnail(source: string): Promise { }); // JPEGに変換 (Webpでもいいが、MastodonはWebpをサポートせず表示できなくなる) - return await convertToJpeg(`${dir}/out.png`, 498, 280); + return await convertToJpeg(outFile, 498, 280); } finally { + await fs.promises.unlink(outFile); cleanup(); } }