HTML5 video: jump to a specific frame rather than a time position? Or step paused video to next or previous frame?

Viewed 1517

When I have a HTML5 video object, I can set its currentTime property to jump (seek) to a specific time position.

Is there also a way to jump or seek to a specific frame number?

Or related: is there a way for a paused video to step or skip to the next or previous frame?
I mean when it's currently paused or freezes at some arbitrary position, cause the video to jump to the succeeding or preceding frame.

1 Answers

As mentioned in the comments, and AFAIK, there is no standard defined to support frame accurate seeking for the HTML5 video tag itself, other than the mentioned 'seekToNextFrame' which is not widely supported as you can see here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/seekToNextFrame

There are commercial Javascript HTMl5 players which provide this functionality - e.g.:

You'll also find discussion on this topic in the open source Shaka player discussion groups.

The reason it is not straightforward is that it usually requires the player or the browser (or something client side) to first find the nearest 'I' frame and then to decode forwards and/or backwards from that to get to the exact frame you want. It's certainly technically possible, as proven by the above example implementations, but I would guess there has not been the demand in the browser or open source player community to prioritise this functionality.

Related