TheatreJS keyframes and WebMMuxer video encoding
✓ Published0🌍 Public
Aakre54
Last edited Feb 1, 2023
Created on Feb 1, 2023
TheatreJS animates a scene through keyframed sequences, driving a canvas to render each frame at a fixed simulation time. This example shows how to capture those frames and encode them into a WebM video file using the WebM Muxer library and the browser’s VideoEncoder API with VP9 codec. It uses a rAF driver to tick the animation, a MediaStreamTrackProcessor to read canvas frames, and a file picker to save the output. The capture loop advances the sequence position frame by frame, requesting new canvas frames and writing them as video chunks with periodic keyframes.
AI-generated description