Patent ID: 7746927

Claim:
A computer-implemented method for robust single-pass variable bit rate video encoding of a video sequence, wherein frames in a Group of Pictures (GOP) of the video sequence are encoded, the method comprising: determining a buffer size for keeping track of over/underused bits generated during the encoding of the video sequence, the buffer size being a function of at least a target bit rate for the video sequence and a length of the video sequence; initializing the buffer to a default initial fullness; allocating a segment of the buffer for keeping track of over/underused bits for I frames, a segment for keeping track of over/underused bits for P frames and a segment for keeping track of over/underused bits for B frames; initializing each segment of the buffer to a default initial fullness; determining a number of I frames per GOP, a number of P frames per GOP and a number of B frames per GOP, based on a nominal GOP pattern; for each frame of the video sequence, determining the quant with which to encode that frame as a function of at least the fullness of the segment of the buffer for that frame type, a base quant envelope and a base quant envelope control associated with that frame type, wherein the base quant envelope and the base quant envelope control are based on the type of the frame, and the fluctuation of the base quant envelope is controlled by the base quant envelope control; and for each GOP of the video sequence, performing the following steps: before encoding any frame of that GOP, calculating a GOP bit target for that GOP, the GOP bit target being a function of at least the number of I frames, P frames and B frames per GOP, the target bit rate for the video sequence and any bits carried over from a last encoded GOP; after encoding each frame of that GOP, calculating over/underused bits by subtracting allocated bits from actual used bits, adding any over/underused bits to an appropriate buffer segment to an extent to which the appropriate buffer segment is not over/underflowed and storing any over/underflow bits in a counter; and after encoding all frames of that GOP, redistributing over/underused bits between the segments of the buffer as a function of at least a total number of over/underused bits in the buffer and the number of I frames, P frames and B frames per GOP and storing an indication of a number of over/underused bits with respect to the allocated target bits for that GOP to carry over to the next GOP.