tobinaka
1st February 2009, 01:45
I've found that Flash Player, and the players which use it, understands H.264/AVC video_full_range_flag and converts full-range YUV into RGB in the right way. This video_full_range_flag can be set by x264's VUI options "--fullrange on/off".
Not only in web browsers, you can play MP4 videos on Flash Player with such tools as FLV Player.
http://www.martijndevisser.com/blog/flv-player/
If you're or you can use Japanese, I recommend Flavie.
http://yakkun.com/other/flavie.htm
If you use AviSynth to convert RGB into YUV 4:2:0, you can convert into full-range YUV with the matrix options "pc.601" or "pc.709" while the default is TV-range "Rec601".
The image below will help you understand the right setting combination of AviSynth and x264.
http://www.tobinaka.com/files/matrix_fullrange2.bmp
The converting equations for analog YUV (Ey, Epb, Epr) and analog RGB (Er, Eg, Eb) is that:
Er = Ey + Epr * ( 1 - Kr ) * 2
Eg = Ey - { 2 * Kr * ( 1 - Kr ) / ( 1 - Kr - Kb ) } * Epr + { 2 * Kb * ( 1 - Kb ) / ( 1 - Kr - Kb ) } * Epb
Eb = Ey + Epb * ( 1 - Kb ) * 2
You see analog Y (Ey) directly remaining at analog RGB. The problem occurs when you want them to be digital.
If Y has 0-255 (full) scale and each of RGB has 0-255 (full ) scale, there is no problem.
If Y has 16-235 (TV) scale and each of RGB has 0-255 (full) scale, the converting gains the risk of banding (but it can be seen only with good LCD monitors maybe).
http://www.tobinaka.com/files/grayscale_rgb24.png the grayscale at the original AVI in RGB24
http://www.tobinaka.com/files/grayscale-rec-off.png Converting the grayscale with AviSynth ConvertToYV12(matrix="Rec601") and x264 --fullrange off
http://www.tobinaka.com/files/grayscale-pc-on.png Converting the grayscale with AviSynth ConvertToYV12(matrix="pc.601") and x264 --fullrange on
I don't know if Flash Player suppots the other VUI options nor how about other decoders and players. These are future issues.
Not only in web browsers, you can play MP4 videos on Flash Player with such tools as FLV Player.
http://www.martijndevisser.com/blog/flv-player/
If you're or you can use Japanese, I recommend Flavie.
http://yakkun.com/other/flavie.htm
If you use AviSynth to convert RGB into YUV 4:2:0, you can convert into full-range YUV with the matrix options "pc.601" or "pc.709" while the default is TV-range "Rec601".
The image below will help you understand the right setting combination of AviSynth and x264.
http://www.tobinaka.com/files/matrix_fullrange2.bmp
The converting equations for analog YUV (Ey, Epb, Epr) and analog RGB (Er, Eg, Eb) is that:
Er = Ey + Epr * ( 1 - Kr ) * 2
Eg = Ey - { 2 * Kr * ( 1 - Kr ) / ( 1 - Kr - Kb ) } * Epr + { 2 * Kb * ( 1 - Kb ) / ( 1 - Kr - Kb ) } * Epb
Eb = Ey + Epb * ( 1 - Kb ) * 2
You see analog Y (Ey) directly remaining at analog RGB. The problem occurs when you want them to be digital.
If Y has 0-255 (full) scale and each of RGB has 0-255 (full ) scale, there is no problem.
If Y has 16-235 (TV) scale and each of RGB has 0-255 (full) scale, the converting gains the risk of banding (but it can be seen only with good LCD monitors maybe).
http://www.tobinaka.com/files/grayscale_rgb24.png the grayscale at the original AVI in RGB24
http://www.tobinaka.com/files/grayscale-rec-off.png Converting the grayscale with AviSynth ConvertToYV12(matrix="Rec601") and x264 --fullrange off
http://www.tobinaka.com/files/grayscale-pc-on.png Converting the grayscale with AviSynth ConvertToYV12(matrix="pc.601") and x264 --fullrange on
I don't know if Flash Player suppots the other VUI options nor how about other decoders and players. These are future issues.