A method comprising: encoding, by a video encoder and based on a first quantization factor, one or more first groups of image blocks of a first video frame; estimating, by a processing device, the size in bits of an image slice comprising a plurality of further groups of image blocks to be encoded, the image slice being a sliding window comprising a fixed number N G of further groups of image blocks to be encoded, wherein N G is an integer equal to 2 or more and the plurality of further groups of image blocks include groups of image blocks of the first video frame and of a second video frame consecutive to the first video frame; determining, based on said first quantization factor and a comparison of the estimated size of the sliding window with an image slice size target, a second quantization factor to be applied to one or more first further groups of the plurality of further groups, wherein the second quantization factor is increased with respect to the first quantization factor if the estimated size of the sliding window is greater than the image slice size target, and the second quantization factor is maintained or reduced with respect to the first quantization factor if the estimated size of the sliding window is not greater than the image slice size target; encoding, based on the second quantization factor, the one or more first further groups of image blocks of the plurality of further groups; estimating, by the processing device, a new size of the sliding window shifted forward by one group and comprising a second plurality of N G further groups of image blocks to be encoded; and determining, based on said second quantization factor and a comparison of the estimated new size of the sliding window with the image slice size target, a third quantization factor to be applied to one or more second further groups of the second plurality of N G further groups, wherein the size of each of the further groups of image blocks of the sliding window is estimated by: identifying, for each further group of image blocks, a corresponding group of image blocks in a previous video frame; and estimating the size of each further group of image blocks based on the size of its corresponding group of image blocks in the previous frame and on the quantization factor that was used to encode the corresponding group of image blocks. encoding, by a video encoder and based on a first quantization factor, one or more first groups of image blocks of a first video frame; estimating, by a processing device, the size in bits of an image slice comprising a plurality of further groups of image blocks to be encoded, the image slice being a sliding window comprising a fixed number N G of further groups of image blocks to be encoded, wherein N G is an integer equal to 2 or more and the plurality of further groups of image blocks include groups of image blocks of the first video frame and of a second video frame consecutive to the first video frame; determining, based on said first quantization factor and a comparison of the estimated size of the sliding window with an image slice size target, a second quantization factor to be applied to one or more first further groups of the plurality of further groups, wherein the second quantization factor is increased with respect to the first quantization factor if the estimated size of the sliding window is greater than the image slice size target, and the second quantization factor is maintained or reduced with respect to the first quantization factor if the estimated size of the sliding window is not greater than the image slice size target; encoding, based on the second quantization factor, the one or more first further groups of image blocks of the plurality of further groups; estimating, by the processing device, a new size of the sliding window shifted forward by one group and comprising a second plurality of N G further groups of image blocks to be encoded; and determining, based on said second quantization factor and a comparison of the estimated new size of the sliding window with the image slice size target, a third quantization factor to be applied to one or more second further groups of the second plurality of N G further groups, wherein the size of each of the further groups of image blocks of the sliding window is estimated by: identifying, for each further group of image blocks, a corresponding group of image blocks in a previous video frame; and estimating the size of each further group of image blocks based on the size of its corresponding group of image blocks in the previous frame and on the quantization factor that was used to encode the corresponding group of image blocks. identifying, for each further group of image blocks, a corresponding group of image blocks in a previous video frame; and estimating the size of each further group of image blocks based on the size of its corresponding group of image blocks in the previous frame and on the quantization factor that was used to encode the corresponding group of image blocks.