Log in

View Full Version : xvid maximum quality


juGGaKNot
5th September 2013, 18:21
Found a very old encoding app ( bat to exe ) that i made a long time ago ( around x264 r1100 ) and i gave it a try to compare with the current one, i got :

xvidcore build version: xvid-1.2.2
Bitstream version: 1.2.2
Detected CPU flags: ASM MMX MMXEXT SSE SSE2 SSE3 SSE41 TSC
Detected 2 cpus, using 2 threads.
1431 frames( 99%) encoded, 39.18 fps, Average Bitrate = 8511kbps
Tot: enctime(ms) =36897.00, length(bytes) = 63846355
Avg: enctime(ms) = 25.62, fps = 39.03, length(bytes) = 44337
I frames: 162 frames, size = 88116/14274867, quants = 2 / 2.00 / 2
P frames: 689 frames, size = 57968/39940335, quants = 2 / 2.00 / 2
B frames: 587 frames, size = 16407/9631153, quants = 3 / 3.00 / 3

And my current version :

xvid [info]: xvidcore build version: xvid-1.2.2
xvid [info]: Bitstream version: 1.2.2
xvid [info]: Detected CPU flags: ASM MMX MMXEXT SSE SSE2 TSC
xvid [info]: Detected cpus = 2, threads requested = 2, threads in use = 2
xvid [info]: Threaded input reading active
1431 frames( 99%) encoded, 28.90 fps, Average Bitrate = 7042kbps
Tot: enctime(ms) =49781.00, length(bytes) = 52807504
Avg: enctime(ms) = 34.57, fps = 28.93, length(bytes) = 36671, psnr y = 4
7.22, psnr u = 50.18, psnr v = 50.90
I frames: 159 frames, size = 77896/ 12385573, quants = 2 / 2.00 / 2
P frames: 673 frames, size = 50967/ 34301378, quants = 2 / 2.00 / 2
B frames: 606 frames, size = 10099/ 6120553, quants = 4 / 4.00 / 4

As you can see the current version uses max 7042kbps, the old one uses more ( i'm guessing beucase of the minimum quants on b-frames )

What do i need to modify in the newer cmd ( to get lower quants on b-frames ) ?

Cheers.

microchip8
5th September 2013, 22:46
maybe try min_bquant ? and possibly max_bquant...

detmek
6th September 2013, 09:23
Or Quantizer Ratio and Quantizer Offset. At least those are the options in VFW interface.

juGGaKNot
6th September 2013, 17:51
maybe try min_bquant ? and possibly max_bquant...

Don't have those options.

Or Quantizer Ratio and Quantizer Offset. At least those are the options in VFW interface.

How can i tweak them for my goal ?

It's not vfw :

xvid_encraw built at 10:22:53 on Aug 31 2007

-bquant_ratio integer : bframe quantizer ratio (150)
-bquant_offset integer : bframe quantizer offset (100)

-imin integer : Minimum I Quantizer (1..31) (2)
-imax integer : Maximum I quantizer (1..31) (31)
-bmin integer : Minimum B Quantizer (1..31) (2)
-bmax integer : Maximum B quantizer (1..31) (31)
-pmin integer : Minimum P Quantizer (1..31) (2)
-pmax integer : Maximum P quantizer (1..31) (31)

Tried -bmin 2 but no change.

Asmodian
6th September 2013, 19:03
either:

-bquant_ratio 100

or

-bquant_offset 0

juGGaKNot
6th September 2013, 19:25
either:

-bquant_ratio 100

or

-bquant_offset 0

Using either one does lower the bframe quants to 3

Using both lowers it to 2

-bquant_ratio 50 also lowers it to 2

So i will use -bquant_ratio 50, do they affect other things ? ( i only want to use it if get better quality )

Asmodian
7th September 2013, 00:08
-bquant_ratio 50 isn't a good idea if your other frames go above quant 2.

It is a simple equation:

( [P-frame quant] * bquant_ratio ) + bquant_offset = [B-frame quant]

I suggest you use both -bquant_ratio 100 and -bquant_offset 0 if you want B frames to use the same quant as I/P frames. With only -bquant_ratio 50 if the I/P frame quants go above 3 you would have lower B-frame quants than I/P frame quants.

If I or P-frame quant = 4
(4*0.5)+1 = 3

Edit: As to quality, lower quants are better quality but also larger. At a fixed size using slightly higher quants for B-frames usually helps quality. You never want to use lower quants on B-frames than I or P-frames.

juGGaKNot
7th September 2013, 17:54
I suggest you use both -bquant_ratio 100 and -bquant_offset 0 if you want B frames to use the same quant as I/P frames. With only -bquant_ratio 50 if the I/P frame quants go above 3 you would have lower B-frame quants than I/P frame quants. You never want to use lower quants on B-frames than I or P-frames.

Ok, -bquant_ratio 100 and -bquant_offset 0 it is.

Thnx.

I want to use it because it almost never reaches the target bitrate ( 7500 for 720p and 14000 for 1920p )

turbojet
9th September 2013, 00:45
At those bitrates you might want to consider disabling bframes to get closer to the target and arguably a higher quality encode. Bframes offer a lot of compression with a little quality loss.

Asmodian
9th September 2013, 07:16
Is a B-frame at the same quants as the I/P frames actually lower quality? I thought they were just harder to decode?

turbojet
9th September 2013, 22:44
Yes, especially in xvid http://screenshotcomparison.com/comparison/40355

In no way am I suggesting disabling bframes to get higher quality in general. At low and medium bitrates they can really help. 7500 720p is really high bitrate for most content I've seen but maybe it's not for juGGaKNot's source hence the arguably better.

juGGaKNot
10th September 2013, 17:58
In no way am I suggesting disabling bframes to get higher quality in general. At low and medium bitrates they can really help. 7500 720p is really high bitrate for most content I've seen but maybe it's not for juGGaKNot's source hence the arguably better.

No, for the uncompressed game footage it always gets to the bitrate i give it but when i encode video camera footage it does not reach it, that's why i want to lower bquants, for those 1% of cases when it does not reach the bitrate.

Well, since i opened the thread i'm also going to post all my options

-overhead 0 -nopacked -vhqmode 4 -closed_gop -bvhq -bquant_ratio 100 -bquant_offset 0

And ask what can i improve ..

One thing i would like would be sony vegas compatibility ( right now, with those options, the video is black )

Another is no GMC, my cheap mediaplayer does not like it.