A warning flashes on a screen recording for a quarter of a second. Start it on frame 24 and a sampler running at one frame per second picks it up. Move it to frame 25 and the same sampler delivers four black frames. The user saw a warning both times. Your video model received evidence of it only once.
You can reproduce that difference on a laptop with Python and FFmpeg. The test below moves the flash through 24 positions, then counts how often its pixels survive three sampling rates. Then try the same check on a failed upload. Can you point to a frame in the model input that shows the event?
Start with the event your user cares about
Imagine a support engineer reviewing a recording of a failed file upload. The page shows a progress bar, flashes an error banner and returns to the upload form. A summary that describes the form and the progress bar sounds plausible. The engineer still needs the error message. For this feature, the unit worth measuring is each appearance of the banner. A score for the recording as a whole can hide the one missing detail that made someone attach it to a ticket.
Write a small acceptance example before you choose an FPS setting. “The submitted frames include at least one readable image of the error banner” is enough for text that appears all at once. For a loading indicator that changes from amber to red, the evidence includes two states in order. An annotation can express those as two intervals with separate labels. A single frame somewhere inside the combined interval could show either color and earn undeserved credit.
For the first test, use a simpler requirement. Make the entire screen white for six consecutive source frames and black everywhere else. With a constant source rate of 24 frames per second, the white interval lasts exactly 250 milliseconds. You can identify it by reading one pixel. That takes OCR, prompt wording and human judgment out of the measurement.
Build a clip that can expose a one-frame mistake
The sampler in this example starts at source frame zero. At one frame per second it selects frames 0, 24, 48 and 72 of a four-second clip. A flash on frames 24 through 29 appears in the second sample. A flash on frames 25 through 30 falls between samples two and three. The first two rows below make good fixtures to keep side by side in a code review.
| Flash occupies source frames | Selected frames at 1 FPS | Evidence delivered |
|---|---|---|
| 24–29 inclusive | 0, 24, 48, 72 | White frame at 24 |
| 25–30 inclusive | 0, 24, 48, 72 | Four black frames |
| 47–52 inclusive | 0, 24, 48, 72 | White frame at 48 |
| No flash | 0, 24, 48, 72 | Four black frames |
The second and fourth rows produce identical inputs. Even a perfect reader of those four images would have to give the same answer in both cases. If your interface reports “no warning occurred,” it has made a stronger claim than the observation supports. “No warning visible in the sampled frames” gives the engineer a reason to open the original recording.
Run the pixel check
Save this block as check_sampling.py and run python3 check_sampling.py with FFmpeg on your path. It writes tiny, lossless grayscale videos in a temporary directory. Each positive clip has the same length and flash duration. Only the start frame changes. A final blank clip checks the detector on a known negative.
from pathlib import Path
from subprocess import run
from tempfile import TemporaryDirectory
SOURCE_FPS = 24
FRAME_COUNT = 96
FRAME_BYTES = 16 * 16
RATES = (1, 2, 4)
def ffmpeg(*args, data=None):
return run(
["ffmpeg", "-hide_banner", "-loglevel", "error", *args],
input=data, capture_output=True, check=True,
).stdout
def write_clip(path, start):
frames = bytearray()
for index in range(FRAME_COUNT):
white = start is not None and start <= index < start + 6
frames.extend(bytes([255 if white else 0]) * FRAME_BYTES)
ffmpeg("-f", "rawvideo", "-pixel_format", "gray",
"-video_size", "16x16", "-framerate", str(SOURCE_FPS),
"-i", "pipe:0", "-c:v", "ffv1", str(path), data=frames)
def sampled_pixels(path, rate):
stride = SOURCE_FPS // rate # All three rates divide 24.
raw = ffmpeg("-i", str(path), "-vf", f"select='not(mod(n,{stride}))'",
"-fps_mode", "passthrough", "-pix_fmt", "gray",
"-f", "rawvideo", "pipe:1")
assert len(raw) == (FRAME_COUNT // stride) * FRAME_BYTES
return raw[::FRAME_BYTES] # Every pixel in a frame has the same value.
with TemporaryDirectory() as folder:
hits = {rate: 0 for rate in RATES}
for start in [*range(24, 48), None]:
path = Path(folder) / f"flash-{start}.mkv"
write_clip(path, start)
for rate in RATES:
visible = 255 in sampled_pixels(path, rate)
if start is None:
assert not visible, "Blank clip produced a hit"
else:
hits[rate] += visible
assert hits == {1: 6, 2: 12, 4: 24}
print(hits)
The explicit selection rule matters. It fixes the first sample at zero and keeps every Nth decoded frame. Another sampler might choose the center of each segment or include both endpoints. A setting labeled “four frames” does not tell you which policy ran. Preserve the expected source indices when you replace this reference implementation with the one your application uses. FFmpeg select filter documentation
Read the results as evidence coverage
| Sampling rate | Frames per four-second clip | Flash placements captured | Coverage |
|---|---|---|---|
| 1 FPS | 4 | 6 of 24 | 25% |
| 2 FPS | 8 | 12 of 24 | 50% |
| 4 FPS | 16 | 24 of 24 | 100% |
At one frame per second, a flash can start on frame 24 and cover sample 24. It can also start on any of frames 43 through 47 and still cover sample 48. Those are the six winning starts. At four frames per second there is a sample every six source frames. Any run of six consecutive frames inside this fixture contains one selected frame. That explains the last row without appealing to chance.
These percentages describe all tested alignments of a single event duration on a regular grid. They give no estimate of how often your customers’ uploads contain a warning, or how well a model reads one. A recording tool might align its own UI updates with a regular timer. A crop might move the sampling origin. Both change the distribution of starts you encounter. Keep the numerator and denominator next to the result so a future reader can reconstruct what you actually measured.
For a second opinion on model performance, research datasets already cover brief events. The SynFlash benchmark includes controlled sub-second changes with frame-level ground truth. Moment-Video studies what happens to short visual evidence through the rest of a video model. Use those datasets to compare models. Use the local test to see which frames this build of your adapter actually sent. SynFlash research · Moment-Video research
Trace a miss through the video processor
Start with one failing recording. Save its event interval, the actual selected source indices or timestamps, and a contact sheet in delivery order. Look at the final images at their submitted resolution. A banner can survive sampling and lose its text when a desktop recording shrinks to a thumbnail. Try a crop around the dialog and read the text at the new size. If a detector supplies the crop, verify its coordinates on inputs with different dimensions. Testing DETR bounding boxes in mixed-size batches
With a Hugging Face video processor, request metadata on the call that prepares your video. Set the sampling policy explicitly where your checkpoint supports it. The processor documentation describes do_sample_frames, fps, num_frames and return_metadata=True. Inspect the returned indices and any model-specific limits. If your service already extracts frames, trace both stages. An index of three in a preselected array refers to the fourth item in that array. Carry its original timestamp forward or the contact sheet may point you to the wrong part of the recording. Transformers video processor reference
This detail can change in an ordinary dependency update. A Transformers fix for V-JEPA 2 made the video classification pipeline read the checkpoint’s default frame count through the field the pipeline expects. Its regression check compares the implicit count with an explicit one. Your own test can go one step further and compare the frames that carry the event. Two paths can return the same number of frames while sampling different moments. Transformers regression and fix
For an API that handles video internally, record the file, clipping window, requested sampling rate and returned answer. For example, Gemini documents controls for clipping and frame rate in its video processing options. When the service does not expose selected images, mark internal coverage as unknown. A paired upload of the positive clip and blank control can still test end-to-end behavior. If the endpoint accepts a sequence of images, a separate request with known frames helps isolate what the reader can recognize under that input mode. Gemini video understanding guide
Account for variable frame rates and clip offsets
The division by 24 in this test works because we created the source clock. A screen recorder can spend several seconds showing an unchanged frame, then write a burst of frames as the user opens a menu. On that kind of file, dividing the frame index by the average FPS can put a captured banner outside its annotated interval. Use presentation timestamps from the decoder and keep the time base with them.
Write down whether annotations use source time or time from the beginning of a clip. If a cut starts at source second 12 and the banner appears at second 13, the clip annotation starts around second one. Verify the mapping with a visible marker just inside the cut. For a frame held on screen, include its display duration when deciding whether it overlaps an annotation. Test the first and last displayed frames separately when trimming is part of your pipeline.
Choose a frame budget that fits the task
A fixed frame count gives each request a predictable number of images. Eight equally spaced samples cover a four-second clip quite differently from a four-minute recording. A fixed FPS keeps the nominal spacing steady as the file grows, until a cap takes effect. Find out what the cap does. Spreading the same budget across the entire file increases the gaps. Taking the first N frames leaves the end completely uncovered. Put a labeled event near the end of a long test file to distinguish those behaviors.
For upload support, you may already know the approximate moment of failure from an application log. Sample a dense window on both sides of that timestamp and keep a handful of wider views for context. Budget for clock skew and for the delay between a server error and the banner appearing. If the UI never sent an event, a second pass triggered only by that log entry will never run. Keep a separate test for that path.
For a meeting summary, widely spaced frames may be enough to identify a slide that stays up for minutes. Switch the question to “Which choice did the presenter briefly highlight?” and the same policy can fail. Measure each task on clips that resemble its actual inputs. When comparing policies, hold the model and question fixed and record selected frames, observed input cost, elapsed time and correct answers per labeled event. The existing model evaluation guide covers how to carry a task-level measure into a release decision. Model benchmark harness
Turn a missed event into a release check
Keep three counts for a labeled set of recordings. The first is how many annotated events have visible evidence in the submitted images. The second is how many of those covered events the model reads correctly. The third is how many blank controls produce a false report. With those counts, a reviewer can see which component needs work even when the overall answer score stays flat.
For example, suppose 12 of 20 labeled banners survive preprocessing and the reader gets nine of those 12 right. Eight misses belong in the input investigation. Three have visible evidence and belong in the reading investigation. Review any correct answer from an uncovered clip for another clue, such as audio narrating the error. For a visual-only test, remove that clue and use neutral filenames. Keep legitimate audio in a separate test of the real multimodal feature.
When an SDK or decoder changes, run the synthetic clips first. On failure, attach the differing source indices and the smallest contact sheet that explains the change. Then rerun a small set of real recordings with legible banners, motion blur and empty controls. That pair of tests lets the developer who owns the sampler and the person who evaluates answers investigate the same failure with different evidence.
FAQ
What FPS do I need for a quarter-second event?
For the regular grid in this fixture, four samples per second capture at least one frame of every six-frame flash. A real banner might spend half that interval fading in. Label the interval during which a person can read the text at the submitted resolution, then test your actual sampler against that shorter window.
Can I just increase the video file’s FPS before uploading it?
Duplicating frames cannot recover pixels the recorder missed. If the original contains the event, the downstream selection policy determines whether it survives. Run the same marked clip through both upload paths and compare the delivered timestamps where available.
How can I tell whether the model guessed correctly?
Give it a visually similar blank clip and vary the event content among positive clips. For text, randomize a short code on the banner and require the exact code in the answer. A correct yes-or-no guess then carries much less weight than reading the right value on the right clip.
Is scene-change detection enough for short UI warnings?
A small toast can change only a few pixels in an otherwise static desktop. Test the scene detector with a realistically sized toast and check its chosen frames. A full-screen flash is convenient for verifying timing but makes a poor stand-in for the visual size of a notification.
How should I score an event that requires two frames?
Define what each frame must show and the order the frames must appear in. Count the event as covered only when both conditions hold on distinct source frames. Then test whether the model can explain the transition. This keeps a duplicated image of the final state from earning credit for an action it never showed.
Top comments (0)