RFC 4281

The Codecs Parameter for "Bucket" Media Types

πŸ“… published December 2005, from ietf

RFC 4281: The Codecs Parameter for "Bucket" Media Types πŸŽ€

okay bestie, let's do the paperwork first πŸ“‹βœ¨

  • Network Working Group 🌸
  • Request for Comments: 4281
  • Category: Standards Track πŸ¦‹
  • Authors: R. Gellens (Qualcomm), D. Singer (Apple), P. Frojdh (Ericsson) πŸ‘‘
  • Date: November 2005 πŸ“
  • Obsoletes / Updates: the title block doesn't list either one, so this RFC isn't replacing or updating anything else πŸ’…

Status of This Memo πŸ“œ

bestie, this is an Internet standards track protocol for the Internet community 🌈 and it's actively asking for discussion and suggestions for improvements πŸ’–. If you want the official standardization state and status of this protocol, check the current edition of the "Internet Official Protocol Standards" (STD 1) πŸ”. And distribution of this memo is unlimited, so share it with everyone πŸ’œ

Copyright (C) The Internet Society (2005).

Abstract 🫢

okay so there are a bunch of MIME type and subtype combos that can hold different media formats πŸ“¦. That means a receiving agent has to dig into the actual media content to figure out whether it can render the stuff inside 😩. It's extra painful when the end system has limited resources, or when the connection has limited bandwidth. Honestly, it would be so helpful to know from the Content-Type alone whether the content can be rendered πŸ™

This document adds a new parameter, "codecs", to various type/subtype combinations πŸŽ€. It lets you name the codecs indicated by the media formats inside, without any ambiguity πŸ’….

Once content is labeled with the specific codecs needed to render it, receiving systems can check whether the end system supports those codecs ✨. If it doesn't, the system has options 🧚: rejecting the content, sending a notification about the situation, transcoding the content to a supported type, fetching and installing the required codecs, or doing further inspection to see if supporting just a subset of the indicated codecs will be enough. It's giving choices, babe πŸ’–

Table of Contents πŸ—‚οΈ

   1. Introduction ....................................................2
   2. Conventions Used in This Document ...............................4
   3. The Codecs Parameter ............................................4
      3.1. Generic Syntax .............................................5
      3.2. ISO File Format Name Space .................................7
      3.3. ISO Syntax .................................................8
   4. Use in Additional Media Types ...................................8
   5. Examples ........................................................9
   6. Additional Media Feature Details ................................9
   7. IANA Considerations .............................................9
   8. Security Considerations .........................................9
   9. Acknowledgements ...............................................10
   10. Normative References ..........................................10
   11. Informative References ........................................10

1. Introduction ✨

okay so one of the original goals of MIME was being able to identify the specific media type of a message part πŸ”. But for various reasons, you can't always look at the MIME type and subtype and know which media formats are in the body part, or which codecs you need to render the content 😭.

There are several media type/subtypes (some already registered, some deployed with registration still pending) that contain codecs picked from a set 🎁. Right now, you have to examine each media element to figure out which codecs are required to render the content 😩. For example, video/3gpp can contain any of the video formats H.263 Profile 0, H.263 Profile 3, H.264, and MPEG-4 Simple Profile, and/or any of the audio formats Adaptive Multi Rate (AMR), Adaptive Multi Rate - WideBand (AMR-WB), Extended AMR-WB, Advanced Audio Coding (AAC), or Enhanced aacPlus, as specified in [3GPP-Formats] 🎬.

Sometimes you can work out the specific codecs from the header information of the media content 🧐. That's less painful than checking the entire content, but it still needs specialized knowledge of each format, and it's resource-consuming πŸ₯².

This ambiguity causes real problems for various clients and servers πŸ’€. It's a big burden on Multimedia Messaging (MMS) servers, which have to examine the media in each message to determine which codecs are required to render the content. Only then can such a server tell whether the content needs transcoding or specialized handling before it gets sent to the handset πŸ“±.

It's also a challenge for smart clients on devices with constrained memory, processing power, or transmission bandwidth, like cellular telephones and PDAs 🫠. These clients often need to figure out ahead of time whether they can render the content inside an MMS or email message πŸ’Œ.

Here's the current ambiguity πŸ‘€:

  • audio/3gpp can contain AMR, AAC, AMR-WB, Extended AMR-WB, or Enhanced aacPlus contents as specified in [3GPP-Formats].
  • audio/3gpp2 can contain AMR, AAC, 13K (as per [13k]), Enhanced Variable Rate Codec (EVRC), Selectable Mode Vocoder (SMV), or VMR-WB, as specified in [3GPP2-Formats].
  • video/3gpp can contain H.263 Profile 0, H.263 Profile 3, H.264, MPEG-4 Simple Profile, and/or AMR, AMR-WB, Extended AMR-WB, AAC, or Enhanced aacPlus, as specified in [3GPP-Formats].
  • video/3gpp2 can contain H.263 Profile 0, H.263 Profile 3, H.264, MPEG-4 Simple Profile, and/or AMR, AAC, 13K (as per [13k]), EVRC, SMV, or VMR-WB, as specified in [3GPP2-Formats].

There are also other media types that are ambiguous, but they're outside this document's scope πŸ™…β€β™€οΈ, including:

  • video/mpeg4-generic, which can contain anything allowed by the MPEG-4 specification, or any codec registered with the MP4 registration authority [MP4-Reg];
  • video/quicktime, which can contain anything for which there is a QuickTime codec component. QuickTime is extensible, so this isn't limited to the codecs that are or have been shipped by Apple Computer 🍎.

With each "bucket" type, a receiving agent only knows that it has a container format πŸͺ£. It doesn't even know whether content labeled video/3gpp or video/3gpp2 contains video. It might be audio only, audio and video, or video only πŸ€·β€β™€οΈ.

A solution that lets a receiving agent determine the specific codecs required to render media content would help build efficient and scalable servers, especially for Multimedia Messaging (MMS), and would help multimedia services grow in wireless networks πŸš€βœ¨.

2. Conventions Used in This Document πŸ“š

The key words "REQUIRED", "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", and "MAY" in this document are to be interpreted as described in "Key words for use in RFCs to Indicate Requirement Levels" [KEYWORDS] πŸ”‘.

The syntax in this document uses the BNF rules specified in [MIME-Format] and [MIME-Coding] 🧩.

3. The Codecs Parameter πŸ¦‹

This document adds a parameter that lets you specify, without ambiguity, all the codecs indicated to render the content in the MIME part πŸ’œ. This parameter is optional in all current types it's added to 🌸. Future types that contain ambiguity are strongly encouraged to include it, so please do πŸ™.

Here's the setup for the parameter πŸ‘‡:

Media types:
    audio/3gpp,
    audio/3gpp2,
    video/3gpp,
    video/3gpp2,

Parameter name:
    Codecs

3.1. Generic Syntax πŸŽ€

Here's the parameter value. It's a single value, or a comma-separated list of values, identifying the codec(s) indicated to render the content in the body part 🧾.

Each value is made of one or more dot-separated elements πŸ”—. The name space for the first element is determined by the MIME type. The name space for each subsequent element is determined by the element before it πŸͺ†.

Heads up: per [MIME-Format], some characters (including the comma used to separate multiple values) mean the entire parameter value has to be wrapped in quotes πŸŽ€.

An element MAY include an octet that needs to be encoded to comply with [MIME-Format] 🫧. When that happens, [MIME-Coding] comes into play. You put an asterisk ("") at the end of the parameter name, so it becomes "codecs" instead of "codecs". The parameter value usually starts with two single quote ("'") characters, which means neither character set nor language is specified 🌷. Each octet that needs encoding is written as a percent sign ("%") followed by two hexadecimal digits πŸ”’.

Watch out, bestie! When the [MIME-Coding] form is used, the percent sign, asterisk, and single quote characters have special meaning, so they have to be encoded themselves too 🚨.

Here are the examples of generic syntax πŸ’–:

    codecs=a.bb.ccc.d
    codecs="a.bb.ccc.d, e.fff"
    codecs*=''fo%2e
    codecs*="''%25%20xz, gork"

Now the rules πŸ“. When the Codecs parameter is used, it MUST contain all codecs indicated by the content present in the body part πŸ’…. The Codecs parameter MUST NOT include any codecs that aren't indicated by any media elements in the body part 🚫. No extras, no skipping 😀.

Some indicated codecs aren't absolutely required to render the content, though πŸ€”. So when a receiver doesn't support all the listed codecs, special handling MAY be required 🧐. For example, the media element(s) MAY need to be examined to see if an unsupported codec is actually required. There could be alternative tracks (like English and Spanish audio), or timed text that can be dropped, and so on 🎧.

NOTE: The parameter value MUST be complete and accurate in 'breadth'. That means it MUST report all four-character codes used in all tracks for ISO-family files, for example. But systems MUST NOT rely on it being complete in 'depth' 🫣. If the hierarchical rules for a given code (say, 'qvxy') were written after a server was implemented, that server won't know what elements to place after 'qvxy' πŸ’€.

If a receiver runs into a body part whose Codecs parameter contains codecs that aren't indicated by any media elements, the receiver SHOULD process the body part by discarding the information in the Codecs parameter πŸ—‘οΈβœ¨.

If a receiver runs into a body part whose Codecs parameter does not contain all codecs indicated by the media elements, the receiver MAY process the body part by discarding the information in the Codecs parameter 🌈.

3.1. Generic Syntax ✨

okay so the Codecs parameter comes in two forms πŸ’… the first one is for when your value has no octets that need encoding, and the second one uses [MIME-Coding] so you can encode literally any octets πŸ¦‹ with either form, quotes let you use commas and other characters from <tspecials> (quotes MAY be used even when not required) πŸŽ€

this BNF is built on the rules from [MIME-Format] and [MIME-Coding] 🧚

Implementations MUST NOT add CFWS between the tokens except after "," πŸ™ˆ

codecs      := cod-simple / cod-fancy

cod-simple  := "codecs" "=" unencodedv

unencodedv  := id-simple / simp-list

simp-list   := DQUOTE id-simple *( "," id-simple ) DQUOTE

id-simple   := element
            ; "." reserved as hierarchy delimiter

element     := 1*octet-sim

octet-sim   := <any TOKEN character>
            ; <TOKEN> defined in [MIME-Format]
            ;
            ; Within a Codecs parameter value, "." is reserved
            ; as a hierarchy delimiter

cod-fancy   := "codecs*" ":=" encodedv

encodedv    := fancy-sing / fancy-list

fancy-sing  := [charset] "'" [language] "'" id-encoded
            ; Parsers MAY ignore <language>
            ; Parsers MAY support only US-ASCII and UTF-8

fancy-list  := DQUOTE [charset] "'" [language] "'" id-list DQUOTE
            ; Parsers MAY ignore <language>
            ; Parsers MAY support only US-ASCII and UTF-8

id-list     := id-encoded *( "," id-encoded )

id-encoded  := encoded-elm *( "." encoded-elm )
            ; "." reserved as hierarchy delimiter

encoded-elm := 1*octet-fancy

octet-fancy := ext-octet / attribute-char
            ; <ext-octet> and <attribute-char> defined in
            ; [MIME-Coding]

DQUOTE      := %x22 ; " (double quote)

Initial name space: This document only defines values for files in the ISO Base Media File Format family. Other file formats may also define codec naming. πŸ’–

3.2. ISO File Format Name Space 🌸

for the ISO Base Media File Format, the first element of a Codecs value is a sample description entry four-character code, registered by the MP4 Registration Authority [MP4-Reg] πŸ“ these are case sensitive, so watch those letters bestie πŸ‘€

note that a file can have multiple tracks, and each track can carry multiple sample entries (some, but not all, uses of the ISO File Format limit a track to one sample entry) 🎬

when the first element is 'mp4a' (some kind of MPEG-4 audio) or 'mp4v' (some kind of MPEG-4 part-2 video), the second element is the hexadecimal representation of the MP4 Registration Authority ObjectTypeIndication (OTI), as specified in [MP4-Reg] and [MP41] (including amendments) πŸ”₯ [MP4-Reg] writes these with a leading "0x", but that's omitted here, so it's implied πŸ’…

one OTI value for 'mp4a' is 40, which means MPEG-4 audio 🎧 for that one, the third element is the audio ObjectTypeIndication (OTI) defined in [MP4A] (including amendments), written as a decimal number ✨

for example, AAC low complexity is 2, so the full string for AAC-LC is "mp4a.40.2" 🫢

one OTI value for 'mp4v' is 20, which means MPEG-4 part-2 video 🎞️ for that one, the third element is the video ProfileLevelIndication defined in [MP4V] (including amendments), also as a decimal number 🌈

for example, MPEG-4 Visual Simple Profile Level 0 is 9, so its full string is "mp4v.20.9" πŸ‘‘

3.3. ISO Syntax 🧚

id-simple   :=/ id-iso

id-encoded  :=/ id-iso

id-iso      := iso-gen / iso-mpega / iso-mpegv

iso-gen     := cpid *( element / encoded-elm )
            ; <element> used with <codecs-simple>
            ; <encoded-elm> used with <codecs-fancy>
            ;
            ; Note that the BNF permits "." within <element>
            ; and <encoded-elm> but "." is reserved as the
            ; hierarchy delimiter

iso-mpega   := mp4a "." oti [ "." aud-oti ]
iso-mpegv   := mp4v "." oti [ "." vid-pli ]

cpid        := 4(octet-simple / octet-fancy)
            ; <octet-simple> used with <codecs-simple>
            ; <octet-fancy> used with <codecs-fancy>

mp4a        := %x6d.70.34.61 ; 'mp4a'

oti         := 2(DIGIT / "A" / "B" / "C" / "D" / "E" / "F")
            ; leading "0x" omitted

aud-oti     := 1*DIGIT

mp4v        := %x6d.70.34.76 ; 'mp4v'
vid-pli     := 1*DIGIT

4. Use in Additional Media Types πŸ¦‹

this parameter MAY be specified for use with additional MIME media types πŸ’œ

for ISO file formats where the name space defined here is enough, all you have to do is update the media type registration so it specifies the Codecs parameter, with a reference to this document πŸ“ for existing media types, it is generally advisable for the parameter to be optional πŸ™ˆ for new media types, the parameter MAY be optional or required, whichever fits best ✨

for ISO file formats where the name space defined here needs to grow, a new document MAY update this one by specifying the extra detail 🌸

for non-ISO formats, a new document MAY update this one by specifying the name space for the media type(s) πŸ“

5. Examples πŸŽ€

Content-Type: video/3gpp2; codecs="sevc, s263"
    (EVRC audio plus H.263 video)
Content-Type: audio/3gpp; codecs=samr
    (AMR audio)
Content-Type: video/3gpp; codecs="s263, samr"
    (H.263 video plus AMR audio)
Content-Type: audio/3gpp2; codecs=mp4a.E1
    (13k audio)
Content-Type: video/3gpp2; codecs="mp4v.20.9, mp4a.E1"
    (MPEG-4 Visual Simple Profile Level 0 plus 13K voice)

     Note:  OTI value 20 ("0x20" in [MP4-Reg]) says "Includes
     associated Amendment(s) and Corrigendum(a).  The actual object
     types are defined in [MP4V] and are conveyed in the
     DecoderSpecificInfo as specified in [MP4V], Annex K."
     (references adjusted).

6. Additional Media Feature Details ✨

sometimes it's super helpful to give extra details about a media element, like how many X and Y pixels there are, the color depth, and so on 🌈 these are called "media features" or "media characteristics" πŸ’…

when you include those extra features, the [Content-Features] header is a handy way to do it 🫢

7. IANA Considerations 🧚

IANA has added "codecs" as an optional parameter to the media types listed in Section 3, with a reference to this document πŸ“

8. Security Considerations πŸ’€

The Codecs parameter itself does not change the security considerations of any of the media types it's used with πŸ”’ each audio and video media type has its own security considerations, and those still apply no matter whether you use the Codecs parameter or not πŸ›‘οΈ

an incorrect Codecs parameter might cause media content to be received by a device that can't render it, or might cause media content to not be sent to a device that could have received it 😱 that means an incorrect Codecs parameter can enable some types of denial-of-service attacks 🚨

still, this is most likely to happen by accident πŸ™ˆ an attacker who can change media data in transit could do way more damage by altering the media format itself, or even the content type header, rather than only the Codecs parameter in the content type header πŸ’€ so don't sleep on the bigger attack surface, bestie πŸ₯Ί

9. Acknowledgements 🫢

Harinath Garudadri gave a huge amount of help, and it is very much appreciated πŸ’– Mary Barnes and Bruce Lilly gave detailed and helpful comments 🌸 Sam Hartman, Russ Housley, and Bert Wijnen's reviews and comments were much appreciated πŸ™Œ Chris Newman carefully reviewed and improved the BNF πŸŽ€

10. Normative References πŸ“š

[Content-Features] Klyne, G., "Indicating Media Features for MIME
                   Content", RFC 2912, September 2000.

[KEYWORDS]         Bradner, S., "Key words for use in RFCs to
                   Indicate Requirement Levels", BCP 14, RFC 2119,
                   March 1997.

[MIME-Coding]      Freed, N. and K. Moore, "MIME Parameter Value and
                   Encoded Word Extensions: Character Sets,
                   Languages, and Continuations", RFC 2231, November
                   1997.

[MIME-Format]      Freed, N. and N. Borenstein, "Multipurpose
                   Internet Mail Extensions (MIME) Part One: Format
                   of Internet Message Bodies", RFC 2045, November
                   1996.

[Media-Features]   Holtman, K., Mutz, A., and T. Hardie, "Media
                   Feature Tag Registration Procedure", BCP 31, RFC
                   2506, March 1999.

[MP4-Reg]          MP4REG, The MPEG-4 Registration Authority, URL:
                   <http://www.mp4ra.org>.

11. Informative References πŸ”

[13k]              Gellens, R. and H. Garudadri, "The QCP File Format
                   and Media Types for Speech Data", RFC 3625,
                   September 2003.

[3GPP-Formats]     TS 26.244, Third Generation Partnership Project
                   (3GPP), "Transparent End-to-End Packet Switched
                   Streaming Service; 3GPP file format (3GP)", URL:
                   <http://www.3gpp.org/ftp/Specs/html-info/
                   26244.htm>.

[3GPP2-Formats]    Third Generation Partnership Project 2, "3GPP2
                   File Formats for Multimedia Service", URL:
                   <http://www.3gpp2.org/Public_html/specs/
                   C.S0050-0_v1.0_121503.pdf>.

[MP41]             ISO/IEC 14496-1:2004, "Information technology--
                   Coding of audio-visual objects--Part 1:  Systems".

[MP4A]             ISO/IEC 14496-3:2001, "Information technology--
                   Coding of audio-visual objects--Part 3:  Audio".

[MP4V]             ISO/IEC 14496-2:2004, "Information technology--
                   Coding of audio-visual objects--Part 2:  Visual".

Authors' Addresses πŸ–‹οΈ

Randall Gellens
QUALCOMM Incorporated
5775 Morehouse Drive
San Diego, CA  92121
USA

EMail: randy@qualcomm.com


David Singer
Apple Computer, Inc.
One Infinite Loop, MS:302-3MT
Cupertino  CA 95014
USA

EMail: singer@apple.com
Phone: +1 408 974 3162


Per Frojdh
Ericsson Research
Multimedia Technologies
SE-164 80 Stockholm, SWEDEN

EMail: Per.Frojdh@ericsson.com
Phone: +46 8 7190000

Copyright (C) The Internet Society (2005).

This document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the authors retain all their rights.

This document and the information contained herein are provided on an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

Intellectual Property πŸ’…

okay so the IETF is not picking a side on whether any intellectual property rights (IPR) apply to the tech in this doc, or whether anyone can actually get a license to use it. it also hasn't gone looking for those rights itself, so it's not claiming it knows what's out there 🫢 if you want the full rules on how rights work for RFCs, check out BCP 78 and BCP 79.

copies of IPR disclosures sent to the IETF Secretariat are available, along with any promises to license, or what happened when someone tried to get a general license or permission for implementers or users to use the proprietary stuff. you can find all of that in the IETF's online IPR repository at http://www.ietf.org/ipr πŸ—‚οΈβœ¨

and if you think there's a copyright, patent, patent application, or other proprietary right that might cover tech needed to implement this standard, the IETF wants to hear about it! send it to ietf-ipr@ietf.org πŸ“¬πŸ’œ

Acknowledgement πŸŽ€

the RFC Editor function is currently funded by the Internet Society 🌸 (the people behind the scenes keeping all these RFCs organised, bestie, so love that for them 🫢)

πŸ“¦ where this page comes from