When quality varies from frame to frame, it looks like flicker or pumping. It is often caused by keyframe interval and bitrate constraints, and you first need to separate it from flicker that was already in the source.
Flicker and pumping are problems along the time axis. Each frame looks fine on its own, but when played back, brightness or sharpness surges up and down. You can't find them with a still screenshot, so you need to look at consecutive frames or at scores over time.
An encoder spends bits differently for each frame type. Keyframes (I) are made expensively without referencing other frames, and the P and B frames in between are made cheaply by referencing frames before and after (Inter prediction lesson). If quality differs slightly by frame type, you can see a periodic surge where the picture gets sharper and then blurrier each time a keyframe arrives.
# Frame type and timestamp as CSV. Pick out just the I-frame lines and look at the intervals
ffprobe -v error -select_streams v:0 -show_entries frame=pts_time,pict_type -of csv=p=0 encoded.mkv > frames.csv
# Depending on the ffprobe version, the field may be pkt_pts_time instead of pts_timeimport json
from collections import defaultdict
fps = 25.0 # the video's frame rate
d = json.load(open("vmaf.json"))
bucket = defaultdict(list)
for f in d["frames"]:
bucket[int(f["frameNum"] / fps)].append(f["metrics"]["vmaf"])
for sec in sorted(bucket):
v = bucket[sec]
print(f"{sec:4d}s mean {sum(v)/len(v):6.2f} min {min(v):6.2f}")If the per-second mean swings up and down regularly and the period matches the keyframe interval, pumping is a reasonable suspect. But what VMAF shows is the variation in the score relative to the source, not visible flicker itself. Brightness surges can be visible even when the score varies little, so always play back the suspect segment and look at it by eye.
-bufsize lets the encoder borrow more bits for hard scenes. If a streaming spec sets values, adjust within them.The measurement articles covered the mean, 5th percentile, and minimum VMAF over whole clips, and did not measure the relationship between keyframe period and quality surging. The causes and responses above are generally known explanations and are not backed by this site's numbers.
A phenomenon where brightness or quality varies irregularly from frame to frame and the picture shakes. It can be a source problem or created by the encode.
A phenomenon where quality regularly gets sharper and then blurrier in step with things like the keyframe period.
A model that limits bit usage with a decoder buffer size and a maximum bitrate. In ffmpeg you set it with -maxrate and -bufsize.
When you see flicker, what should you do first?
If the per-second mean VMAF rises and falls with the same period as the keyframe interval, what is worth suspecting?