Built-in sketch export as video or animated GIF
Increasing access
Making it easy to export a sketch as video or GIF lowers the barrier to sharing and showcasing work. Right now this requires external libraries or manual frame export, which is harder for beginners and educators. A simple, official API would help everyone—including students and people with less technical setup—share their p5.js work on social media, portfolios, and assignments without extra tools or steps
Most appropriate sub-area of p5.js?
- [x] Accessibility
- [x] Color
- [x] Core/Environment/Rendering
- [x] Data
- [x] DOM
- [x] Events
- [x] Image
- [x] IO
- [ ] Math
- [ ] Typography
- [ ] Utilities
- [ ] WebGL
- [ ] Build process
- [ ] Unit testing
- [ ] Internationalization
- [ ] Friendly errors
- [x] Other (specify if possible)
Feature request details
What: A built-in, official way to record the canvas and export it as video (e.g. WebM) and/or animated GIF, without requiring a separate library (e.g. ccapture.js) or manual saveFrame() + external tools. Why: Many users want to share animations on social media, portfolios, or assignments. Current options are either external libs or manual frame capture + conversion. A simple API in core would match p5.js’s goal of making creative coding and sharing accessible. Possible API (for discussion): Something like recordSketch({ format: 'gif' | 'video', duration: seconds }) and stopRecording() / exportRecording(), or A Capture helper that wraps the MediaRecorder / canvas capture flow and optionally GIF encoding. Exact design can be decided with maintainers (e.g. sync vs async, options for resolution, frame rate, quality). Scope: Start with one format (e.g. video via MediaRecorder) and add GIF or a second format later if maintainers agree. Rely on browser APIs (e.g. MediaRecorder, canvas capture) where possible to keep the implementation maintainable. References: Common user need in forums and tutorials. Similar functionality exists in add-ons (e.g. ccapture.js) but not as an official, documented core API.
I can work on this feature. @alihamza143143
@darthvader58 actually this is a new feature reqeust so i am waiting for approval , then we can work on it and exchange thoughts thank you
#ProcessingFoundation I’m willing to implement this once the proposal gets the required approvals. Happy to start with video export via MediaRecorder and follow maintainer feedback on API shape and scope.
Thank you for this idea and enthusiasm. However, there is already a really great p5.js community tool for this: p5.capture Is there a usecase where that tool doesn't work?
Hi, @ksen0 Thanks for the pointer to p5.capture. The gap I’m trying to cover is that it’s an extra dependency and less approachable for beginners/classroom/offline workflows compared to a built‑in core API. I recognize the cons (core maintenance burden, MediaRecorder browser limits, performance/large files, and scope creep), so I’d keep scope to video‑only and avoid overlap with existing saveGif. Happy to wait for approval and adjust based on feedback before any implementation.
@alihamza143143 I've made p5.record.js to cover this need and it supports MediaRecorder, PNG frames, and granular record controls. Having an extra addon I don't think is a significant barrier to adoption and we'd like to avoid adding too many features into the library which can bloat library size and maintenance overhead.
If you'd like to work on sketch recording, feel free to checkout p5.record.js and I'll be happy to review contribution there but in the short to medium term I don't think sketch recording will be part of the core library.