A method of video encoding comprising: encoding, by an encoder, uncompressed frames of a video signal based on a quantization parameter, QP, to generate an encoded video sequence; determining by a rate control circuit a first ratio, IP RATIO, based on previously encoded picture frames of said video sequence, the previously encoded picture frames comprising one or more intra-coded pictures I and one or more predicted pictures, P, the first ratio, IP RATIO, being calculated based on the ratio between the size of one or more previously encoded intra-coded pictures and the size of one or more previously encoded predicted pictures; determining, by the rate control circuit, the size (S SW) of a sliding window of N previously encoded picture frames of the encoded video sequence, the sliding window comprising one or more of the intra-coded pictures, I, and one or more of the predicted pictures, P, where N is an integer equal to three or more; determining, by the rate control circuit, a target size, T SW, of the sliding window based on a target size of a group, GOP, of successive pictures comprising the number of pictures from one intra-coded picture up to but not including a subsequent intra-coded picture, the target size being determined based on the following equation: T SW = N I _ SW × IP RATIO + N P _ SW × GOP TARGET _ SIZE IP RATIO + N P _ GOP where N I SW is the number of intra-coded pictures in the sliding window, Np SW is the number of predicted pictures in the sliding window, GOP TARGETSIZE is the target size of the group of successive pictures, IP RATIO is the first ratio and Np GOP is the number of predicted pictures in the group of successive pictures; and determining the quantization parameter, QP, to be applied to a frame to be encoded based on the first ratio, IP RATIO, and on a comparison of the size of the sliding window with the target size of the sliding window. encoding, by an encoder, uncompressed frames of a video signal based on a quantization parameter, QP, to generate an encoded video sequence; determining by a rate control circuit a first ratio, IP RATIO, based on previously encoded picture frames of said video sequence, the previously encoded picture frames comprising one or more intra-coded pictures I and one or more predicted pictures, P, the first ratio, IP RATIO, being calculated based on the ratio between the size of one or more previously encoded intra-coded pictures and the size of one or more previously encoded predicted pictures; determining, by the rate control circuit, the size (S SW) of a sliding window of N previously encoded picture frames of the encoded video sequence, the sliding window comprising one or more of the intra-coded pictures, I, and one or more of the predicted pictures, P, where N is an integer equal to three or more; determining, by the rate control circuit, a target size, T SW, of the sliding window based on a target size of a group, GOP, of successive pictures comprising the number of pictures from one intra-coded picture up to but not including a subsequent intra-coded picture, the target size being determined based on the following equation: T SW = N I _ SW × IP RATIO + N P _ SW × GOP TARGET _ SIZE IP RATIO + N P _ GOP where N I SW is the number of intra-coded pictures in the sliding window, Np SW is the number of predicted pictures in the sliding window, GOP TARGETSIZE is the target size of the group of successive pictures, IP RATIO is the first ratio and Np GOP is the number of predicted pictures in the group of successive pictures; and determining the quantization parameter, QP, to be applied to a frame to be encoded based on the first ratio, IP RATIO, and on a comparison of the size of the sliding window with the target size of the sliding window.