Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
13th December 2011, 14:46 | #1 | Link |
Registered User
Join Date: Dec 2011
Posts: 14
|
How can I understand yuv-rgb file
Hi,
When I look into a video file with using mediainfo,there is a information about yuv.But when I analysis the video file's frames in matlab each pixels have a value between 1-255(I know 8bit rgb has values between this intervals). Now I confused ,what is my video files color format;yuv or rgb? How can I understand this? |
13th December 2011, 15:44 | #2 | Link |
Registered User
Join Date: Dec 2002
Location: UK
Posts: 1,673
|
MATLAB is converting the YUV video to RGB when loading?
Why do you want this in MATLAB? AVIsynth is better suited to video processing, while a 1Mbps XviD is hardly a good source for the kind of academic research you might undertake in MATLAB. Cheers, David. |
13th December 2011, 23:51 | #3 | Link | |
Registered User
Join Date: Dec 2011
Posts: 14
|
First of all I want to learn that -when we look into my video properties shown in picture,can we say video color is yuv?
and Quote:
|
|
14th December 2011, 02:00 | #5 | Link |
Registered User
Join Date: May 2006
Posts: 957
|
YUV is the common, quicker way to type Y'CbCr which is this colourspace: http://en.wikipedia.org/wiki/Y%27CbCr
4:2:0 is the chroma sub-sampling used: http://en.wikipedia.org/wiki/Chroma_subsampling 8-bit means how many bits per sample are used, almost: http://en.wikipedia.org/wiki/Color_depth As for what happens when you load this file into your program, who knows? It is compressed, so you could be reading it without decoding; or reading the output of the decoder which should as mediainfo describes the file in which case it is more likely to be 16-235 luma and 16-240 chroma; or it has been converted to RGB for display in which case it is likely to be 0-255.
__________________
x264 log explained || x264 deblocking how-to preset -> tune -> user set options -> fast first pass -> profile -> level Doom10 - Of course it's better, it's one more. Last edited by J_Darnley; 14th December 2011 at 02:09. |
14th December 2011, 15:21 | #6 | Link |
Registered User
Join Date: Dec 2011
Posts: 14
|
Thanks for help.
I newly leared that Matlab decompress my video and convert color space to RGB.Before I say Matlab looks like useless ,I want to try something else.It is that try to convert each pixel's RGB value to YUV.I have new question here; I will calc y,u,v values using this formulas, Y = 0.299R + 0.587G + 0.114B U = -0.147R - 0.289G + 0.436B V = 0.615R - 0.515G - 0.100B for example. my first pixel's RGB value is 128.So R=128,G=B=0, From there Y=38,U=18.86,V=78.72. At this point How will I express first pixel's yuv value using this y-u-v values? |
14th December 2011, 15:53 | #7 | Link | |
Registered User
Join Date: May 2006
Posts: 957
|
Quote:
If you mean "how do I do this in matlab?", then I have no idea. How does it store the RGB data? A simplistic example is to read one byte for red, one for green and one for blue, then convert to yuv and use as you necessary.
__________________
x264 log explained || x264 deblocking how-to preset -> tune -> user set options -> fast first pass -> profile -> level Doom10 - Of course it's better, it's one more. |
|
14th December 2011, 17:09 | #9 | Link |
Registered User
Join Date: May 2006
Posts: 957
|
Oh, you mean as one value. Similar to the often seen hex values for RGB colours, e.g. FF0000 being red. I guess you could express YUV in a similar manner but I don't think I've seen it done elsewhere.
If you want to do this, a strict addition is wrong. For 8-bit: (R<<16) + (G<<8) + B
__________________
x264 log explained || x264 deblocking how-to preset -> tune -> user set options -> fast first pass -> profile -> level Doom10 - Of course it's better, it's one more. |
14th December 2011, 18:40 | #10 | Link | |
Guest
Join Date: Jan 2002
Posts: 21,901
|
Quote:
If you are going to make up u and v values, then you are effectively upsampling the chroma and there are lots of ways to do it. |
|
14th December 2011, 21:22 | #11 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
Of course, there all the pixels are the same color, so the issue of chroma subsampling does not arise. |
|
14th December 2011, 22:23 | #12 | Link | |
Registered User
Join Date: Dec 2011
Posts: 14
|
Quote:
If the answer is yes I ask this question again to do with Avisynth because matlab seems useless. Which color space and script (yuv or rgb or yCbCr) will reach me to the best conclusion for my test videos to compare different codecs??. Thanks again Last edited by challanger; 14th December 2011 at 23:07. |
|
14th December 2011, 23:40 | #13 | Link |
Registered User
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,407
|
From what I understand PSNR and other "quality metrics" are not a good way to measure codec quality. For example psy opimizations look better to humans but make PSNR etc. worse.
That said I assume doing one converson to RGB is better than doing YUV->RGB->YUV. Make sure you are doing the right YUV to RGB conversion, eg rec.601 or rec.709. You could also do the conversion to RGB in Avisynth where you probably have more control over it. Video is always converted to RGB at display so this isn't wrong IMO. I don't really understand what you mean by "one number pixel value". Even going RGB->YUV 4:4:4 gives you three bytes per pixel. I guess you could concatenate the Y' byte, U byte, and V byte like RGB is sometimes expressed but no one would expect it. |
15th December 2011, 11:44 | #14 | Link |
Registered User
Join Date: Dec 2002
Location: UK
Posts: 1,673
|
Google MATLAB PSNR for a start.
How should PSNR handle chroma? Do you have specifications/documentation? The scripts I found just do greyscale, which isn't much use in the real world. How does the MATLAB function you're using for video handle different colour spaces etc? Have you checked its documentation? Is it just using DirectShow filters? Cheers, David. |
Tags |
yuv rgb |
Thread Tools | Search this Thread |
Display Modes | |
|
|