Kagami / ffmpeg.js

Port of FFmpeg with Emscripten
Other
3.24k stars 329 forks source link

Not able to generate video longer than 33 second #163

Closed suvirbhargav closed 2 years ago

suvirbhargav commented 2 years ago

ffmpegArguments.push("-framerate", (1.0/frameTime).toFixed(0), "-i", "f%03d.jpg", "-c:v"); ffmpegArguments.push("libx264", "-preset", "ultrafast", "-tune", "zerolatency", "-crf", "22", "out.mp4");

On chrome.

If i use below pattern glob, i can make video of any length but then order is wrong.

ffmpegArguments.push("-framerate", (1.0/frameTime).toFixed(0), "-pattern_type", "glob", "-i", "*.jpg", "-c:v");

My frame file names are created using let fileName = "f" + i.toLocaleString([], { maximumFractionDigits:0, minimumIntegerDigits: 3, }) + ".jpg";

The last file generated always stops at 2,983.jpg, even though the encoding finished is only 20 % FFMPEGVideoExport.ts?a302:214 fileName f0002,980.jpg FFMPEGVideoExport.ts?a302:214 fileName f0002,981.jpg FFMPEGVideoExport.ts?a302:214 fileName f0002,982.jpg FFMPEGVideoExport.ts?a302:214 fileName f0002,983.jpg

suvirbhargav commented 2 years ago

I was able to solve this using 8 digits instead of 3. And padding the digits. ffmpegArguments.push("-framerate", (1.0/frameTime).toFixed(0), "-i", "f%08d.jpg", "-c:v"); let fileName = "f" + i.toString().padStart(8, '0') + ".jpg";