1. A method for rate control, comprising: determining a bit target, and a number of bits used; determining a rate factor associated with each of a plurality of previously coded frames; for each rate factor associated with each of the plurality of previously coded frames, determining an absolute difference between the bit target and a number of bits that would have been used if each rate factor was used to obtain the quantization parameters for each of the previously coded frames; selecting a minimum value from the absolute differences to obtain a current rate factor; obtaining a current quantization parameter based on the current rate factor and a complexity value of a current frame; and encoding the current frame using the current quantization parameter.