[XviD-devel] On the compression ratio of xvidcore

Christoph Lampert christoph.lampert at gmail.com
Sat Nov 22 16:37:09 CET 2008


Hi,

MPEG-4 doesn't have a fixed compression ratio, it depends
on the setting of the quantization parameters. The stronger
the quantization, the higher the compression but the worse
the picture quality.

The default in xvid_encraw is a quantizer of 2, which is
smallest value (highest quality) that makes sense. You can
encode with other compression ratios either by specifying
a pre-defined output bitrate (e.g. 100kb/s) :

./xvid_encraw -single -bitrate 100

or a fixed quantization parameter (here Q ):

./xvid_encraw -single -bitrate 100 -zq 0 Q

Cheers,
Christoph



lingan wrote:
> Hello, dear:
>    I'm studying to use xvidcore to encode yuv images into mpeg4, But
> I find the compression ratio I get is quite low. For example, I use
> the following command to encode a yuv file :
> p9322 at wllab1:~/program863/xvidcore-1.1.3/examples$ ./xvid_encraw -i
> coastguard_cif.yuv -type 0 -w 352 -h 288 -frames 1000 -o
> coastguard.mpeg4 -max_key_interval 10
> then :
> p9322 at wllab1:~/program863/xvidcore-1.1.3/examples$ ls -lh coastguard*
> -rw-r--r-- 1 p9322 p9322  44M 2008-10-31 17:35 coastguard_cif.yuv
> -rw-r--r-- 1 p9322 p9322 6.1M 2008-11-21 22:35 coastguard.mpeg4
>
> you see? the compression ratio is only about 7.
> this is part of the encoding output info:
> xvid_encraw - raw mpeg4 bitstream encoder written by Christoph Lampert
> 2002-2003
>
>    0: key=2, time=     21, len=   36006 | type=I, quant=  2, len=   36006
>    1: key=0, time=     24, len=   19250 | type=P, quant=  2, len=   19250
>    2: key=0, time=     28, len=   20667 | type=P, quant=  2, len=   20667
>    3: key=0, time=     23, len=   20431 | type=P, quant=  2, len=   20431
>    4: key=0, time=     29, len=   22397 | type=P, quant=  2, len=   22397
>    5: key=0, time=     23, len=   20005 | type=P, quant=  2, len=   20005
>    6: key=0, time=     28, len=   21632 | type=P, quant=  2, len=   21632
>    7: key=0, time=     27, len=   21329 | type=P, quant=  2, len=   21329
>    8: key=0, time=     23, len=   20117 | type=P, quant=  2, len=   20117
>    9: key=0, time=     24, len=   20940 | type=P, quant=  2, len=   20940
>   10: key=2, time=     11, len=   36691 | type=I, quant=  2, len=   36691
>   11: key=0, time=     34, len=   18852 | type=P, quant=  2, len=   18852
>   12: key=0, time=     35, len=   21458 | type=P, quant=  2, len=   21458
>   13: key=0, time=     34, len=   20337 | type=P, quant=  2, len=   20337
> the resulted P frames are not much larger than I frames.
>
> Then I use xvidcore to encode the webcam stream, the output info is as
> follows:
> frame: key=2,len=   14441 | type=^@, quant=  0, stat_len=       0
> frame: key=0,len=       0 | type=^@, quant=  0, stat_len=       0
> frame: key=0,len=    8593 | type=I, quant=  2, stat_len=   14441
> frame: key=0,len=    2676 | type=B, quant=  4, stat_len=    2676
> frame: key=2,len=   14325 | type=P, quant=  2, stat_len=    8593
> frame: key=0,len=    8105 | type=I, quant=  2, stat_len=   14325
> frame: key=0,len=    2813 | type=B, quant=  4, stat_len=    2813
> frame: key=2,len=   14290 | type=P, quant=  2, stat_len=    8105
> frame: key=0,len=    6932 | type=I, quant=  2, stat_len=   14290
> ......
>
> The second column is the length of coded frame. My webcam is 320x240,
> so the compression ratio is about 320x240x3/10000=23. And strangely,
> the volume of P frames is even larger than I frames sometimes.
>
> It's said that mpeg4 can achieve at most 400 compression ratio.
> Generally, it can achieve 6,70 compression ratio easily. But why the
> CR I get is so small ? Any suggestions?
>
> The version is xvidcore-1.1.3, and the OS is debian linux-2.6.21.7.
> Thank you very much!!
> _______________________________________________
> XviD-devel mailing list
> XviD-devel at xvid.org
> http://list.xvid.org/mailman/listinfo/xvid-devel
>
>   



More information about the XviD-devel mailing list