npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@arikata-nobuaki/videoframeuploader

v0.1.1

Published

Zero-copy video textures for Three.js WebGPU via importExternalTexture

Downloads

251

Readme

VideoFrameUploader

Zero-copy video textures for Three.js WebGPU using importExternalTexture.

Feed decoded VideoFrame objects into a render target, display them with standard TSL materials—no Three.js fork required. Decoding (HTML <video>, WebCodecs, etc.) stays on your side.

Why

On Safari WebGPU, uploading video every frame via VideoTexture or VideoFrameTexture (copyExternalImageToTexture) is often a bottleneck. This library blits VideoFrame into a render target with importExternalTexture, then samples that RT from Three.js—matching the zero-copy path used in raw WebGPU demos.

Requirements

  • WebGPU (navigator.gpu)
  • VideoFrame API
  • Three.js >=0.184.0 with WebGPURenderer (three/webgpu)
  • Safari 18.2+ (or another browser with WebGPU + VideoFrame from video)

No MediaBunny or other decoder is bundled. You supply frames via ExternalVideoSurface.setFrame().

Install

npm install @arikata-nobuaki/videoframeuploader

Or clone this repo, build the library, and import from dist/:

npm install
npm run build

Quick start

import * as THREE from 'three/webgpu'
import { VideoFrameUploader, checkCapabilities } from '@arikata-nobuaki/videoframeuploader'

const caps = checkCapabilities()
if (!caps.canRun) throw new Error('WebGPU or VideoFrame not available')

const canvas = document.querySelector('#canvas')
const renderer = new THREE.WebGPURenderer({ canvas, antialias: true })
renderer.outputColorSpace = THREE.SRGBColorSpace
await renderer.init()

const scene = new THREE.Scene()
const camera = new THREE.PerspectiveCamera(45, innerWidth / innerHeight, 0.1, 100)
camera.position.z = 2

const uploader = await VideoFrameUploader.create(renderer)
const surface = uploader.createSurface()
scene.add(surface.mesh)

const video = document.createElement('video')
video.src = '/path/to/video.mp4'
video.muted = true
video.loop = true
await video.play()

renderer.setAnimationLoop(() => {
  if (video.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA) {
    surface.setFrame(new VideoFrame(video))
    surface.setRenderSize(video.videoWidth, video.videoHeight)
  }

  uploader.update({ surfaces: [surface] })
  renderer.render(scene, camera) // or composer.render()
})

API

VideoFrameUploader.create(renderer)

Creates an uploader from your WebGPURenderer. Calls renderer.init() if needed.

uploader.createSurface({ buildColorNode? })

Returns an ExternalVideoSurface with:

| Member | Description | |--------|-------------| | mesh | THREE.Mesh — add to your scene and position/scale | | setFrame(frame) | Set a VideoFrame (previous frame is closed) | | setRenderSize(w, h) | RT size in pixels | | texture / renderTarget | Read-only access to the blit target | | dispose() | Release surface resources |

Optional buildColorNode customizes the TSL color node (default applies colorSpaceToWorking for correct sRGB).

uploader.update({ surfaces })

Blits each surface’s VideoFrame into its render target. Does not call renderer.render()—you control the final draw (plain render, EffectComposer, etc.).

uploader.dispose()

Releases internal blit pipeline only. You dispose the renderer and surfaces.

checkCapabilities()

Returns { hasWebGPU, hasVideoFrame, canRun }.

Build

npm run build

Output: dist/videoframeuploader.js (minified ESM, three externalized as peer dependency).

Examples

Place a sample MP4 at examples/common/video/seaside.mp4 (or change VIDEO_FILE in examples/common/js/constants.js).

| Demo | Path | Description | |------|------|-------------| | Zero-copy (this library) | examples/minimal | VideoFrameVideoFrameUploader | | Copy baseline | examples/videotexture | <video>VideoTexture | | Copy baseline | examples/videoframetexture | VideoFrameVideoFrameTexture |

All demos use a 2×2 grid with four independent <video> elements for fair FPS comparison.

npm run build
npm run preview:demo:minimal
npm run preview:demo:videotexture
npm run preview:demo:videoframetexture

Project layout

src/                 Library source
dist/                Built bundle (after npm run build)
examples/            Comparison demos + shared common/
LICENSE              MIT

License

MIT © Nobuaki Arikata