Media & Capture

WebCodecs

Probing…

WebCodecs is a web platform capability in the Media & Capture category. Low-level access to hardware video/audio encoders and decoders. Supported in Chromium 94+, Firefox 130+, and Safari 16.4+. Requires a secure context (HTTPS or localhost).

Secure context

Try it

Loading demo…

Code

const encoder = new VideoEncoder({
  output: chunk => console.log(chunk.type, chunk.byteLength),
  error: e => console.error(e),
})
encoder.configure({ codec: 'vp8', width: 320, height: 180 })

const frame = new VideoFrame(canvas, { timestamp: 0 })
encoder.encode(frame, { keyFrame: true })
frame.close()

await encoder.flush()
encoder.close()

Browser support

Chromium
94
Firefox
130
Safari
16.4

Frequently asked questions

Which browsers support WebCodecs?

Supported in Chromium 94+, Firefox 130+, and Safari 16.4+.

Does WebCodecs require HTTPS?

Yes. WebCodecs needs a secure context, so it only works over HTTPS (or on localhost during development).

What is WebCodecs used for?

Low-level access to hardware video/audio encoders and decoders.

Can I try WebCodecs in my browser?

Yes. shwcs.net runs a live WebCodecs demo that probes your current browser and lets you try the API. Everything runs locally — nothing is sent anywhere.

MDN reference ↗ Specification ↗