Oversized files with ffmpeg and XviD

"Olivier Amato" <[email protected]> Thu, 17 Mar 2005 21:27:17 +0100
Newsgroups gmane.comp.video.xvid.user
Message-ID <001701c52b2f$bafe6a60$0a00000a@tototxoxqlsjoa>
I'm new to xvid-users mailing-list, so please forgive me if this question 
has already been answered ( I've tried to search in the archive, without 
success ).
I'm trying to encode an MP4 file with ffmpeg in 2-pass using XviD and I'm 
getting an oversized resulting file.
Here are the 2 command lines I'm using :

ffmpeg -i input_file.avi -vcodec xvid -b 1000 -g 125 -pass 1 -passlogfile 
log_file output_file.mp4

ffmpeg -i input_file.avi -vcodec xvid -b 1000 -g 125 -pass 2 -passlogfile 
log_file output_file.mp4

The log file is well produced and seems to be valid, but the resulting 
"output_file.mp4" has an average bitrate of 3655 kbps ( instead of 1000 
kbps ) !!??

When I try the same process with internal libavcodec's implementation ( just 
replacing "-vcodec xvid" by "-vcodec mpeg4" ), the encoded file then has an 
average bitrate of 1005 kbps as expected.

BTW, when I'm encoding in 1 pass only with XviD, I don't have this rate 
control issue anymore. The following command line produces a resulting file 
with an average bitrate of 1018 kbps :

ffmpeg -i input_file.avi -vcodec xvid -b 1000 -g 125 output_file.mp4

I've read something about the quant 2-31 issue in Doom9's forum and I tried 
to set qmin to 1 in the command line, but it didn't help :

ffmpeg -i input_file.avi -vcodec xvid -b 1000 -g 125 -qmin 1 -qmax 31 -pass 
1 -passlogfile log_file output_file.mp4
ffmpeg -i input_file.avi -vcodec xvid -b 1000 -g 125 -qmin 1 -qmax 31 -pass 
2 -passlogfile log_file output_file.mp4

Would somebody know how to solve this issue ?

BTW, which other tools than ffmpeg are able to encode video with XviD, 
encode audio in AAC-LC and mux these tracks into MP4 file format in a single 
command line ( mencoder, VLC, etc. ) ???
Thanks for your help.

Olivier