Log in

View Full Version : Why the output file is yuv colorspcae while using rgb csp


edison
30th September 2014, 16:49
command line: "x264_64.exe" "i:\123.avs" --input-csp bgra24 --output-csp rgb --crf 0 --output "i:\cb.mkv"

General
Complete name : I:\cb.mkv
Format : Matroska
Format version : Version 2
File size : 6.58 MiB
Duration : 1mn 13s
Overall bit rate : 752 Kbps
Writing application : x264 r2431 ac76440
Writing library : Haali Matroska Writer b0

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High 4:4:4 Predictive@L3.1
Format settings, CABAC : Yes
Format settings, ReFrames : 3 frames
Codec ID : V_MPEG4/ISO/AVC
Duration : 1mn 13s
Bit rate : 737 Kbps
Width : 1 024 pixels
Height : 768 pixels
Display aspect ratio : 4:3
Frame rate mode : Constant
Frame rate : 30.000 fps
Color space : YUV
Chroma subsampling : 4:4:4
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.031
Stream size : 6.44 MiB (98%)
Writing library : x264 core 142 r2431 ac76440
Language : English
Default : Yes
Forced : No
Matrix coefficients : RGB

Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=0 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=0 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc=cqp / mbtree=0 / qp=0

nevcairiel
30th September 2014, 17:28
Thats just Media Info being mad, it says "Matrix coefficients : RGB" at the bottom, which indicates it did what you asked. Note that many players suffer from this problem, and may not be able to play such files properly either.

Keiyakusha
30th September 2014, 18:04
Isn't x264 encodes RGB by mapping each color channel to some YUV plane? like R=Y G=U B=V (might be different order)? And RGB itself is reconstructed on decoding? If so, what mediainfo reports is correct and technically it is YUV.

nevcairiel
30th September 2014, 18:14
Its not YUV.
Yes, it is encoded as separate RGB planes, similar to how YUV is encoded, but why would it be YUV just because of this? It specifically says in the headers that its not YUV, but RGB, claiming its YUV is just wrong inoformation, and will give you a wrong picture, too.

Keiyakusha
30th September 2014, 19:53
Yes, it is encoded as separate RGB planes

Well, this is not exactly what I mean. It may not be true of course, which is your answer suggests in general, but...
I always thought that RGB in x264 is a real YUV 4:4:4 where RGB channels are separated, each of them losslessly converted into one of the YUV planes, which results in a weird-looking but correct YUV stream. And on decode this process is reversed (and when it's not - this is when we're getting weird results). For example avisynth command ShowGreen("YV12") does similar thing I am talking about. It puts green channel into Y-plane of YV12 stream. Of course it is possible to reverse that later.
Don't quite remember where I got this idea... somewhere on this forum years ago.

Anyway, I'm fine with it being normal RGB, that's even better.

nevcairiel
1st October 2014, 06:47
It is encoded the same way as YUV would be, sure, and any player that doesn't know any better would try to treat it like YUV and show a funky image. But its still actual RGB in the stream.