]> git.sesse.net Git - x264/blob - doc/vui.txt
Revise the row VBV algorithm
[x264] / doc / vui.txt
1 Video Usability Information (VUI) Guide
2 by Christian Heine ( sennindemokrit at gmx dot net )
3
4 1. Sample Aspect Ratio
5 -----------------------
6
7 * What is it?
8     The Sample Aspect Ratio (SAR) (sometimes called Pixel Aspect Ratio or just
9     Pel Aspect Ratio) is defined as the ratio of the width of the sample to the
10     height of the sample. While pixels on a computer monitor generally are
11     "square" meaning that their SAR is 1:1, digitized video usually has rather
12     odd SARs. Playback of material with a particular SAR on a system with
13     a different SAR will result in a stretched/squashed image. A correction is
14     necessary that relies on the knowledge of both SARs.
15
16 * How do I use it?
17     You can derive the SAR of an image from the width, height and the
18     display aspect ratio (DAR) of the image as follows:
19
20     SAR_x   DAR_x * height
21     ----- = --------------
22     SAR_y   DAR_y * width
23
24     for example:
25     width x height = 704x576, DAR = 4:3 ==> SAR = 2304:2112 or 12:11
26
27     Please note that if your material is a digitized analog signal, you should
28     not use this equation to calculate the SAR. Refer to the manual of your
29     digitizing equipment or this link instead.
30
31     A Quick Guide to Digital Video Resolution and Aspect Ratio Conversions
32     http://www.iki.fi/znark/video/conversion/
33
34 * Should I use this option?
35     In one word: yes. Most decoders/ media players nowadays support automatic
36     correction of aspect ratios, and there are just few exceptions. You should
37     even use it, if the SAR of your material is 1:1, as the default of x264 is
38     "SAR not defined".
39
40 2. Overscan
41 ------------
42
43 * What is it?
44     The term overscan generally refers to all regions of an image that do
45     not contain information but are added to achieve a certain resolution or
46     aspect ratio. A "letterboxed" image therefore has overscan at the top and
47     the bottom. This is not the overscan this option refers to. Neither refers
48     it to the overscan that is added as part of the process of digitizing an
49     analog signal. Instead it refers to the "overscan" process on a display
50     that shows only a part of the image. What that part is depends on the
51     display.
52
53 * How do I use this option?
54     As I'm not sure about what part of the image is shown when the display uses
55     an overscan process, I can't provide you with rules or examples. The safe
56     assumption would be "overscan=show" as this always shows the whole image.
57     Use "overscan=crop" only if you are sure about the consequences. You may
58     also use the default value ("undefined").
59
60 * Should I use this option?
61     Only if you know exactly what you are doing. Don't use it on video streams
62     that have general overscan. Instead try to to crop the borders before
63     encoding and benefit from the higher bitrate/ image quality.
64
65     Furthermore the H264 specification says that the setting "overscan=show"
66     must be respected, but "overscan=crop" may be ignored. In fact most
67     playback equipment ignores this setting and shows the whole image.
68
69 3. Video Format
70 ----------------
71
72 * What is it?
73     A purely informative setting, that explains what the type of your analog
74     video was, before you digitized it.
75
76 * How do I use this option?
77     Just set it to the desired value. ( e.g. NTSC, PAL )
78     If you transcode from MPEG2, you may find the value for this option in the
79     m2v bitstream. (see ITU-T Rec. H262 / ISO/IEC 13818-2 for details)
80
81 * Should I use this option?
82     That is entirely up to you. I have no idea how this information would ever
83     be relevant. I consider it to be informative only.
84
85 4. Full Range
86 --------------
87
88 * What is it?
89     Another relic from digitizing analog video. When digitizing analog video
90     the digital representation of the luma and chroma levels is limited to lie
91     within 16..235 and 16..240 respectively. Playback equipment usually assumes
92     all digitized samples to be within this range. However most DVDs use the
93     full range of 0..255 for luma and chroma samples, possibly resulting in an
94     oversaturation when played back on that equipment. To avoid this a range
95     correction is needed.
96
97 * How do I use this option?
98     If your source material is a digitized analog video/TV broadcast it is
99     quite possible that it is range limited. If you can make sure that it is
100     range limited you can safely set full range to off. If you are not sure
101     or want to make sure that your material is played back without
102     oversaturation, set if to on. Please note that the default for this option
103     in x264 is off, which is not a safe assumption.
104
105 * Should I use this option?
106     Yes, but there are few decoders/ media players that distinguish
107     between the two options.
108
109 5. Color Primaries, Transfer Characteristics, Matrix Coefficients
110 -------------------------------------------------------------------
111
112 * What is it?
113     A videophile setting. The average users won't ever need it.
114     Not all monitor models show all colors the same way. When comparing the
115     same image on two different monitor models you might find that one of them
116     "looks more blue", while the other "looks more green". Bottom line is, each
117     monitor model has a different color profile, which can be used to correct
118     colors in a way, that images look almost the same on all monitors. The same
119     goes for printers and film/ video digitizing equipment. If the color
120     profile of the digitizing equipment is known, it is possible to correct the
121     colors and gamma of the decoded h264 stream in a way that the video stream
122     looks the same, regardless of the digitizing equipment used.
123
124 * How do I use these options?
125     If you are able to find out which characteristics your digitizing equipment
126     uses, (see the equipment documentation or make reference measurements)
127     then find the most suitable characteristics in the list of available
128     characteristics (see H264 Annex E) and pass it to x264. Otherwise leave it
129     to the default (unspecified).
130     If you transcode from MPEG2, you may find the values for these options in
131     the m2v bitstream. (see ITU-T Rec. H262 / ISO/IEC 13818-2 for details)
132
133 * Should I use these options?
134     Only if you know exactly what you are doing. The default setting is better
135     than a wrong one. Use of this option is not a bad idea though.
136     Unfortunately I don't know any decoder/ media player that ever even
137     attempted color/gamma/color matrix correction.
138
139 6. Chroma Sample Location
140 --------------------------
141
142 * What is it?
143     A videophile setting. The average user won't ever notice a difference.
144     Due to a weakness of the eye, it is often economic to reduce the number of
145     chroma samples in a process called subsampling. In particular x264 uses
146     only one chroma sample of each chroma channel every block of 2x2 luma
147     samples. There are a number of possibilities on how this subsampling is
148     done, each resulting in another relative location of the chroma sample
149     towards the luma samples. The Chroma Sample Location matters when the
150     subsampling process is reversed, e.g. the number of chroma samples is
151     increased. This is most likely to happen at color space conversions. If it
152     is not done correctly the chroma values may appear shifted compared to the
153     luma samples by at most 1 pixel, or strangely blurred.
154
155 * How do I use this option?
156     Because x264 does no subsampling, since it only accepts already subsampled
157     input frames, you have to determine the method yourself.
158
159     If you transcode from MPEG1 with proper subsampled 4:2:0, and don't do any
160     color space conversion, you should set this option to 1.
161     If you transcode from MPEG2 with proper subsampled 4:2:0, and don't do any
162     color space conversion, you should set this option to 0.
163     If you transcode from MPEG4 with proper subsampled 4:2:0, and don't do any
164     color space conversion, you should set this option to 0.
165
166     If you do the color space conversion yourself this isn't that easy. If the
167     filter kernel of the subsampling is ( 0.5, 0.5 ) in one direction then the
168     chroma sample location in that direction is between the two luma samples.
169     If your filter kernel is ( 0.25, 0.5, 0.25 ) in one direction then the
170     chroma sample location in that direction is equal to one of the luma
171     samples. H264 Annex E contains images that tell you how to "transform" your
172     Chroma Sample Location into a value of 0 to 5 that you can pass to x264.
173
174 * Should I use this option?
175     Unless you are a perfectionist, don't bother. Media players ignore this
176     setting, and favor their own (fixed) assumed Chroma Sample Location.
177