Log in

View Full Version : Flash Player supports H.264's full range flag (x264 --fullrange on)


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.

Docholo
24th April 2009, 04:25
:confused:

I can't reproduce this success using my tools. I made
a movie full of studio rgb test patterns and then fed
it to x264 using this avisynth script:
>DirectshowSource("c:\test.avi")
>ConvertToYV12(matrix="pc.601")

The file out_fullrange_off.mp4 came from the x264 command
line
x264 test.avs -o out_fullrange_off.mp4 --bitrate=60 --fullrange off
and the file out_fullrange_on.mp4 came from the x264
command line
x264 test.avs -o out_fullrange_on.mp4 --bitrate=60 --fullrange off

When I look at these two files in FLV player both of them
look identical and wrong. For comparison I made a
regular compressed luminance file out_rec601.mp4
using
>DirectshowSource("c:\test.avi")
>ConvertToYV12(matrix="rec601")
and
x264 test.avs -o out_rec601.mp4 --bitrate=60
and this file looks correct, luminance wise, in all players.

Is there some sort of problem that involves my video
card doing the yuv conversion or new versions of flash
not listening to the fullrange flag?

Dark Shikari
24th April 2009, 07:01
The file out_fullrange_off.mp4 came from the x264 command
line
x264 test.avs -o out_fullrange_off.mp4 --bitrate=60 --fullrange off
and the file out_fullrange_on.mp4 came from the x264
command line
x264 test.avs -o out_fullrange_on.mp4 --bitrate=60 --fullrange offHurfdurf?

benwaggoner
24th April 2009, 17:17
Hmmm. Are there any sample files anywhere encoded with this feature? I should give them a test in Silverlight 3.

Docholo
25th April 2009, 02:06
Hurfdurf?
I had trouble writing the post properly to the forum but I
encoded the files correctly. I also have done this
test about three times and remaking the command line
from scratch with the same non result.

Hmmm. Are there any sample files anywhere encoded with this feature? I should give them a test in Silverlight 3.

See the attached files out_fullrange_on.zip and out_fullrange_off.zip. Or you can make them yourself
with your favorite media and the "--fullrange on"
and "--fullrange off" flags.

I invite anyone to encode their favorite test media with
the "--fullrange on" and "--fullrange off" flags and
post them here as well. I would really like to see the
Flash Player or any player process change how it
displays the video.

floz23
17th July 2009, 03:53
*mistake* sorry.