OggYUV4MPEG: Difference between revisions

From XiphWiki
Jump to navigation Jump to search
(Start a page for the Ogg encapsulation of YUV4MPEG)
 
m (Added {{draft}})
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{draft}}
This is a draft spec for encapsulation of the YUV4MPEG2 uncompressed video format in Ogg. This is is primarily useful for multiplexing it with audio for transmission through a single pipe.
This is a draft spec for encapsulation of the YUV4MPEG2 uncompressed video format in Ogg. This is is primarily useful for multiplexing it with audio for transmission through a single pipe.


= Introduction =
= Introduction =


The YUV4MPEG format was created and defined by the linux audio/video tools package. It is a combination of text-based headers and 'raw' frame data. This is just an informational summary. See the lav-tools documentation for the complete definition.
The YUV4MPEG format was created and defined by the linux audio/video tools package. It is a combination of text-based headers and 'raw' frame data. This is just an informational summary. See [http://mjpeg.cvs.sourceforge.net/mjpeg/mjpeg_play/lavtools/ lavtools] or [http://wiki.multimedia.cx/index.php?title=YUV4MPEG2 this documentation] for the complete definition. These files often have the filename extension .y4m.


A YUV4MPEG file begins with a single text line which defined the stream parameters like image size, framerate, chroma subsampling and so on. For example:
A YUV4MPEG file begins with a single text line which defined the stream parameters like image size, framerate, chroma subsampling and so on. For example:


'''YUV4MPEG2 W352 H288 F30000:1001 Ip A128:117'''
YUV4MPEG2 W352 H288 F30000:1001 Ip A128:117
 
says that this is a yuv4mpeg2 file with 352x288 progressive frames at 29.97 fps (CIF) and matching pixel aspect ratio. Note that the order and locations of the various data in the header packet are arbitrary and must be parsed as text. Each field is prefixed by a single character which defines the field type. The initial space after YUV4MPEG2 is required.
 
This header is followed by a sequence of frames. Each frame has a text header "FRAME\n", followed by the raw frame data, a plane at a time, in binary.
 
= Encapsulation =
 
The first line of a YUV4MPEG stream is the initial packet. Because this line must always start with the 8 character sequence 'YUV4MPEG', this can serve for codec identification, and also contains all the relevent decoder setup data. This is the only header packet and should appear on the first page by itself, with the bos flag set.
 
Each successive frame, consisting of the 'FRAME' text line followed by the binary data for one frame, is placed into an Ogg packet.
 
The granulepos field is set based on the count of encoded frames since the beginning of the stream. Thus the first, stream header packet gets a granulepos value of 0, the second packet, containing the first frame gets a granulepos value of 1, and successive frames get a values of 2, 3, 4 and so on until the end of the stream. The last page an encoder produces SHOULD have the eos flag set to indicate encapsulation of the complete data stream. A decoder MUST NOT treat a missing eos flag as an error.
 
= Multiplexing =
 
An Ogg-encapsulated YUV4MPEG stream may be multiplexed with other data according to the standard rules. The granulepos may be converted to a timestamp by dividing the granulepos value by the framerate, given as a rational number in the 'F' field of the header packet.


This header is followed by a sequence of frames. Each frame has a text header "FRAME", followed by the raw frame data, a plane at a time, in binary.
[[Category:Ogg Mappings]]

Latest revision as of 07:11, 21 August 2015


This is a draft spec for encapsulation of the YUV4MPEG2 uncompressed video format in Ogg. This is is primarily useful for multiplexing it with audio for transmission through a single pipe.

Introduction

The YUV4MPEG format was created and defined by the linux audio/video tools package. It is a combination of text-based headers and 'raw' frame data. This is just an informational summary. See lavtools or this documentation for the complete definition. These files often have the filename extension .y4m.

A YUV4MPEG file begins with a single text line which defined the stream parameters like image size, framerate, chroma subsampling and so on. For example:

YUV4MPEG2 W352 H288 F30000:1001 Ip A128:117

says that this is a yuv4mpeg2 file with 352x288 progressive frames at 29.97 fps (CIF) and matching pixel aspect ratio. Note that the order and locations of the various data in the header packet are arbitrary and must be parsed as text. Each field is prefixed by a single character which defines the field type. The initial space after YUV4MPEG2 is required.

This header is followed by a sequence of frames. Each frame has a text header "FRAME\n", followed by the raw frame data, a plane at a time, in binary.

Encapsulation

The first line of a YUV4MPEG stream is the initial packet. Because this line must always start with the 8 character sequence 'YUV4MPEG', this can serve for codec identification, and also contains all the relevent decoder setup data. This is the only header packet and should appear on the first page by itself, with the bos flag set.

Each successive frame, consisting of the 'FRAME' text line followed by the binary data for one frame, is placed into an Ogg packet.

The granulepos field is set based on the count of encoded frames since the beginning of the stream. Thus the first, stream header packet gets a granulepos value of 0, the second packet, containing the first frame gets a granulepos value of 1, and successive frames get a values of 2, 3, 4 and so on until the end of the stream. The last page an encoder produces SHOULD have the eos flag set to indicate encapsulation of the complete data stream. A decoder MUST NOT treat a missing eos flag as an error.

Multiplexing

An Ogg-encapsulated YUV4MPEG stream may be multiplexed with other data according to the standard rules. The granulepos may be converted to a timestamp by dividing the granulepos value by the framerate, given as a rational number in the 'F' field of the header packet.