vui.txt 8.5 KB

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