mattdesl / canvas-sketch

[beta] A framework for making generative artwork in JavaScript and the browser.
MIT License
5.01k stars 393 forks source link

Increase zero padding on frame sequence filenames #107

Closed jzting closed 4 years ago

jzting commented 4 years ago

When exporting a long frame sequence (e.g. 18k frames) without defining totalFrames, the filenames are only padded to four digits. I realized this was an issue after I ran ffmpeg and was noticed there were interleaved frames in the video output.

mattdesl commented 4 years ago

whistle 18K! That must take a while.

I’ve actually been pondering some ways of speeding up the export time as I’ve had a few scenarios where it gets tedious.

Some ideas to help this: remove the double rendering (right now each export is also visualized in the often lower res browser view), using timeout instead of rAF to render each frame, rendering multiple times in a single browser time step, using offscreen canvas, posting multiple frames at a time in parallel to the backend. Any other suggestions welcome.

jzting commented 4 years ago

Thanks for the quick review and merge! Yes, it took a while 😬

Those ideas all sound like good options. I've also used this library in the past–it might be worth checking to see what they are doing (but tbh I forget how fast it was).

While exporting, I noticed node used >100% CPU and the frames-written-per-second dropped over time.