A method of encoding a stream of images captured by an image sensor and comprising a privacy mask, wherein a current image in the stream of images is encoded with reference to a reference image which is a previously encoded image in the stream of images, the method comprising: o receiving information from the image sensor representative of pixels of the current image, o grouping the pixels into pixel blocks of groups of neighbouring pixels o receiving information specifying position and extension of a privacy mask area in which the privacy mask is to be applied on the current image, o performing pixelation of the privacy mask area, wherein the step of performing pixelation of the privacy mask area comprises o grouping pixels within the privacy mask area into pixelation groups of neighbouring pixels, and o setting a pixel value of each pixel of a respective pixelation group to a common pixel value representative of the respective pixelation group, o receiving information representative of a movement of the image sensor between capture of the reference image, and capture of the current image, wherein the information representative of movement of the image sensor is received from a pan, tilt or zoom controller controlling movement of the image sensor, or from a motion sensor, o in case the movement of the image sensor is above a threshold value, encoding each pixel block within the pixelated privacy mask area as an inter-coded block with a motion vector pointing to a reference pixel block in the reference image and a residual indicative of a pixel value difference between the reference pixel block and the pixel block within the pixelated privacy mask area, wherein the motion vector is set equal to the movement of the image sensor and the residual is set to zero. o receiving information from the image sensor representative of pixels of the current image, o grouping the pixels into pixel blocks of groups of neighbouring pixels o receiving information specifying position and extension of a privacy mask area in which the privacy mask is to be applied on the current image, o performing pixelation of the privacy mask area, wherein the step of performing pixelation of the privacy mask area comprises o grouping pixels within the privacy mask area into pixelation groups of neighbouring pixels, and o setting a pixel value of each pixel of a respective pixelation group to a common pixel value representative of the respective pixelation group, o grouping pixels within the privacy mask area into pixelation groups of neighbouring pixels, and o setting a pixel value of each pixel of a respective pixelation group to a common pixel value representative of the respective pixelation group, o receiving information representative of a movement of the image sensor between capture of the reference image, and capture of the current image, wherein the information representative of movement of the image sensor is received from a pan, tilt or zoom controller controlling movement of the image sensor, or from a motion sensor, o in case the movement of the image sensor is above a threshold value, encoding each pixel block within the pixelated privacy mask area as an inter-coded block with a motion vector pointing to a reference pixel block in the reference image and a residual indicative of a pixel value difference between the reference pixel block and the pixel block within the pixelated privacy mask area, wherein the motion vector is set equal to the movement of the image sensor and the residual is set to zero. <EOS>