changed format to gif

This commit is contained in:
Quentin Roussel
2024-08-18 20:49:51 +08:00
parent 1bcb174c71
commit 87360a19c7
2 changed files with 3 additions and 3 deletions

2
.gitignore vendored
View File

@@ -1,2 +1,2 @@
images/**/*.png images/**/*.png
**/*.webm **/*.gif

View File

@@ -39,13 +39,13 @@ export async function createVideo() {
await generateFinalImages(); await generateFinalImages();
//remove video //remove video
try { try {
fs.unlinkSync('out/output.webm'); fs.unlinkSync('out/output.gif');
} catch (error) { } catch (error) {
console.log('No video to delete'); console.log('No video to delete');
} }
//run the command ffmpeg -framerate 5 -i %d.png -c:v libx264 -r 30 output.mp4 //run the command ffmpeg -framerate 5 -i %d.png -c:v libx264 -r 30 output.mp4
return new Promise((resolve, reject) => { 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) { if (err) {
reject(err); reject(err);
return; return;