Log in

View Full Version : Color changes using ConvertToYV12()


ag0n
10th August 2010, 19:28
Hello!
I've been trying to encode a litle clip. I need to use ConvertToYV12() when i am going to encode using megui(x264).
I've noticed the image becomes a bit gray as you can see.
http://i.imgur.com/MA4ft.jpg (the upper image comes from uncompressed footage)

A friend told me to use:
ConvertToYV12(matrix="PC.601") #matrix="PC.709"
It's better but i've got too much contrast now, comparing to uncompressed!
http://i.imgur.com/iCkCv.jpg (using matrix="PC.709" or 601, doesn't really matter)


Any ideas? All i need is to get the same colors as my input (uncompressed)

My avisynth script:
AVISource("Jere_NoRessample.avi")
Crop(0,0,-0,-0)
ConvertToYV12(matrix="PC.601") #matrix="PC.601"

sumawo13
10th August 2010, 21:55
Is your source HD? Try:
converttoyv12(matrix="rec709")
PC.709 should probably only be used if you're going to encode full range. Also your footage appears to be from a video game, if you used fraps, the footage is already fullrange, PC.### is meant for going from TV levels to PC levels. If you use it on PC levels it will make the image more dark.

ag0n
10th August 2010, 23:34
Is your source HD? Try:
converttoyv12(matrix="rec709")
PC.709 should probably only be used if you're going to encode full range. Also your footage appears to be from a video game, if you used fraps, the footage is already fullrange, PC.### is meant for going from TV levels to PC levels. If you use it on PC levels it will make the image more dark.

Hello. Thanks for answering.
The footage comes from Sony Vegas edition. The raw footage comes from Enemy Territory (a quake3 engine based game), the game have his own recorder (we can export every frame as a .tga).

I've tried what you said, but it's still a bit "gray" :|
Compare both pictures:
http://i.imgur.com/haXSx.jpg

Look that box color... or even the curve...


:'(

J_Darnley
11th August 2010, 00:13
Is your source HD? Try:
converttoyv12(matrix="rec709")
PC.709 should probably only be used if you're going to encode full range. Also your footage appears to be from a video game, if you used fraps, the footage is already fullrange, PC.### is meant for going from TV levels to PC levels. If you use it on PC levels it will make the image more dark.

No it won't. The PC* matrices don't change the range/levels.

ag0n
11th August 2010, 00:57
No it won't. The PC* matrices don't change the range/levels.

what do you suggest to fix this litle problem then? :|

sumawo13
11th August 2010, 01:12
No it won't. The PC* matrices don't change the range/levels.

If I use rec601/709 on full range video it appears to keep the same levels, however if I use pc.601/709 the image darkens.

RGB32 Source
http://a.imagehost.org/t/0989/source.jpg (http://a.imagehost.org/view/0989/source)

Rec601
http://a.imagehost.org/t/0043/rec601.jpg (http://a.imagehost.org/view/0043/rec601)

PC.601
http://a.imagehost.org/t/0440/pc601.jpg (http://a.imagehost.org/view/0440/pc601)

Rec709
http://f.imagehost.org/t/0842/rec709.jpg (http://f.imagehost.org/view/0842/rec709)

PC.709
http://f.imagehost.org/t/0647/pc709.jpg (http://f.imagehost.org/view/0647/pc709)

However, if I convert back to RGB within Avisynth, rather than letting VirtualDub handle the conversion, I get correct levels:

PC.601 back to RGB32
http://f.imagehost.org/t/0553/pc601backtorgb.jpg (http://f.imagehost.org/view/0553/pc601backtorgb)

PC.709 back to RGB32
http://i.imagehost.org/t/0351/pc709backtorgb.jpg (http://i.imagehost.org/view/0351/pc709backtorgb)

J_Darnley
11th August 2010, 01:13
Use rec709 or pc709 and --fullrange on

If I use rec601/709 on full range video it appears to keep the same levels, however if I use pc.601/709 the image darkens.

However, if I convert back to RGB within Avisynth, rather than letting VirtualDub handle the conversion, I get correct levels:


SHOCKING! When you use the correct matrix everything is fine!

ag0n
11th August 2010, 02:20
if i use rec709 my image becomes a bit grayish :| i will render a clip soon!


edit: http://beta-gaming.de/et/ag0n/ComuMovie/Jere_NoRessample_REC709.mkv kinda gray!

jpsdr
11th August 2010, 09:09
Is there somewhere where i can find all the transformations formula for YCbCr <-> RGB convertions for rec, pc, 709 etc...
Thanks.

Gavino
11th August 2010, 10:35
Is there somewhere where i can find all the transformations formula for YCbCr <-> RGB convertions for rec, pc, 709 etc...
For description of 'matrix' parameter:
http://avisynth.org/mediawiki/Convert

For details of formula and calculations:
http://avisynth.org/mediawiki/Color_conversions

jpsdr
11th August 2010, 11:32
Thanks for the links.
I've made a little seach, and it seems that BT.601, BT.470 and SMPTE 170M have the same matrix coefficients for color conversion.
Can someone confirm me this please ?

J_Darnley
11th August 2010, 11:44
if i use rec709 my image becomes a bit grayish :| i will render a clip soon!


edit: http://beta-gaming.de/et/ag0n/ComuMovie/Jere_NoRessample_REC709.mkv kinda gray!

Looks fine to me

ag0n
11th August 2010, 11:50
Looks fine to me

it might be "fine" but doesn't look like how it should be!

Check the example:
- the left one was taken from megui preview (using matrix=rec709)
- the right one was taken from sony vegas, uncompressed
http://i.imgur.com/4q506.jpg
- check the box color, or even the curve between the gun and the box. The color is kinda different, less intense and it's very noticiable the "gray layer" at the box.

Didée
11th August 2010, 12:17
POSSOTUS.

(Post a short sample of the unprocessed source.)

ag0n
11th August 2010, 13:41
POSSOTUS.

(Post a short sample of the unprocessed source.)

I took a 1s uncompressed! And it's 110mb, sorry for that! If you need anything longer, tell me!

I've tried to understand if it is a decoding problem, but doesn't seem like that to be honest.

If you can, take some shots. You will notice the box doesn't look the same :|


Cheers and thanks for your help.


http://beta-gaming.de/et/ag0n/ComuMovie/sample_uncompressed.avi

pandy
11th August 2010, 13:41
It looks like shifted Cb Cr planes - not aligned with luma Y plane - wrong offset for data?

ag0n
11th August 2010, 13:58
It looks like shifted Cb Cr planes - not aligned with luma Y plane - wrong offset for data?

what do you suggest to get the situation fixed? :<

poisondeathray
11th August 2010, 14:30
Works fine for me. How are you taking screenshots ?

you probably have issues with either your decoder (for h.264) , or your renderer if you are viewing in a media player

e.g. if you use the same renderer, it looks the same. If you open the original .avs, and one with converttoyv12() in the same application e.g. avsp, it looks the same. And when encoded with x264, it still looks the same

If you use a different application, it may do the YV12=>RGB (for display or screenshots) differently , so you have to be consistent


- the left one was taken from megui preview (using matrix=rec709)
- the right one was taken from sony vegas, uncompressed


Vegas' preview doesn't display properly and will decode to RGB with different scaling depending on the input format, and project settings (8-bit vs. 32-bit). This has been discussed before and is a very very long discussion.

Summary : there is no problem

ag0n
11th August 2010, 14:46
Works fine for me. How are you taking screenshots ?

you probably have issues with either your decoder (for h.264) , or your renderer if you are viewing in a media player

e.g. if you use the same renderer, it looks the same. If you open the original .avs, and one with converttoyv12() in the same application e.g. avsp, it looks the same. And when encoded with x264, it still looks the same

If you use a different application, it may do the YV12=>RGB (for display or screenshots) differently , so you have to be consistent


Vegas' preview doesn't display properly and will decode to RGB with different scaling depending on the input format, and project settings (8-bit vs. 32-bit). This has been discussed before and is a very very long discussion.

Summary : there is no problem

Well i am comparing a screenshot taken from vegas at full quality, and the preview from megui (when i click to open the avisynth script)

"you probably have issues with either your decoder (for h.264) , or your renderer if you are viewing in a media player"

- mm...the megui preview looks the same as inside media player classic (i use coreavc 2.0 + k-lite mega codec pack + media player classic to watch the videos, using haali decoder).

this is my vegas settings: http://i.imgur.com/ETDOj.png

Conclusion? Vegas is tricking me? Any idea to get it looking the same inside megui and vegas? i kinda like what i see in vegas!

poisondeathray
11th August 2010, 14:49
Vegas has been disscussed a few times here and on other forums . The short of it is: It's small preview window isn't accurate, and different from what you actually get upon export. It depends on projects settings, input format and export format.

ag0n
11th August 2010, 15:08
Vegas has been disscussed a few times here and on other forums . The short of it is: It's small preview window isn't accurate, and different from what you actually get upon export. It depends on projects settings, input format and export format.

damn vegas :[

I am exporting as uncompressed .avi. Same fps and resolution as vegas settings.
Importing a avi from vdub (i resize and set the fps there, i also add lagarith with default settings).

Thanks for your answer. Guess i'm gonna have to live with that, already added some extra contrast to fix the gray zones, gonna keep using the matrix=rec709.

poisondeathray
11th August 2010, 15:39
The way vegas handles things is quite convoluted.

But just a quick pointer, if you want your export to look more like what your small vegas preview is showing with uncompressed RGB input, use 8-bit project settings and video levels , and export RGB image sequence like png.

Vegas' preview window uses desktop graphics settings (based on GDI interface) , this is different than what media players use by default (overlay mixer - which uses graphics card overlay settings, but not the desktop settings)

ag0n
11th August 2010, 17:44
The way vegas handles things is quite convoluted.

But just a quick pointer, if you want your export to look more like what your small vegas preview is showing with uncompressed RGB input, use 8-bit project settings and video levels , and export RGB image sequence like png.

Vegas' preview window uses desktop graphics settings (based on GDI interface) , this is different than what media players use by default (overlay mixer - which uses graphics card overlay settings, but not the desktop settings)

Vegas have so many bugs :|

What about use 32bits full range with 2.222 gama settings (8bits forces 2.222 gama so it could make some sense no?) ????

I've tried to take a look at preview settings @vegas... there is not much to change, except activate "rgb 16-235 preview" or a different color profile... both doesn't make sense since i have everything on default!

Guess i'm gonna start learning how to live with that :|

poisondeathray
11th August 2010, 18:49
You also have to look at the export format. Vegas will change the handling for different formats, even with same internal settings. e.g. if you import uncompressed RGB but switch between the modes, the preview doesn't change, but the exported image sequenes changes drastically.

It works for what I suggested above. Other export formats it may change the behaviour.

How you have the graphics card settings for desktop display also affects the small window preview

Remember, the application used to view afterward may handle YV12 differently. It has to be converted to RGB for display, but different decoders, renders and their settings may display the exact same video differently. YV12<=>RGB conversions can cause a lot of grief.

Anyways, none of this has to do with avisynth. It does what you tell it to do. So I suggest you search the forum (and others), as I have posted links to various articles on how vegas handles colorspace. Also do some tests for yourself.

Nevilne
11th August 2010, 20:18
I use 8bit 2.222 gamma in vegas and output rgb via debugmode frameserver, then in avisynth script i use yv12 rec709, 100% accurate colours in output.

pandy
12th August 2010, 08:40
what do you suggest to get the situation fixed? :<

Hmmm... i have only onee thing on mind - issues with environment or hardware (maybe driver?)

ag0n
13th August 2010, 21:27
I use 8bit 2.222 gamma in vegas and output rgb via debugmode frameserver, then in avisynth script i use yv12 rec709, 100% accurate colours in output.

Sounds like a good idea to me..

I've downloaded this "plugin" and it doesn't work :|

1st i get this: http://i.imgur.com/m4Xqi.png

and if i press try again, vegas stop working and i get this error detail:

Problem Description
Application Name: Vegas Pro
Application Version: Version 9.0c (Build 896)
Problem: Unmanaged Exception (0xc0000005)
Fault Module: C:\Windows\SysWOW64\ntdll.dll
Fault Address: 0x77424EB9
Fault Offset: 0x00064EB9

Fault Process Details
Process Path: C:\Program Files (x86)\Sony\Vegas Pro 9.0\vegas90.exe
Process Version: Version 9.0c (Build 896)
Process Description: Vegas Pro
Process Image Date: 2009-10-26 (Mon Oct 26) 09:41:04



Any idea? I've read that "bug board" and it seems to be in waiting list to be fixed :|