[vlc-devel] Video Time does not match Reported Time

Robert Forsman bob.forsman at ericsson.com
Mon May 13 16:21:37 CEST 2013

> > On Fri, May 3, 2013 at 12:06 AM, Rémi Denis-Courmont <remi at remlab.net>wrote:
> >
> >> On Thu, 2 May 2013 13:44:24 -0400, Eric Montellese <emontellese at gmail.com
> >> >
> >> wrote:
> >> > I've found that if I pause, and then call
> >> >        mediaPlayer.setTime(mediaPlayer.getTime();
> >> > there is a visual jump in the video.
> >>
> >> In general and depending on the file format, seeking is not accurate. VLC
> >> favors speed over accuracy; many file formats do not support accurate
> >> seeking in a reasonable computational time and with reasonable I/O usage.
> >>

Of the three formats I am familiar with:

MP4 makes it VERY easy to do a quick seek.  Part of its headers are the
'stts', 'stsc', and 'stco' boxes which make it O(log(n)) to find out
exactly where the video samples for a particular time code are.  This
is complicated by the fact that compressed video frames are usually
dependent upon each other.

MPEG transport streams are not quite as easy, since it's a streaming
format.  For constant bit rate stream it's not difficult to home in on
the exact video sample for a specific time, but it is also nowhere near
as trivial as it is for MP4s.  For variable bit rate streams, it takes
extra effort to find the proper file offset for a particular time since
linear interpolation is no longer as accurate.

MPEG DASH is built upon either of those formats, and the segmentation
speeds up finding the right frame in a transport stream.  For your
application (event marking) I would recommend the straight MP4 format
since it makes finding the right frame easiest.

What you want is theoretically possible, but I don't know how much open
source software has made the necessary engineering investments in its
infrastructure to optimize for frame seeking.

When it comes to frame accuracy, mythtv is the only video player I've
encountered that allows you to step forward AND BACKWARD by single

More information about the vlc-devel mailing list