Glossary

WebCodecs

The browser’s codecs, without the rest of the stack. WebCodecs hands JavaScript individual frames and encoded chunks and leaves transport, timing and buffering to the application.

General definition

WebCodecs is a W3C specification that gives web applications low-level access to the media encoders and decoders a browser already contains, including the hardware-accelerated ones. It defines four main classes, VideoEncoder, VideoDecoder, AudioEncoder and AudioDecoder, plus the VideoFrame and AudioData objects that carry raw media and the EncodedVideoChunk and EncodedAudioChunk objects that carry compressed data. An application feeds frames in and receives chunks out, or the reverse, with full control over timing, keyframe requests and codec configuration. Chrome shipped it in 2021 and Safari and Firefox followed, so it is now usable across the major browsers.

WebCodecs deliberately does not include a transport, a jitter buffer, congestion control or any notion of a session. Those are the application’s job. A typical pipeline captures frames from a camera or canvas, encodes them with VideoEncoder, sends the chunks over WebTransport or a WebSocket, and decodes them with VideoDecoder on the other side, rendering to a canvas. The same API handles the reverse direction: decode a file or stream frame by frame for editing, analysis or playback with custom timing.

  • Versus WebRTC: WebRTC is a complete real-time calling stack with negotiation, encryption, NAT traversal, loss recovery and adaptation built in; WebCodecs is only the codec stage, so you gain flexibility and take on everything else
  • Versus MediaRecorder: MediaRecorder produces a finished container file (WebM or MP4) with the browser choosing the settings; WebCodecs gives per-frame control and raw chunks with no container
  • Codecs: whatever the browser supports, commonly H.264, VP9, AV1 and HEVC for video and Opus and AAC for audio, checked at runtime through isConfigSupported
  • Typical uses: cloud gaming and remote desktop, low-latency broadcast viewers, browser video editors, computer vision on live video, custom conferencing experiments

The trade-off is clear: WebCodecs is the right tool when the application needs a media pipeline that WebRTC cannot express, and the wrong tool for an ordinary call, where reimplementing WebRTC’s loss recovery and congestion control is a large project with no upside. The two can also combine: WebRTC encoded transforms (insertable streams) let an application touch encoded frames inside a WebRTC call, which covers many cases that once required dropping down to WebCodecs.

Adding calls to your product? The Ethora voice chat SDK is built on WebRTC, with 1:1 calls, group voice rooms and push-to-talk for web, iOS and Android.

In the Ethora ecosystem

Ethora calls are built on WebRTC with an SFU, which is the full stack WebCodecs leaves out: the browsers and client apps negotiate codecs through SDP, encrypt media with DTLS-SRTP, traverse NATs with ICE and adapt to the network with the standard congestion control, while the SFU forwards each stream to the other participants. For in-app voice and video that is the right layer to build on, and application developers never touch the codec stage directly. The voice and video call API page describes what sits on top.

WebCodecs becomes relevant around the edges of a chat product rather than inside its calls: transcoding or trimming a video attachment in the browser before upload, generating thumbnails client-side, or decoding a recorded stream for playback with custom controls. Those are application-level choices in a web client built with the React chat SDK, independent of how calls work.

Get started

Add voice chat to your app

1:1 calls, group voice rooms and push-to-talk, built on WebRTC, on our cloud or your own infrastructure.

Free tier available Enterprise SLA No vendor lock-in