Unlisted
Edited
Dec 1, 2020
2 forks
Importers
1 star
Insert cell
Insert cell
HME = await require('https://unpkg.com/h264-mp4-encoder/embuild/dist/h264-mp4-encoder.web.js').catch(
() => window["HME"]
)
Insert cell
encoder = HME.createH264MP4Encoder().then(encoder => {
// Must be a multiple of 2.
encoder.width = 100;
encoder.height = 100;
encoder.initialize();
// Add a single gray frame, the alpha is ignored.
encoder.addFrameRgba(
new Uint8Array(encoder.width * encoder.height * 4).fill(128)
);
// For canvas:
// encoder.addFrameRgba(ctx.getImageData(0, 0, encoder.width * encoder.height).data);
encoder.finalize();
const uint8Array = encoder.FS.readFile(encoder.outputFilename);
console.log(uint8Array);
encoder.delete();
})
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