View Full Version : Is H.264/RGB playback generally supported?
pancserzso
18th June 2013, 00:52
I'm trying to convert an RGB image sequence to H.264, using x264.
My problem is that with any RGB->YUV conversion, colors change, and it's sometimes quite visible (especially on bright colors near the edges). Is there anything I can do with this without using RGB colorspace for encoding?
Do colors look a bit pale on all equipment, even on say high-end blu-ray players and projectors, or only on computer monitors working in RGB space?
My other question is that if I use `--output-csp rgb` with x264, which works wonderfully, but generates 2x size files, what are the limitations?
Is it possible to playback RGB H.264 files on any equipment, or only on PCs? LAV filters fall back to avcodec, but plays back the files fine. Is this generally supported on all software players, or it's more of an experimental feature?
vivan
18th June 2013, 04:04
My problem is that with any RGB->YUV conversion, colors change, and it's sometimes quite visible (especially on bright colors near the edges). Is there anything I can do with this without using RGB colorspace for encoding?Yes. The problem is, x264 always uses Rec601 for RGB -> YUV conversion, but for HD videos players use Rec709 for converting YUV back to RGB. That leads to slightly wrong colors.
You'll need to use Avisynth for correct RGB -> YUV conversion (using Rec709 matrix). Use this function:ConvertToYV12 (matrix = "Rec709")
My other question is that if I use `--output-csp rgb` with x264, which works wonderfully, but generates 2x size files, what are the limitations?
Is it possible to playback RGB H.264 files on any equipment, or only on PCs? LAV filters fall back to avcodec, but plays back the files fine. Is this generally supported on all software players, or it's more of an experimental feature?No, only some software players (on PC) support this. And there's no hardware players with support of such files.
pancserzso
18th June 2013, 04:59
Yes. The problem is, x264 always uses Rec601 for RGB -> YUV conversion, but for HD videos players use Rec709 for converting YUV back to RGB. That leads to slightly wrong colors.
You'll need to use Avisynth for correct RGB -> YUV conversion (using Rec709 matrix). Use this function:ConvertToYV12 (matrix = "Rec709")
Thanks! I tried that conversion, however I ended up with 4 different images and thus I started a separate thread:
http://forum.doom9.org/showthread.php?p=1633296#post1633296
(http://forum.doom9.org/showthread.php?p=1633296#post1633296)
OK, so this RGB encoding is a strictly PC only thing! Nice to know! So if both the source material is from PC and the destination is a PC, is this workflow considered to be the highest possible quality (in 8-bit)?
vivan
18th June 2013, 05:50
OK, so this RGB encoding is a strictly PC only thing! Nice to know! So if both the source material is from PC and the destination is a PC, is this workflow considered to be the highest possible quality (in 8-bit)?Well... kind of. x264 RGB encoding isn't as effective as YV12/YV24. You can try using pc-range YV24:
- in avisynth use ConvertToYV24 (matrix = "PC.709")
- for x264 add --input-range PC --output-csp i444
It's a bit less compatible, though (all renderers support rgb, but not all - YV24).
pancserzso
18th June 2013, 15:06
Well... kind of. x264 RGB encoding isn't as effective as YV12/YV24. You can try using pc-range YV24:
- in avisynth use ConvertToYV24 (matrix = "PC.709")
- for x264 add --input-range PC --output-csp i444
It's a bit less compatible, though (all renderers support rgb, but not all - YV24).
Thanks for this, it's amazingly more efficient! It takes only 10% more compared to YV12! RGB takes 130% more compared to YV12!
Small questions:
1. What is the difference between i444 and yv24 in x264? Shouldn't I use yv24 as it's supported by x264 --fullhelp?
2. Should I use the options --colorprim --transfer --colormatrix --range?
3. What is the difference between --range and --input-range and --input-csp and --output-csp? Are they the same usually?
sneaker_ger
18th June 2013, 16:55
3. What is the difference between --range and --input-range and --input-csp and --output-csp? Are they the same usually?
--input-range is the .. input range.
--range is the output range. (if input and output range differ, x264 will do a conversion.)
--input-csp is the input color space (without range or matrix info)
--output-csp is the output color space (without range or matrix info, if input and output csp differ x264 will do a conversion.)
Note that x264 defaults to --output-csp i420. --range will to default to the input-range.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.