FFmpeg Xvid CBR or VBR with maxrate ? how ?

Tom <[email protected]> Fri, 25 Mar 2005 18:58:28 +0100
Newsgroups gmane.comp.video.xvid.user
Message-ID <[email protected]>
Hello,

First, sorry, but the search engine for the ML want to give me binary
octet stream instead a nice html page :) Maybe the xvid is doing some
changes :) But I see in a thread "[XviD-users] maximum bandwitch limit 
with XVid" (March 05) about the subject I'm going to talk/ask

But IMHO I'm not sure that Christoph is right. Because, in the last 
changelog (1.0.3), it says :
# Fixes to the CBR/ABR rate controller, it should work much better with 
bvops now.

CBR means Contant Bit Rate so it may be possible to have the same 
bitrate from the beginning to the end. But how ?! It's my question

I'm trying since this week to make a mp4 video with ffmpeg and the xvid
codec. It works well _BUT_ I'd like to limit the maximum bitrate because
it's for streaming purpose. The bitrate must not exceed the allowed
bandwidth (i.e: 80kb/s). So how to do CBR or VBR with a limited maximum
bitrate ?

The -maxrate (with -bufsize) option of FFmpeg don't change anything with
the Xvid codec (but works approx. with the ffmpeg mpeg4 codec). FFMpeg 
has his own mpeg4 codec but I prefer to use the xvid codec. For my use, 
Xvid makes better video quality.
FFmpeg does not use the -maxrate an -bufsize during the encoding. Is it 
normal ? Or is there another way to have CBR/VBR (with max defined bitrate)

Anyone has an idea how to limit the maximum bitrate ?

ie :
ffmpeg -i sample.avi -r 12.5 -b 80 -vcodec xvid -maxrate 80 -bufsize 5
temp.m4v

Gives this (from MP4Client - gpac tools) :
         Buffer Size 6182
         Average Bitrate 76796 bps  <------ quite 80
         Maximum Bitrate 176768 bps <------ not really 80 !! :((

Thanks
Tom