From 87360a19c7b0764411e99293069d8b0495063e8f Mon Sep 17 00:00:00 2001 From: Quentin Roussel Date: Sun, 18 Aug 2024 20:49:51 +0800 Subject: [PATCH] changed format to gif --- .gitignore | 2 +- video.mjs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 7fb7145..196cd25 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ images/**/*.png -**/*.webm \ No newline at end of file +**/*.gif \ No newline at end of file diff --git a/video.mjs b/video.mjs index d9e8373..4278f5c 100644 --- a/video.mjs +++ b/video.mjs @@ -39,13 +39,13 @@ export async function createVideo() { await generateFinalImages(); //remove video try { - fs.unlinkSync('out/output.webm'); + fs.unlinkSync('out/output.gif'); } catch (error) { console.log('No video to delete'); } //run the command ffmpeg -framerate 5 -i %d.png -c:v libx264 -r 30 output.mp4 return new Promise((resolve, reject) => { - exec('ffmpeg -framerate 5 -i images/final/%d.png -c:v libvpx-vp9 -b:v 1M -r 30 out/output.webm', (err, stdout, stderr) => { + exec('ffmpeg -framerate 5 -i images/final/%d.png -vf "fps=5,scale=853:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 out/output.gif', (err, stdout, stderr) => { if (err) { reject(err); return;