A video compression system includes a compression module to compress each
of a plurality of segments of an input signal using an initial quality
setting. A rate calculation module calculates, for each compressed
segment, a data rate for an output signal that would result from adding a
compressed segment to the output signal. A selection module automatically
selects, in response to the calculated data rate deviating from a target
range, a quality setting for each segment that results in a data rate
this is within the target range when a segment compressed using the
automatically-selected quality setting is added to the output signal.