Skip to content
Product updates

How we built frame-accurate video comments

Timestamps are not frames. A short look at how video comments in Ferrybox land on the exact frame, even with variable frame-rate phone footage.

Tom Whitaker, Engineering Lead
2 min read

Illustration of squares growing in size until they cross a dashed line
On this page

Video review was the most requested feature in our first two years. Clients wanted to comment on a moment, not on a file. This is a short look at how we built frame-accurate comments, and what turned out to be harder than expected.

Timestamps aren't frames#

The obvious approach is to store a timestamp with each comment. It almost works. The problem is that browsers report playback position slightly differently, and a timestamp of 12.48 seconds can land on different frames depending on the video's frame rate and the browser.

For "around the middle", that's fine. For an editor trying to fix a single-frame flash, it isn't.

So we store the frame number, not the time. When a video is uploaded, we read its frame rate and keep it with the version. Comments convert the player's position to a frame, and markers on the timeline convert back.

Variable frame rates#

Most professional video has a constant frame rate. Phone footage often doesn't. If you calculate frames from time on a variable-rate file, comments drift as the video goes on.

We handle this by generating a frame index when a video is processed: a list of exact timestamps for every frame. Seeking to a comment uses the index, not a calculation.

Comparing versions#

When a new cut is uploaded, old comments need to stay meaningful. If the editor removed two seconds near the start, a comment at frame 900 in v2 is about a different moment in v3.

We don't try to move comments automatically. Instead, comments stay on the version they were made on, and side-by-side compare lets the client check whether their notes were addressed.

What's next#

We're working on comments on a range of frames, so clients can mark a whole shot rather than a single moment. It's the second most requested video feature, after the one we just shipped.

Keep reading

All posts