A method for processing a video frame in a video file, the video frame comprising pixels, comprising: - for each predetermined numerical value of one or more predetermined numerical values, ∘ comparing the video frame with a video frame spaced prior to the video frame by the predetermined numerical value of frames to obtain a frame of a first inter-frame difference; ∘ comparing the video frame with a video frame spaced after the video frame by the predetermined numerical value of frames to obtain a frame of a second inter-frame difference; and ∘ taking a smaller value of the first inter-frame and the second inter-frame difference for each pixel; and ∘ obtaining a confidence map of the video frame comprising pixels with the smaller values; and - determining whether a pixel belongs to a foreground based on respective values of the pixel in one or more of the confidence maps; - setting a first threshold Θ1 and a second threshold Θ2, whereby Θ1 > Θ2 - if the respective values of the pixel in respective confidence maps are all greater than the first threshold, the pixel belongs to the foreground; - if the respective values of the pixel in respective confidence maps are all smaller than the second threshold, the pixel belongs to the background; - if the respective values of the pixel in respective confidence maps are not all greater than the first threshold or not all smaller than the second threshold, determining a probabilistic value for the pixel belonging to the foreground, the probabilistic value being determined through an analysis of all obtained confidence maps and using the determined probabilistic value to determine whether the pixel belongs to the foreground. - for each predetermined numerical value of one or more predetermined numerical values, ∘ comparing the video frame with a video frame spaced prior to the video frame by the predetermined numerical value of frames to obtain a frame of a first inter-frame difference; ∘ comparing the video frame with a video frame spaced after the video frame by the predetermined numerical value of frames to obtain a frame of a second inter-frame difference; and ∘ taking a smaller value of the first inter-frame and the second inter-frame difference for each pixel; and ∘ obtaining a confidence map of the video frame comprising pixels with the smaller values; and ∘ comparing the video frame with a video frame spaced prior to the video frame by the predetermined numerical value of frames to obtain a frame of a first inter-frame difference; ∘ comparing the video frame with a video frame spaced after the video frame by the predetermined numerical value of frames to obtain a frame of a second inter-frame difference; and ∘ taking a smaller value of the first inter-frame and the second inter-frame difference for each pixel; and ∘ obtaining a confidence map of the video frame comprising pixels with the smaller values; and - determining whether a pixel belongs to a foreground based on respective values of the pixel in one or more of the confidence maps; - setting a first threshold Θ1 and a second threshold Θ2, whereby Θ1 > Θ2 - if the respective values of the pixel in respective confidence maps are all greater than the first threshold, the pixel belongs to the foreground; - if the respective values of the pixel in respective confidence maps are all smaller than the second threshold, the pixel belongs to the background; - if the respective values of the pixel in respective confidence maps are not all greater than the first threshold or not all smaller than the second threshold, determining a probabilistic value for the pixel belonging to the foreground, the probabilistic value being determined through an analysis of all obtained confidence maps and using the determined probabilistic value to determine whether the pixel belongs to the foreground.