Published
Edited
Mar 17, 2021
Importers
1 star
Insert cell
Insert cell
Insert cell
viewof videoData = encodeMP4(
t, // Input data
computeFrameData, // Frame computation callback
{
// wrapper configuration
displayOutput: false,
flipY: true,

// h264-mp4-encoder configuration
frameRate: 30,
width: shape.width,
height: shape.height,
outputFilename: 'video.mp4'
}
)
Insert cell
t = Array.from(Array(120).keys()).map((d, i) => i / 60)
Insert cell
computeFrameData = {
// Usage of this buffer is synchronous so that we may reuse it from frame to frame
const data = new Uint8Array(shape.width * shape.height * 4);

return function computeFrameData(time) {
regl.poll();
fbo.use(() => {
blit({ time }, () => {
draw();
regl.read(data);
});
});
return data; // (Alternatively, Promise.resolve(data) or make this an async function)
};
}
Insert cell
videoData
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more