Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add VideoFrameTexture for use with WebCodecs API and example/docs #30269

Closed
wants to merge 1 commit into from

Conversation

maddanio
Copy link

@maddanio maddanio commented Jan 6, 2025

Description

We use the WebCodecs API to decode video Frames to be able to use custom streaming and stitching and inter-stream synchronisation. It is not clear how exactly to feed these to Three.js and doing it naively can leave lots of performance on the table, so I added a VideoFrameTexture class together with documentation and an example.

This contribution is funded by GameOn


let camera, scene, renderer;
let stats;
let video, material, mesh;

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable video.
});

// Fetch and demux the media data.
const demuxer = new MP4Demuxer("textures/sintel.mp4", {

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable demuxer.
Copy link

github-actions bot commented Jan 6, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 339.49
79.09
339.51
79.09
+18 B
+5 B
WebGPU 489.81
135.9
489.83
135.9
+18 B
+6 B
WebGPU Nodes 489.28
135.78
489.3
135.79
+18 B
+6 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 465.35
112.14
465.35
112.14
+0 B
+0 B
WebGPU 559.29
151.38
559.29
151.38
+0 B
+0 B
WebGPU Nodes 515.37
141.16
515.37
141.16
+0 B
+0 B

@Mugen87
Copy link
Collaborator

Mugen87 commented Jan 6, 2025

Thanks for filing the PR! It was very helpful to understand the use case. Let me file an other PR based on this one with minimal changes to the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants