MCPcopy Create free account
hub / github.com/collidingScopes/shimmer / renderCanvasToVideoFrameAndEncode

Function renderCanvasToVideoFrameAndEncode

wavyImage.js:428–444  ·  view source on GitHub ↗
({
    canvas,
    videoEncoder,
    frameNumber,
    fps,
})

Source from the content-addressed store, hash-verified

426}
427
428async function renderCanvasToVideoFrameAndEncode({
429 canvas,
430 videoEncoder,
431 frameNumber,
432 fps,
433}) {
434 let frame = new VideoFrame(animation, {
435 // Equally spaces frames out depending on frames per second
436 timestamp: (frameNumber * 1e6) / fps,
437 });
438
439 // The encode() method of the VideoEncoder interface asynchronously encodes a VideoFrame
440 videoEncoder.encode(frame);
441
442 // The close() method of the VideoFrame interface clears all states and releases the reference to the media resource.
443 frame.close();
444}
445
446function downloadBlob() {
447 console.log("download video");

Callers 1

recordVideoMuxerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected