1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
|
.TH "yuv4mpeg" "5" "25 November 2002" "MJPEG Tools Team" "MJPEG Tools Manual"
.SH "NAME"
YUV4MPEG2 \- video stream format used by pipe-based MJPEGtools
.hw libmjpegutils yuv4mpeg.h YUV4MPEG YUV4MPEG2
.SH "DESCRIPTION"
.PP
Many of the MJPEGtools communicate via pipes and act as filters
(or sources or sinks). The format of video data used in the pipes is
referred to as "YUV4MPEG", or, more precisely, "YUV4MPEG2". (The format
was extended and codified during v1.5.x of the tools.)
.PP
The basic structure is a stream header followed by an unlimited number of
frames. Each frame itself consists of a header followed by video data.
The headers are vaguely human-readable ASCII, but the video data is simple
byte-size binary.
.PP
The MJPEGtools distribution has a C library (libmjpegutils) which contains
functions for manipulating YUV4MPEG2 streams. We recommend that you use
this library rather than writing your own code if possible. See the header
file "yuv4mpeg.h" for a description of these functions.
.PP
Design Goals:
.IP o
Easy to parse both via C or sh.
.IP o
Extensible; easy to add new parameters while maintaining backwards
compatibility.
.IP o
Simple upgrade from original "YUV4MPEG" format.
.PP
Drawbacks:
.IP o
Frame headers do not have constant size, so streams are not seekable.
.SH "GRAMMAR"
The precise description of the the YUV4MPEG2 stream format is as follows:
.PP
\fISTREAM\fP consists of
.IP - 3
one \fISTREAM-HEADER\fP
.IP - 3
unlimited number of \fIFRAME\fPs
.PP
\fISTREAM-HEADER\fP consists of
.IP - 3
magic string "YUV4MPEG2"
.IP - 3
unlimited number of \fITAGGED-FIELD\fPs,
each preceeded by a '\ ' (single space) separator
.IP - 3
single '\en' line terminator
.PP
\fIFRAME\fP consists of
.IP - 3
one \fIFRAME-HEADER\fP
.IP - 3
"length" octets of planar YCbCr 4:2:0 image data
(If the stream is interlaced, then the two fields per frame are interleaved,
with proper spatial ordering.)
.PP
\fIFRAME-HEADER\fP consists of
.IP - 3
magic string "FRAME"
.IP - 3
unlimited number of \fITAGGED-FIELD\fPs,
each preceeded by a '\ ' (single space) separator
.IP - 3
single '\en' line terminator
.PP
.I \fITAGGED-FIELD\fP
consists of
.IP - 3
single ASCII character tag
.IP - 3
\fIVALUE\fP (which does not contain whitespace)
.PP
\fIVALUE\fP
consists of
.IP - 3
\fIRATIO\fP,
.B or
.IP - 3
integer (base 10 ASCII representation),
.B or
.IP - 3
single ascii character,
.B or
.IP - 3
string (multiple ASCII characters)
.PP
\fIRATIO\fP
consists of
.IP - 3
numerator (base 10 ASCII integer)
.IP - 3
\&':' (a colon)
.IP - 3
denominator (base 10 ASCII integer)
.PP
Header tags fall into three categories: \fBoptional\fP, \fBrequired\fP and
\fBhas-default\fP.
Optional tags are completely optional and may be omitted from a header.
Required tags must be present in a header. Has-Default tags have a default
value which is implied if the tag is not present.
Independent of these categories, some tags allow an "unknown" value and
some do not.
.PP
The supported tags for the \fISTREAM-HEADER\fP:
.RS
.HP
W[integer]\ \-\ frame width in pixels, must be > 0 (\fBrequired\fP)
.HP
H[integer]\ \-\ frame height in pixels, must be > 0 (\fBrequired\fP)
.HP
C[string]\ \-\ chroma subsampling, image data format (\fBhas default\fP)
.RS
420jpeg\ \-\ 4:2:0 with JPEG/MPEG-1 siting (default)
420mpeg2\ \-\ 4:2:0 with MPEG-2 siting
420paldv\ \-\ 4:2:0 with PAL-DV siting
411\ \-\ 4:1:1, cosited
422\ \-\ 4:2:2, cosited
444\ \-\ 4:4:4 (no subsampling)
444alpha\ \-\ 4:4:4 with an alpha channel
mono\ \-\ luma (Y') plane only
.RE
.HP
I[char]\ \-\ interlacing specification: (\fBhas default\fP)
.RS
?\ \-\ unknown (default)
p\ \-\ progressive/none
t\ \-\ top-field-first
b\ \-\ bottom-field-first
m\ \-\ mixed-mode: refer to 'I' tag in frame header
.RE
.HP
F[ratio]\ \-\ frame-rate (\fBhas default\fP of 0:0 == unknown)
.HP
A[ratio]\ \-\ sample aspect ratio (\fBhas default\fP of 0:0 == unknown)
.HP
X[string]\ \-\ 'metadata' (\fBoptional\fP; unparsed, but passed around)
.RE
.PP
The currently supported tags for the \fIFRAME-HEADER\fP:
.RS
.HP
I[string]\ \-\ framing and sampling (\fBrequired if-and-only-if\fP Im is
present in stream header). Value is a string of three characters "xyz"
which have the following meanings:
.RS
x: frame presentation
t\ \-\ top-field-first
T\ \-\ top-field-first and repeat
b\ \-\ bottom-field-first
B\ \-\ bottom-field-first and repeat
1\ \-\ single progressive frame
2\ \-\ double progressive frame (repeat)
3\ \-\ triple progressive frame (repeat)
y: frame temporal sampling
p\ \-\ progressive (fields sampled at same time)
i\ \-\ interlaced (fields sampled at different times)
z: frame chroma-subsampling
p\ \-\ progressive (subsampling over whole frame)
i\ \-\ interlaced (each field subsampled independently)
?\ \-\ unknown (allowed only for non-4:2:0 subsampling)
.RE
.HP
X[string]\ \-\ 'metadata' (\fBoptional\fP; unparsed, but passed around)
.RE
.PP
Note that a filter application must faithfully forward all "X" tags from
input pipe to output pipe (unless it uses one of those tags, of course).
The supplied library will do this automatically if the functions
y4m_copy_stream_info() and y4m_copy_frame_info() are used appropriately.
.SH "NOTES ON IMAGE DATA"
.PP
All image data is in the CCIR-601 Y'CbCr colorspace, presented plane-by-plane
in row-major order.
Each sample within each plane is one octet (8-bits) in size.
When all planes are present, they are transmitted in the order Y', Cb, Cr,
potentially followed by an alpha/transparency mask plane (for the
\fB444alpha\fP chroma format). The alpha channel data is follows the same
range as the Y' luma channel: full transparency is at 16 and full opacity
is at 235.
All Y' and alpha planes consist of (height\ X\ width) octets.
The size of the chroma planes depends on the subsampling mode:
.IP - 3
4:4:4 - (height\ X\ width) octets
.IP - 3
4:2:2 - (height\ X\ width)\ /\ 2 octets
.IP - 3
4:1:1 - (height\ X\ width)\ /\ 4 octets
.IP - 3
4:2:0 - (height\ X\ width)\ /\ 4 octets
.SH "NOTES ON FRAMING"
.PP
(More to come here.)
.SH "SEE ALSO"
.BR mjpegtools (1),
yuv4mpeg.h
.SH "AUTHOR"
This manual page Copyright 2004 Matthew J. Marjanovic.
|