Log in

View Full Version : Decimal CQ in Xvid?


mitsubishi
3rd May 2007, 13:29
Hi, this is probably something everyone else already knows, but I wanted to try a decimal cq value to see if I could get a decent compromise between 2&3. MeGUI doesn't allow this, perhaps because it shouldn't be used.

I used this command line:
xvid_encraw -i "J:\New Folder (7)\AR.avs" -single -cq 2.1 -smoother 0 -max_key_interval 250 -nopacked -vhqmode 4 -closed_gop -lumimasking -imin 3 -imax 5 -pmin 3 -pmax 5 -max_bframes 2 -bvhq -bquant_ratio 162 -bquant_offset 0 -bmin 3 -bmax 5 -threads 2 -avi "J:\New Folder (7)\TESTS\q2a.avi"
(etc)

on this script:

DGDecode_mpeg2source("J:\New Folder (7)\TimeShift_05-01 00-44-45.d2v",cpu=4)
edeintted = last.SeparateFields().SelectEven().EEDI2(field=-1)
TDeint(full=false,edeint=edeintted)
crop( 4, 2, -4, -2)

LanczosResize(608,336) # Lanczos (Sharp)
Undot() # Minimal Noise

__film = last
__t0 = __film.trim(6303, 6778)
__t0

And then used this script to compare.

a=Import("J:\New Folder (7)\AR.avs")
b=AVISource("J:\New Folder (7)\TESTS\q8.avi")
return ssim(a,b,"results8.csv","averageSSIM8.txt",lumimask=true)

And got this result:

CQ Size SSIM Filename
2.0 4,237,824 55.11 q2.avi
2.1 4,025,344 30.34 q2a.avi
2.2 3,813,888 30.35 q2b.avi
2.3 3,629,568 30.32 q2c.avi
2.4 3,401,728 30.29 q2d.avi
2.5 3,262,464 30.26 q2e.avi
2.6 3,067,904 30.23 q2f.avi
2.7 2,902,528 30.16 q2g.avi
2.8 2,793,472 30.10 q2h.avi
2.9 2,669,568 29.98 q2i.avi
3.0 2,579,968 29.86 q3.avi
8.0 719,872 25.94 q8.avi
24.0 386,048 17.96 q24.avi

The SSIMs seem low anyway.

So I have two questions.


1) Is my testing method flawed?
2) Is decimal CQ values pointless since they seem to only increase filesize?

Thanks.

sysKin
3rd May 2007, 14:51
1) Is my testing method flawed?
Probably, as SSIM is way too low. Did you use bframes? If so, did you trim initial delay frame from xvid?

2) Is decimal CQ values pointless since they seem to only increase filesize?

But they decrease it O_O
Everything seems to be fine, and decimal CQ obviously works as intended.

mitsubishi
3rd May 2007, 15:44
Probably, as SSIM is way too low. Did you use bframes? If so, did you trim initial delay frame from xvid?
No, I didn't realise I had too... meant to have a look in a stack aswell.

Changed the test script to:
a=Import("J:\New Folder (7)\AR.avs").trim(0,399)
b=AVISource("J:\New Folder (7)\TESTS\q2b.avi").trim(1,400) #.FlipVertical()
return ssim(a,b,"resultsb.csv","averageSSIMb.txt",lumimask=true)

And the SSIMs are now more where they should be, cheers.



But they decrease it O_O
Everything seems to be fine, and decimal CQ obviously works as intended.


Yeah the file sizes were as expected, but the quality analysis made it look like 2.1 was barely better than 3, but with a 2.0 like filesize.

Anyway, thanks, now I've fixed the script, I get this

2.0 4,237,824 87.59 q2.avi
2.2 3,813,888 86.89 q2b.avi
2.4 3,401,728 86.13 q2d.avi
2.6 3,067,904 85.43 q2f.avi
2.8 2,793,472 84.72 q2h.avi
3.0 2,579,968 83.79 q3.avi
8.0 719,872 64.98 q8.avi

Which is much more like it, and I can see the relationship now.