From 734c222d70274cd0b60620800ca56e7ea20c1652 Mon Sep 17 00:00:00 2001 From: Chris Mills Date: Wed, 25 Jun 2025 16:52:55 +0100 Subject: [PATCH 1/4] Add information on HEVC codec parameter values --- .../guides/formats/codecs_parameter/index.md | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/files/en-us/web/media/guides/formats/codecs_parameter/index.md b/files/en-us/web/media/guides/formats/codecs_parameter/index.md index 12a26e4eb390913..f5aa7c92f35c2b0 100644 --- a/files/en-us/web/media/guides/formats/codecs_parameter/index.md +++ b/files/en-us/web/media/guides/formats/codecs_parameter/index.md @@ -48,6 +48,7 @@ The containers below support extended codec options in their `codecs` parameters - [3GP](#iso_base_media_file_format_mp4_quicktime_and_3gp) - [AV1](#av1) +- [HEVC](#hevc_mp4_quicktime_matroska) - [ISO BMFF](#iso_base_media_file_format_mp4_quicktime_and_3gp) - [MPEG-4](#iso_base_media_file_format_mp4_quicktime_and_3gp) - [QuickTime](#iso_base_media_file_format_mp4_quicktime_and_3gp) @@ -594,6 +595,9 @@ Thus, the syntaxes for each of the supported codecs look like this: The level is a fixed-point number, so a value of `14` (decimal 20) means level 2.0 while a value of `3D` (decimal 61) means level 6.1. Generally speaking, the higher the level number, the more bandwidth the stream will use and the higher the maximum video dimensions are supported. +- `avc3[.PPCCLL]` (Variable resolution AVC) + - : The `avc3` codec parameters have the same syntax as the `avc1` codec parameters. + #### AVC profiles The following are the AVC profiles and their profile numbers for use in the `codecs` parameter, as well as the value to specify for the constraints component, `CC`. @@ -898,6 +902,36 @@ The Audio Object Types are defined in ISO/IEC 14496-3 subpart 1, section 1.5.1. +### HEVC: MP4, Quicktime, Matroska + +The [High Efficiency Video Coding](https://en.wikipedia.org/wiki/High_Efficiency_Video_Coding) format, also known as H.265 and MPEG-H Part 2, can be included in the [MP4](/en-US/docs/Web/Media/Guides/Formats/Containers#mpeg-4_mp4) (`video/mp4`), [Quicktime](/en-US/docs/Web/Media/Guides/Formats/Containers#quicktime) (`video/quicktime`), and [Matroska](https://en.wikipedia.org/wiki/Matroska) (`video/matroska`) containers. + +Use of HEVC is generally described using a supporting MIME type with the `codecs` parameter appended; syntax examples are as follows: + +```plain +video/mp4;codecs=hvc1.1.6.L186.B0,mp4a.40.2 +video/mp4;codecs=hvc1.1.6.L186.B0,opus +video/mp4;codecs=hev1.1.6.L186.B0,mp4a.40.2 +video/mp4;codecs=hev1.1.6.L186.B0,opus +``` + +The syntax for the `codecs` value starts with the codec's four-character identifier, followed by: + +- A single digit... +- A single digit... +- A four-character... +- A two-character... + +With each one separated by a period (`.`), followed by the Object Type Indication (OTI) value for the specific data format. For most codecs, the OTI is a two-digit hexadecimal number; however, it's six hexadecimal digits for [AVC (H.264)](/en-US/docs/Web/Media/Guides/Formats/Video_codecs#avc_h.264). + +The syntaxes for each of the supported codecs look like this: + +- `hvc1[.A.B.CCCC.DD]` (HEVC video) + - : xxx + +- `hev1[.A.B.CCCC.DD]` (Variable resolution HEVC) + - : The `hev1` codec parameters have the same syntax as the `hvc1` codec parameters. + ### WebM The basic form for a WebM `codecs` parameter is to list one or more of the four WebM codecs by name, separated by commas. The table below shows some examples: From 35bce4dd2204d6474341f6a919d386d8af0b05f9 Mon Sep 17 00:00:00 2001 From: Chris Mills Date: Wed, 2 Jul 2025 12:53:57 +0100 Subject: [PATCH 2/4] Fill in syntax information for hvc1/hev1 --- .../guides/formats/codecs_parameter/index.md | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/files/en-us/web/media/guides/formats/codecs_parameter/index.md b/files/en-us/web/media/guides/formats/codecs_parameter/index.md index f5aa7c92f35c2b0..ae5da2a5a694531 100644 --- a/files/en-us/web/media/guides/formats/codecs_parameter/index.md +++ b/files/en-us/web/media/guides/formats/codecs_parameter/index.md @@ -915,21 +915,35 @@ video/mp4;codecs=hev1.1.6.L186.B0,mp4a.40.2 video/mp4;codecs=hev1.1.6.L186.B0,opus ``` -The syntax for the `codecs` value starts with the codec's four-character identifier, followed by: +The syntaxes for each of the supported codecs look like this: -- A single digit... -- A single digit... -- A four-character... -- A two-character... +- `hvc1[.A.B.C.D]` (HEVC video) + - : The value starts with the codec's four-character identifier (`hvc1`), followed by four or more values separated by periods (`.`): + - `A` + - : The **`general_profile_space`**. This is encoded as one or two characters: + - The first character is `A`, `B`, or `C`, representing `general_profile_space` `1`, `2`, or `3`, or no character, representing `general_profile_space` `0`. + - The second character is a decimal number representing the `general_profile_idc`. + > [!NOTE] + > In the above examples, the value `1` means `general_profile_space === 0` (no character) and `general_profile_idc === 1`. + - `B` + - : A 32-bit value representing one or more **general profile compatibility flags** (`general_profile_compatibility_flag`), encoded in hexadecimal (leading zeroes may be omitted), and specified in reverse bit order from most to least significant. The values can range from `31` (most significant) to `0` (least significant), and are specified in [ISO/IEC 23008-2](https://www.iso.org/standard/90502.html). -With each one separated by a period (`.`), followed by the Object Type Indication (OTI) value for the specific data format. For most codecs, the OTI is a two-digit hexadecimal number; however, it's six hexadecimal digits for [AVC (H.264)](/en-US/docs/Web/Media/Guides/Formats/Video_codecs#avc_h.264). + > [!NOTE] + > In the above examples, the value `6` means `general_profile_compatibility_flag === 6`. -The syntaxes for each of the supported codecs look like this: + - `C` + - : The **`general_tier_flag`**, encoded as `L` (`general_tier_flag === 0`) or `H` (`general_tier_flag === 1`), followed by the **`general_level_idc`**, encoded as a decimal number. + + > [!NOTE] + > In the above examples, the value `L186` means `general_tier_flag === 0` followed by `general_level_idc === 186`. + + - `D` + - : One or more 6-byte **constraint flags**. Note that each flag is encoded as a hexadecimal number, and separated by an additional period; trailing bytes that are zero may be omitted. -- `hvc1[.A.B.CCCC.DD]` (HEVC video) - - : xxx + > [!NOTE] + > In the above examples, there is only one constraint flag present — `B0`. -- `hev1[.A.B.CCCC.DD]` (Variable resolution HEVC) +- `hev1[.A.B.C.D]` (Variable resolution HEVC) - : The `hev1` codec parameters have the same syntax as the `hvc1` codec parameters. ### WebM From efcf3f5734e6feca289803fae5663fa9332e5d9d Mon Sep 17 00:00:00 2001 From: Chris Mills Date: Fri, 4 Jul 2025 09:00:59 +0100 Subject: [PATCH 3/4] Update files/en-us/web/media/guides/formats/codecs_parameter/index.md Co-authored-by: Hamish Willee --- files/en-us/web/media/guides/formats/codecs_parameter/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/en-us/web/media/guides/formats/codecs_parameter/index.md b/files/en-us/web/media/guides/formats/codecs_parameter/index.md index ae5da2a5a694531..3d5bc84062d67e0 100644 --- a/files/en-us/web/media/guides/formats/codecs_parameter/index.md +++ b/files/en-us/web/media/guides/formats/codecs_parameter/index.md @@ -904,7 +904,7 @@ The Audio Object Types are defined in ISO/IEC 14496-3 subpart 1, section 1.5.1. ### HEVC: MP4, Quicktime, Matroska -The [High Efficiency Video Coding](https://en.wikipedia.org/wiki/High_Efficiency_Video_Coding) format, also known as H.265 and MPEG-H Part 2, can be included in the [MP4](/en-US/docs/Web/Media/Guides/Formats/Containers#mpeg-4_mp4) (`video/mp4`), [Quicktime](/en-US/docs/Web/Media/Guides/Formats/Containers#quicktime) (`video/quicktime`), and [Matroska](https://en.wikipedia.org/wiki/Matroska) (`video/matroska`) containers. +The [High Efficiency Video Coding](https://en.wikipedia.org/wiki/High_Efficiency_Video_Coding) codec, also known as H.265 and MPEG-H Part 2, can be included in the [MP4](/en-US/docs/Web/Media/Guides/Formats/Containers#mpeg-4_mp4) (`video/mp4`), [Quicktime](/en-US/docs/Web/Media/Guides/Formats/Containers#quicktime) (`video/quicktime`), and [Matroska](https://en.wikipedia.org/wiki/Matroska) (`video/matroska`) containers. Use of HEVC is generally described using a supporting MIME type with the `codecs` parameter appended; syntax examples are as follows: From 7eed796afd5cde25a1cb8a0d6f02880641232323 Mon Sep 17 00:00:00 2001 From: Chris Mills Date: Fri, 4 Jul 2025 09:32:58 +0100 Subject: [PATCH 4/4] Update HEVC links as per hamishwillee comments --- files/en-us/web/media/guides/formats/codecs_parameter/index.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/files/en-us/web/media/guides/formats/codecs_parameter/index.md b/files/en-us/web/media/guides/formats/codecs_parameter/index.md index 3d5bc84062d67e0..30b7f5f40734119 100644 --- a/files/en-us/web/media/guides/formats/codecs_parameter/index.md +++ b/files/en-us/web/media/guides/formats/codecs_parameter/index.md @@ -904,7 +904,7 @@ The Audio Object Types are defined in ISO/IEC 14496-3 subpart 1, section 1.5.1. ### HEVC: MP4, Quicktime, Matroska -The [High Efficiency Video Coding](https://en.wikipedia.org/wiki/High_Efficiency_Video_Coding) codec, also known as H.265 and MPEG-H Part 2, can be included in the [MP4](/en-US/docs/Web/Media/Guides/Formats/Containers#mpeg-4_mp4) (`video/mp4`), [Quicktime](/en-US/docs/Web/Media/Guides/Formats/Containers#quicktime) (`video/quicktime`), and [Matroska](https://en.wikipedia.org/wiki/Matroska) (`video/matroska`) containers. +The [High Efficiency Video Coding](/en-US/docs/Web/Media/Guides/Formats/Video_codecs#hevc_h.265) codec, also known as H.265 and MPEG-H Part 2, can be included in the [MP4](/en-US/docs/Web/Media/Guides/Formats/Containers#mpeg-4_mp4) (`video/mp4`), [Quicktime](/en-US/docs/Web/Media/Guides/Formats/Containers#quicktime) (`video/quicktime`), and [Matroska](https://en.wikipedia.org/wiki/Matroska) (`video/matroska`) containers. Use of HEVC is generally described using a supporting MIME type with the `codecs` parameter appended; syntax examples are as follows: @@ -976,3 +976,4 @@ You can also use the codecs parameter when specifying a MIME media type to the { - [Guide to video codecs used on the web](/en-US/docs/Web/Media/Guides/Formats/Video_codecs) - [Codecs used by WebRTC](/en-US/docs/Web/Media/Guides/Formats/WebRTC_codecs) - [Getting the correct HTML codecs parameter for an AV1 video](https://jakearchibald.com/2022/html-codecs-parameter-for-av1/) +- [High Efficiency Video Coding](https://en.wikipedia.org/wiki/High_Efficiency_Video_Coding) on Wikipedia