Log in

View Full Version : cannot set bitrate with xvid [SOLVED]


R!tman
28th November 2004, 13:41
Hi all,

for a couple of days I try to get xvid encoding to work. Formerly, I used windows, which was the only reason to use windows at all.

My problem is, that I cannot encode with a given bitrate in 2 pass mode encodings. I made some tests with smaller video files:

mencoder -o /dev/null -nosound -ovc xvid -xvidencopts pass=1 test.vob && mencoder -o test.avi -nosound -ovc xvid -xvidencopts pass=2:bitrate=500 test.vob

The bitrate of the output file is always the same, no matter what I used for "bitrate=".

Even with single pass encodings

mencoder -o test.avi -nosound -ovc xvid -xvidencopts bitrate=500 test.vob

the bitrate behaves very strange. The bitrate is not always the same, but most times quite different from the given one. With bitrates higher than 1000 the output bitrate differs not very much, even when I set bitrate=15000.

lavc works a little better. The bitrate is more or less hit, but when I use bitrates higher than a certain bitrate (depends on the movie, about 1500) the output bitrate is the same for every given bitrate.

I get the same results with transcode. I use mplayer-1.0-pre4-3.3.4, xvid-1.0.2 and glibc-2.3.4.20040808-r1 with nptl.


i) BTW, I use Gentoo!
ii) Took some typos out.

akupenguin
28th November 2004, 20:38
(tested with MEncoder dev-CVS-041123, xvid 1.0.2)
I can't explain your problems with 2pass. That commandline works for me, and produces the desired bitrate.

The maximum bitrate limits you experience are simply the highest quality the codec can produce: quantizer=2. If you really want bigger files, you can set (in lavc) vqmin=1:lmin=1 and use vqscale=2 instead of vbitrate for the 1st pass, or (in xvid) min_iquant=1:min_pquant=1. (Those are turned on be default in the vfw builds of xvid, just to stop people from complaining about undersized encodes, even though the devs say they don't significantly help quality.)

R!tman
28th November 2004, 23:15
Originally posted by akupenguin
(tested with MEncoder dev-CVS-041123, xvid 1.0.2)
I can't explain your problems with 2pass. That commandline works for me, and produces the desired bitrate.

The maximum bitrate limits you experience are simply the highest quality the codec can produce: quantizer=2. If you really want bigger files, you can set (in lavc) vqmin=1:lmin=1 and use vqscale=2 instead of vbitrate for the 1st pass, or (in xvid) min_iquant=1:min_pquant=1. (Those are turned on be default in the vfw builds of xvid, just to stop people from complaining about undersized encodes, even though the devs say they don't significantly help quality.)

I could get better results with the options you gave me, but only for lavc and the top bitrate now is a little less than 3000. I still cannot achieve an higher rates with lavc.
But xvid is still exactley the same :(. I begin to believe that it is a gentoo issue :mad:. It is probably not an issue of this specific machine, as I have tried it on two (gentoo) machines.

echo
29th November 2004, 00:28
What is the bitrate that you are getting with XviD anyway? My guess is that you are probably maxing out the codec. I don't know what kind of video file is the one you are using as source, so maybe it does not require high bitrates even at quantizer 2. So whatever you use as bitrate it just does a quantizer 2 encode. What happens if you try to use even lower bitrates (400, 300...)?

R!tman
29th November 2004, 10:42
Originally posted by echo
What is the bitrate that you are getting with XviD anyway? My guess is that you are probably maxing out the codec. I don't know what kind of video file is the one you are using as source, so maybe it does not require high bitrates even at quantizer 2. So whatever you use as bitrate it just does a quantizer 2 encode. What happens if you try to use even lower bitrates (400, 300...)?

The bitrate I get with xvid after the second pass with the test file is always 1637 no matter what I use for bitrate=...
I varies a little from video to video but it is more or less about 1500+-150. But as I already said, for one specific video it is always the same, no matter how high or low I set the bitrate. I even tried extreme values like 100 or 15000; always the same.

echo
29th November 2004, 12:44
So you are not maxing the codec after all... I don't know, the only thing I can think off is that maybe gentoo has a config file somewhere with a bitrate=1500 (or something) line and this is being used instead of your command line. But I never used gentoo so I don't really know...

R!tman
30th November 2004, 20:41
Together with
Originally posted by akupenguin
... min_iquant=1:min_pquant=1...
and this (http://www.xvid.org/modules.php?op=modload&name=phpBB2&file=viewtopic&t=1951), I got it to work on one of the two machines. Luckily the much faster one :). I have only done some rudimentary testing on the other machine and I am confident to get it to work there too.
Oh, I still cannot achieve bitrates higher than about 4000; but that is acceptable ;). The last movie I did was encoded with bitrate=-1800000 and it worked very good. The resulting bitrate was 2390.

Thank you very much, both echo and akupenguin.

ak
30th November 2004, 20:53
This seems to address issue with logfile being truncated with xvid 2-pass encode:
http://article.gmane.org/gmane.comp.video.mplayer.devel/23104

I only had one such dvd, that triggered it, now if I could remeber which one... :cool: