Payload Working Group | P. Westin |
Internet-Draft | H. Lundin |
Intended status: Standards Track | M. Glover |
Expires: September 4, 2015 | J. Uberti |
F. Galligan | |
March 3, 2015 |
RTP Payload Format for VP8 Video
draft-ietf-payload-vp8-14
This memo describes an RTP payload format for the VP8 video codec. The payload format has wide applicability, as it supports applications from low bit-rate peer-to-peer usage, to high bit-rate video conferences.
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."
This Internet-Draft will expire on September 4, 2015.
Copyright (c) 2015 IETF Trust and the persons identified as the document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
This memo describes an RTP payload specification applicable to the transmission of video streams encoded using the VP8 video codec [RFC6386]. The format described in this document can be used both in peer-to-peer and video conferencing applications.
VP8 is based on decomposition of frames into square sub-blocks of pixels, prediction of such sub-blocks using previously constructed blocks, and adjustment of such predictions (as well as synthesis of unpredicted blocks) using a discrete cosine transform (hereafter abbreviated as DCT). In one special case, however, VP8 uses a "Walsh-Hadamard" (hereafter abbreviated as WHT) transform instead of a DCT. An encoded VP8 frame is divided into two or more partitions, as described in [RFC6386]. The first partition (prediction or mode) contains prediction mode parameters and motion vectors for all macroblocks. The remaining partitions all contain the quantized DCT/WHT coefficients for the residuals. There can be 1, 2, 4, or 8 DCT/WHT partitions per frame, depending on encoder settings.
In summary, the payload format described in this document enables a number of features in VP8, including:
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].
The VP8 codec uses three different reference frames for interframe prediction: the previous frame, the golden frame, and the altref frame. Blocks in an interframe may be predicted using blocks in the immediately previous frame as well as the most recent golden frame or altref frame. Every key frame is automatically golden and altref, and any interframe may optionally replace the most recent golden or altref frame. Golden frames and altref frames may also be used to increase the tolerance to dropped frames. The payload specification in this memo has elements that enable advanced use of the reference frames, e.g., for improved loss robustness.
One specific use case of the three reference frame types is temporal scalability. By setting up the reference hierarchy in the appropriate way, up to five temporal layers can be encoded. (How to set up the reference hierarchy for temporal scalability is not within the scope of this memo.)
Another property of the VP8 codec is that it applies data partitioning to the encoded data. Thus, an encoded VP8 frame can be divided into two or more partitions, as described in "VP8 Data Format and Decoding Guide" [RFC6386]. The first partition (prediction or mode) contains prediction mode parameters and motion vectors for all macroblocks. The remaining partitions all contain the transform coefficients for the residuals. The first partition is decodable without the remaining residual partitions. The subsequent partitions may be useful even if some part of the frame is lost. This memo allows the partitions to be sent separately or in the same RTP packet. It may be beneficial for decoder error-concealment to send the partitions in different packets, even though it is not mandatory according to this specification.
The format specification is described in Section 4. In Section 5, a method to acknowledge receipt of reference frames using RTCP techniques is described.
The payload partitioning and the acknowledging method both serve as motivation for three of the fields included in the payload format: the "PID", "1st partition size" and "PictureID" fields. The ability to encode a temporally scalable stream motivates the "TL0PICIDX" and "TID" fields.
This section describes how the encoded VP8 bitstream is encapsulated in RTP. To handle network losses usage of RTP/AVPF [RFC4585] is RECOMMENDED. All integer fields in the specifications are encoded as unsigned integers in network octet order.
The general RTP payload format for VP8 is depicted below.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |V=2|P|X| CC |M| PT | sequence number | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | timestamp | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | synchronization source (SSRC) identifier | +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ | contributing source (CSRC) identifiers | | .... | +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ | VP8 payload descriptor (integer #bytes) | : : | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | : VP8 payload header (3 octets) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | VP8 pyld hdr : | +-+-+-+-+-+-+-+-+ | : Bytes 4..N of VP8 payload : | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | : OPTIONAL RTP padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The VP8 payload descriptor and VP8 payload header will be described in the sequel. OPTIONAL RTP padding MUST NOT be included unless the P bit is set.
Figure 1
The first octets after the RTP header are the VP8 payload descriptor, with the following structure. The single-octet version of the PictureID is illustrated to the left (M bit set to zero), while the dual-octet version (M bit set to one) is show to the right.
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ |X|R|N|S|R| PID | (REQUIRED) |X|R|N|S|R| PID | (REQUIRED) +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ X: |I|L|T|K| RSV | (OPTIONAL) X: |I|L|T|K| RSV | (OPTIONAL) +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ I: |M| PictureID | (OPTIONAL) I: |M| PictureID | (OPTIONAL) +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ L: | TL0PICIDX | (OPTIONAL) | PictureID | +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ T/K: |TID|Y| KEYIDX | (OPTIONAL) L: | TL0PICIDX | (OPTIONAL) +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ T/K: |TID|Y| KEYIDX | (OPTIONAL) +-+-+-+-+-+-+-+-+
Figure 2
When the X bit is set to 1 in the first octet, the extension bit field octet MUST be provided as the second octet. If the X bit is 0, the extension bit field octet MUST NOT be present, and all bits below MUST be implicitly interpreted as 0.
After the extension bit field follow the extension data fields that are enabled.
The beginning of an encoded VP8 frame is referred to as an "uncompressed data chunk" in [RFC6386], and co-serve as payload header in this RTP format. The codec bitstream format specifies two different variants of the uncompressed data chunk: a 3 octet version for interframes and a 10 octet version for key frames. The first 3 octets are common to both variants. In the case of a key frame the remaining 7 octets are considered to be part of the remaining payload in this RTP format. Note that the header is present only in packets which have the S bit equal to one and the PID equal to zero in the payload descriptor. Subsequent packets for the same frame do not carry the payload header.
0 1 2 3 4 5 6 7 +-+-+-+-+-+-+-+-+ |Size0|H| VER |P| +-+-+-+-+-+-+-+-+ | Size1 | +-+-+-+-+-+-+-+-+ | Size2 | +-+-+-+-+-+-+-+-+ | Bytes 4..N of | | VP8 payload | : : +-+-+-+-+-+-+-+-+ | OPTIONAL RTP | | padding | : : +-+-+-+-+-+-+-+-+
Figure 3
An encoded VP8 frame can be divided into two or more partitions, as described in Section 1. One packet can contain a fragment of a partition, a complete partition, or an aggregate of fragments and partitions. In the preferred use case, the S bit and PID fields described in Section 4.2 should be used to indicate what the packet contains. The PID field should indicate which partition the first octet of the payload belongs to, and the S bit indicates that the packet starts on a new partition. Aggregation of encoded partitions is done without explicit signaling. Partitions MUST be aggregated in decoding order. Two fragments from different partitions MAY be aggregated into the same packet. An aggregation MUST have exactly one payload descriptor. Aggregated partitions MUST represent parts of one and the same video frame. Consequently, an aggregated packet will have one or no payload header, depending on whether the aggregate contains the beginning of the first partition of a frame or not, respectively. Note that the length of the first partition can always be obtained from the first partition size parameter in the VP8 payload header.
The VP8 bitstream format [RFC6386] specifies that if multiple DCT/WHT partitions are produced, the location of each partition start is found at the end of the first (prediction/mode) partition. In this RTP payload specification, the location offsets are considered to be part of the first partition.
It is OPTIONAL for a packetizer implementing this RTP specification to pay attention to the partition boundaries within an encoded frame. If packetization of a frame is done without considering the partition boundaries, the PID field MAY be set to zero for all packets, and the S bit MUST NOT be set to one for any other packet than the first.
Example of frame reconstruction algorithm.
Example of partition reconstruction algorithm.
A few examples of how the VP8 RTP payload can be used are included below.
0 1 2 3 4 5 6 7 +-+-+-+-+-+-+-+-+ | RTP header | | M = 1 | +-+-+-+-+-+-+-+-+ |1|0|0|1|0|0 0 0| X = 1; S = 1; PID = 0 +-+-+-+-+-+-+-+-+ |1|0|0|0|0 0 0 0| I = 1 +-+-+-+-+-+-+-+-+ |0 0 0 1 0 0 0 1| PictureID = 17 +-+-+-+-+-+-+-+-+ |Size0|1| VER |0| P = 0 +-+-+-+-+-+-+-+-+ | Size1 | +-+-+-+-+-+-+-+-+ | Size2 | +-+-+-+-+-+-+-+-+ | VP8 payload | +-+-+-+-+-+-+-+-+
0 1 2 3 4 5 6 7 +-+-+-+-+-+-+-+-+ | RTP header | | M = 1 | +-+-+-+-+-+-+-+-+ |0|0|0|1|0|0 0 0| X = 0; S = 1; PID = 0 +-+-+-+-+-+-+-+-+ |Size0|1| VER |1| P = 1 +-+-+-+-+-+-+-+-+ | Size1 | +-+-+-+-+-+-+-+-+ | Size2 | +-+-+-+-+-+-+-+-+ | VP8 payload | +-+-+-+-+-+-+-+-+
First RTP packet; complete first partition.
0 1 2 3 4 5 6 7 +-+-+-+-+-+-+-+-+ | RTP header | | M = 0 | +-+-+-+-+-+-+-+-+ |1|0|0|1|0|0 0 0| X = 1; S = 1; PID = 0 +-+-+-+-+-+-+-+-+ |1|0|0|0|0 0 0 0| I = 1 +-+-+-+-+-+-+-+-+ |0 0 0 1 0 0 0 1| PictureID = 17 +-+-+-+-+-+-+-+-+ |Size0|1| VER |1| P = 1 +-+-+-+-+-+-+-+-+ | Size1 | +-+-+-+-+-+-+-+-+ | Size2 | +-+-+-+-+-+-+-+-+ | Bytes 4..L of | | first VP8 | | partition | : : +-+-+-+-+-+-+-+-+
Second RTP packet; complete second partition.
0 1 2 3 4 5 6 7 +-+-+-+-+-+-+-+-+ | RTP header | | M = 1 | +-+-+-+-+-+-+-+-+ |1|0|0|1|0|0 0 1| X = 1; S = 1; PID = 1 +-+-+-+-+-+-+-+-+ |1|0|0|0|0 0 0 0| I = 1 +-+-+-+-+-+-+-+-+ |0 0 0 1 0 0 0 1| PictureID = 17 +-+-+-+-+-+-+-+-+ | Remaining VP8 | | partitions | : : +-+-+-+-+-+-+-+-+
First RTP packet; complete first partition.
0 1 2 3 4 5 6 7 +-+-+-+-+-+-+-+-+ | RTP header | | M = 0 | +-+-+-+-+-+-+-+-+ |1|0|0|1|0|0 0 0| X = 1; S = 1; PID = 0 +-+-+-+-+-+-+-+-+ |1|0|0|0|0 0 0 0| I = 1 +-+-+-+-+-+-+-+-+ |0 0 0 1 0 0 0 1| PictureID = 17 +-+-+-+-+-+-+-+-+ |Size0|1| VER |1| P = 1 +-+-+-+-+-+-+-+-+ | Size1 | +-+-+-+-+-+-+-+-+ | Size2 | +-+-+-+-+-+-+-+-+ | Complete | | first | | partition | : : +-+-+-+-+-+-+-+-+
Second RTP packet; first fragment of second partition.
0 1 2 3 4 5 6 7 +-+-+-+-+-+-+-+-+ | RTP header | | M = 0 | +-+-+-+-+-+-+-+-+ |1|0|0|1|0|0 0 1| X = 1; S = 1; PID = 1 +-+-+-+-+-+-+-+-+ |1|0|0|0|0 0 0 0| I = 1 +-+-+-+-+-+-+-+-+ |0 0 0 1 0 0 0 1| PictureID = 17 +-+-+-+-+-+-+-+-+ | First fragment| | of second | | partition | : : +-+-+-+-+-+-+-+-+
Third RTP packet; second fragment of second partition.
0 1 2 3 4 5 6 7 +-+-+-+-+-+-+-+-+ | RTP header | | M = 0 | +-+-+-+-+-+-+-+-+ |1|0|0|0|0|0 0 1| X = 1; S = 0; PID = 1 +-+-+-+-+-+-+-+-+ |1|0|0|0|0 0 0 0| I = 1 +-+-+-+-+-+-+-+-+ |0 0 0 1 0 0 0 1| PictureID = 17 +-+-+-+-+-+-+-+-+ | Mid fragment | | of second | | partition | : : +-+-+-+-+-+-+-+-+
Fourth RTP packet; last fragment of second partition.
0 1 2 3 4 5 6 7 +-+-+-+-+-+-+-+-+ | RTP header | | M = 1 | +-+-+-+-+-+-+-+-+ |1|0|0|0|0|0 0 1| X = 1; S = 0; PID = 1 +-+-+-+-+-+-+-+-+ |1|0|0|0|0 0 0 0| I = 1 +-+-+-+-+-+-+-+-+ |0 0 0 1 0 0 0 1| PictureID = 17 +-+-+-+-+-+-+-+-+ | Last fragment | | of second | | partition | : : +-+-+-+-+-+-+-+-+
PictureID = 4711 = 001001001100111 binary (first 7 bits: 0010010, last 8 bits: 01100111).
0 1 2 3 4 5 6 7 +-+-+-+-+-+-+-+-+ | RTP header | | M = 1 | +-+-+-+-+-+-+-+-+ |1|0|0|1|0|0 0 0| X = 1; S = 1; PID = 0 +-+-+-+-+-+-+-+-+ |1|0|0|0|0 0 0 0| I = 1; +-+-+-+-+-+-+-+-+ |1 0 0 1 0 0 1 0| Long PictureID flag = 1 |0 1 1 0 0 1 1 1| PictureID = 4711 +-+-+-+-+-+-+-+-+ |Size0|1| VER |1| +-+-+-+-+-+-+-+-+ | Size1 | +-+-+-+-+-+-+-+-+ | Size2 | +-+-+-+-+-+-+-+-+ | Bytes 4..N of | | VP8 payload | : : +-+-+-+-+-+-+-+-+
The VP8 payload descriptor defined in Section 4.2 above contains an optional PictureID parameter. This parameter is included mainly to enable use of reference picture selection index (RPSI) and slice loss indication (SLI), both defined in [RFC4585].
The reference picture selection index is a payload-specific feedback message defined within the RTCP-based feedback format. The RPSI message is generated by a receiver and can be used in two ways. Either it can signal a preferred reference picture when a loss has been detected by the decoder -- preferably then a reference that the decoder knows is perfect -- or, it can be used as positive feedback information to acknowledge correct decoding of certain reference pictures. The positive feedback method is useful for VP8 used as unicast. The use of RPSI for VP8 is preferably combined with a special update pattern of the codec's two special reference frames -- the golden frame and the altref frame -- in which they are updated in an alternating leapfrog fashion. When a receiver has received and correctly decoded a golden or altref frame, and that frame had a PictureID in the payload descriptor, the receiver can acknowledge this simply by sending an RPSI message back to the sender. The message body (i.e., the "native RPSI bit string" in [RFC4585]) is simply the PictureID of the received frame.
The slice loss indication is another payload-specific feedback message defined within the RTCP-based feedback format. The SLI message is generated by the receiver when a loss or corruption is detected in a frame. The format of the SLI message is as follows [RFC4585]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | First | Number | PictureID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 4
Here, First is the macroblock address (in scan order) of the first lost block and Number is the number of lost blocks. PictureID is the six least significant bits of the codec-specific picture identifier in which the loss or corruption has occurred. For VP8, this codec-specific identifier is naturally the PictureID of the current frame, as read from the payload descriptor. If the payload descriptor of the current frame does not have a PictureID, the receiver MAY send the last received PictureID+1 in the SLI message. The receiver MAY set the First parameter to 0, and the Number parameter to the total number of macroblocks per frame, even though only parts of the frame is corrupted. When the sender receives an SLI message, it can make use of the knowledge from the latest received RPSI message. Knowing that the last golden or altref frame was successfully received, it can encode the next frame with reference to that established reference.
The use of RPSI and SLI is best illustrated in an example. In this example, the encoder may not update the altref frame until the last sent golden frame has been acknowledged with an RPSI message. If an update is not received within some time, a new golden frame update is sent instead. Once the new golden frame is established and acknowledged, the same rule applies when updating the altref frame.
Event | Sender | Receiver | Established reference |
---|---|---|---|
1000 | Send golden frame PictureID = 0 | ||
Receive and decode golden frame | |||
1001 | Send RPSI(0) | ||
1002 | Receive RPSI(0) | golden | |
... | (sending regular frames) | ||
1100 | Send altref frame PictureID = 100 | ||
Altref corrupted or lost | golden | ||
1101 | Send SLI(100) | golden | |
1102 | Receive SLI(100) | ||
1103 | Send frame with reference to golden | ||
Receive and decode frame (decoder state restored) | golden | ||
... | (sending regular frames) | ||
1200 | Send altref frame PictureID = 200 | ||
Receive and decode altref frame | golden | ||
1201 | Send RPSI(200) | ||
1202 | Receive RPSI(200) | altref | |
... | (sending regular frames) | ||
1300 | Send golden frame PictureID = 300 | ||
Receive and decode golden frame | altref | ||
1301 | Send RPSI(300) | altref | |
1302 | RPSI lost | ||
1400 | Send golden frame PictureID = 400 | ||
Receive and decode golden frame | altref | ||
1401 | Send RPSI(400) | ||
1402 | Receive RPSI(400) | golden |
Note that the scheme is robust to loss of the feedback messages. If the RPSI is lost, the sender will try to update the golden (or altref) again after a while, without releasing the established reference. Also, if an SLI is lost, the receiver can keep sending SLI messages at any interval allowed by the RTCP sending timing restrictions as specified in [RFC4585], as long as the picture is corrupted.
This payload format has two required parameters.
This registration is done using the template defined in [RFC6838] and following [RFC4855].
The receiver MUST ignore any fmtp parameter unspecified in this memo.
The media type video/VP8 string is mapped to fields in the Session Description Protocol (SDP) [RFC4566] as follows:
An example of media representation in SDP is as follows:
m=video 49170 RTP/AVPF 98
a=rtpmap:98 VP8/90000
a=fmtp:98 max-fr=30; max-fs=3600;
The VP8 codec offers a decode complexity that is roughly linear with the number of pixels encoded. The parameters "max-fr" and "max-fs" are defined in Section 6.1, where the macroblock size is 16x16 pixels as defined in [RFC6386], the max-fs and max-fr parameters MUST be used to establish these limits.
RTP packets using the payload format defined in this specification are subject to the security considerations discussed in the RTP specification [RFC3550], and in any applicable RTP profile. The main security considerations for the RTP packet carrying the RTP payload format defined within this memo are confidentiality, integrity and source authenticity. Confidentiality is achieved by encryption of the RTP payload. Integrity of the RTP packets through suitable cryptographic integrity protection mechanism. Cryptographic system may also allow the authentication of the source of the payload. A suitable security mechanism for this RTP payload format should provide confidentiality, integrity protection and at least source authentication capable of determining if an RTP packet is from a member of the RTP session or not. Note that the appropriate mechanism to provide security to RTP and payloads following this memo may vary. It is dependent on the application, the transport, and the signaling protocol employed. Therefore a single mechanism is not sufficient, although if suitable the usage of SRTP [RFC3711] is recommended. This RTP payload format and its media decoder do not exhibit any significant non-uniformity in the receiver-side computational complexity for packet processing, and thus are unlikely to pose a denial-of-service threat due to the receipt of pathological data. Nor does the RTP payload format contain any active content.
Congestion control for RTP SHALL be used in accordance with RFC 3550 [RFC3550], and with any applicable RTP profile; e.g., RFC 3551 [RFC3551]. The congestion control mechanism can, in a real-time encoding scenario, adapt the transmission rate by instructing the encoder to encode at a certain target rate. Media aware network elements MAY use the information in the VP8 payload descriptor in Section 4.2 to identify non-reference frames and discard them in order to reduce network congestion. Note that discarding of non-reference frames cannot be done if the stream is encrypted (because the non-reference marker is encrypted).
The IANA is requested to register the following values:
- Media type registration as described in Section 6.1.