changed codec to VP9 and fixed ffmpeg cmd

This commit is contained in:
Quentin Roussel
2024-08-18 20:26:45 +08:00
parent b9a6b4e3f0
commit 4f81509799
4 changed files with 12 additions and 9 deletions

View File

@@ -39,13 +39,13 @@ export async function createVideo() {
await generateFinalImages();
//remove video
try {
fs.unlinkSync('out/output.mp4');
fs.unlinkSync('out/output.webm');
} 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 -r 30 out/output.webm', (err, stdout, stderr) => {
exec('ffmpeg -framerate 5 -i images/final/%d.png -c:v libvpx-vp9 -b:v 1M -r 30 out/output.webm', (err, stdout, stderr) => {
if (err) {
reject(err);
return;