Mediabunny allows you efficiently read data from any video or audio file, no matter the size: duration, resolution, rotation, tracks, codecs and other metadata, as well as raw or decoded media data from anywhere in the file. Load only what you need.
const input = new Input({ source: new UrlSource('./bigbuckbunny.mp4'), formats: ALL_FORMATS, // .mp4, .webm, .wav, ...});const duration = await input.computeDuration();const videoTrack = await input.getPrimaryVideoTrack();const { displayWidth, displayHeight, rotation } = videoTrack;const audioTrack = await input.getPrimaryAudioTrack();const { sampleRate, numberOfChannels } = audioTrack;// Get the frame halfway through the videoconst sink = new VideoSampleSink(videoTrack);const frame = await sink.getSample(duration / 2);// Loop over all frames of the videofor await (const frame of sink.samples()) { // ...}
You might be wondering what Supersplat is. Well, remember how I pick a trending repo every week and share the patterns and packages used? Yeah, Superslat is listed as one of the trending repos.
Superslat is a 3D Gaussian Splat Editor.
superslat/render.ts has registerRenderEvents defined for the following events: