Video codecs

LiveKit's cutting-edge codec support lets you choose the right codec for your application's needs.

Supported codecs

LiveKit supports the following video codecs:

  • H.264
  • VP8
  • VP9 (including SVC)
  • AV1 (including SVC)

SVC (Scalable Video Coding) is a feature of newer codecs like VP9 and AV1. Encoding with SVC:

  • improves bitrate efficiency, since the higher quality layers can leverage information already stored in lower quality layers.
  • enables subscribers to switch between layers instantaneously, without having to wait for a keyframe.

SVC offers enhanced bitrate adaptability within a single stream, and is conceptually similar to Simulcast. Unlike Simulcast, which requires encoding and publishing separate streams, SVC codecs incorporate multiple spatial (resolution) and temporal (frame rate) layers into one stream.

When using VP9 or AV1 with LiveKit, SVC is activated automatically. By default, it uses the L3T3_KEY scalabilityMode, encoding with three spatial and three temporal layers.

You can read more about the tradeoffs between different codecs, as well as browser and device compatibility, in our Codecs Guide.

Configuring codecs when a Participant joins a Room

To use a particular codec, clients can specify the videoCodec option when connecting.

<LiveKitRoom
audio={true}
video={true}
token={token}
serverUrl={wsUrl}
options={{
publishDefaults: {
videoCodec: 'vp9',
},
}}
>
<GridLayout>
<ParticipantTile />
</GridLayout>
</LiveKitRoom>

Specifying codecs on a per-track basis

Clients can also specify codecs on a per-track basis when publishing tracks:

const localParticipant = useLocalParticipant();
const videoTrack = await createLocalVideoTrack();
const videoPublication = await localParticipant.publishTrack(videoTrack, {
facingMode: 'user',
videoCodec: 'vp9',
});

Configuring codec support server-side

You can also enable and disable codecs on the server side, using the dashboard on LiveKit Cloud or the server configuration file for self-hosted deployments:

You can enable or disable codecs in LiveKit Cloud on your Project Settings page.

FAQ: Why don’t you support h.265?

We don’t support h.265 because browsers don’t support it. The reasons for this are discussed in this Hacker News discussion (tldr: patent licensing issues).