PDA

View Full Version : Color shift using x.264


langman10
18th October 2007, 07:50
Hello all -

I'm learning to use x.264 and love what great encodes it gives in terms of compression. Unfortunately, the encodes x.264 gives me seem to have a color shift or gamma shift.

My source is a None-compressed 23.976fps 952x536 quicktime file, 1:39.

I bring this file into Avisynth with:

QTInput("x:\sourcequicktime.mov", color=2, mode=0, audio=true)
AssumeFPS(23.976)
converttoyv12()

first pass commandline:
--pass 1 --bitrate 1500 --stats "C:\myscript.stats" --keyint 72 --bframes 3 --b-pyramid --direct auto --filter -2,-1 --subme 1 --analyse none --qpmax 40 --vbv-maxrate 25000 --me dia --threads auto --thread-input --progress --no-dct-decimate --no-psnr --no-ssim --output NUL "C:\myscript.avs"

second pass commandline:
--pass 2 --bitrate 1500 --stats "C:\myscript.stats" --keyint 72 --ref 5 --mixed-refs --no-fast-pskip --bframes 3 --b-pyramid --b-rdo --bime --weightb --direct auto --filter -2,-1 --subme 6 --trellis 1 --analyse all --8x8dct --qpmax 40 --vbv-maxrate 25000 --me umh --threads auto --thread-input --progress --no-dct-decimate --no-psnr --no-ssim --output "E:\result.mp4" "C:\myscript.avs"

Specs:
Dell PWS650 Xeon 2.66Ghz 3.5GB RAM WinXP Pro Version 2002 SP2
I'm using the most recent version of megui which has updated x.264 to "680 - Cef's build". Avisynth version 2.56. Quicktime 7.1.6.

here's the source:
http://img86.imageshack.us/img86/2516/source2hm1.th.jpg (http://img86.imageshack.us/my.php?image=source2hm1.jpg)

here's the result from x.264:
http://img518.imageshack.us/img518/5637/x2642cu9.th.jpg (http://img518.imageshack.us/my.php?image=x2642cu9.jpg)

After a lot of testing, I can see that the color shift does not happen in the Avisynth script. But I can't find anywhere in x.264 where I might have borked the color settings. A similar encode from Apple's Compressor doesn't have the color shift. Any ideas appreciated.

Langman10

bond
20th October 2007, 21:29
moved

lexor
20th October 2007, 21:47
how about decoding, what are you using?
- if ffdshow check if your Levels tab is enabled. If yes disable it to get original picture.
- if coreavc check if Input/Output are set to PC/TV (or auto/auto). If yes set to PC/PC.

Both are adjusting levels to 16-240 (235 for coreavc) range (which matches range of common DVD, ect)

Sagekilla
21st October 2007, 01:48
Just curious but do you need ConvertToYV12() for it to work properly?

langman10
29th November 2007, 03:31
For what it's worth:

I believe the issue was in QTInput's parameters Color=2, Mode=0 because this brought on an extra colorspace change. The source file was an RGB QT, QTInput's Color=2 means "bring in as YUY2", and then finally to YV12 that x264 needs (and yes, it's x264 that needs the YV12, Sagekilla.) I was forced to use Color=2, Mode=0 because none of the other combinations were even close due to errors or tiling or slanting or severe color changes or whatever. I solved this by creating an RGB AVI from QTPro and then bringing that into x264, which was fine since the video was short.

Sagekilla
29th November 2007, 04:05
For what it's worth:

I believe the issue was in QTInput's parameters Color=2, Mode=0 because this brought on an extra colorspace change. The source file was an RGB QT, QTInput's Color=2 means "bring in as YUY2", and then finally to YV12 that x264 needs (and yes, it's x264 that needs the YV12, Sagekilla.) I was forced to use Color=2, Mode=0 because none of the other combinations were even close due to errors or tiling or slanting or severe color changes or whatever. I solved this by creating an RGB AVI from QTPro and then bringing that into x264, which was fine since the video was short.

Thanks, I was actually wondering about whether the .mov input had to be converted to YV12 first or not, not what input x264 requires. Guess .movs do require a colorspace conversion first though.

Razorholt
30th November 2007, 01:40
how about tweak() ?

langman10
30th November 2007, 19:08
how about tweak() ?

I figured, yes I could adjust using tweak() by eye until I had the image back to the original, but I was hoping to avoid that.