New VP9 codec string and Profile 2 support Sample

Available in Chrome 60+ | View on GitHub | Browse Samples

Background

VP9 is an open and royalty-free video codec that has been supported in Chromium since 2013. An update adds a new string format for describing the encoding properties, such as the profile, level, etc. Such properties are common in video codecs but are not exposed in the current VP9 string format.

In addition, this update includes a new format to advertise support for VP9 Profile 2. This profile is needed to enable higher bit-depth video and the new binding allows higher granularity in the query for specific features of the VP9 bitstream. The string format is accepted by media-related APIs such as MediaSource.isTypeSupported(), HTMLMediaElement.canPlayType(), and navigator.requestMediaKeySystemAccess().

Live Output


JavaScript Snippet

if (MediaSource.isTypeSupported('video/webm; codecs="vp9"')) {
  log('> Some VP9 profile');
}

if (MediaSource.isTypeSupported('video/webm; codecs="vp09.00.10.08"')) {
  log('> VP9, Profile 0, level 1, bit depth 8 (later fields defaulted)');
}

if (MediaSource.isTypeSupported('video/webm; codecs="vp09.01.20.08.01"')) {
  log('> VP9, Profile 1, level 2, bit depth 8, ' +
      '4:2:0 chroma subsampling colocated with (0,0) luma, ' +
      '(later fields defaulted)');
}

if (MediaSource.isTypeSupported('video/webm; codecs="vp09.01.20.08.01.01.01.01.00"')) {
  log('> VP9, Profile 1, level 2, bit depth 8, ' +
      '4:2:0 chroma subsampling colocated with (0,0) luma, ' +
      'REC709 color/transfer/matrix, ' +
      'luma/chroma encoded in the "legal" range.');
}

if (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.09.01"')) {
  log('> VP9, Profile 2, level 1, 10-bit YUV content, ' +
      '4:2:0 colocated with luma (0,0) chroma subsampling, ' +
      'ITU-R BT.2020 primaries, ' +
      'ST 2084 EOTF, ITU-R BT.2020 non-constant luminance color matrix, ' +
      'full-range chroma/luma encoding.');
}