[FFmpeg-devel] pts/dts generation and index for mpegts (vob)

Erik Van Grunderbeeck erik
Sat Apr 25 14:59:25 CEST 2009

On Behalf Of Michael Niedermayer

> Also timestamp discontinuities are real not just theory, rests to 0 per
> chapter or even once every few seconds do occur in real streams out
> there.
Yes. I have seen end-of-vob cases where keyframes wrap around pts to the
beginning, with no chapter jump.

> and yes i can confirm neither seeking nor duration calc deals with
> this.
> The easy fix to both is to assume approximate CBR and seek per byte.
That's my fix now. 

> Iam not aware of a 100% working solution to do exact seeking and
> duration calls that isnt O(filelength). Though even that may be usefull
> to some like video editors that need exact values even if theres a
> 30sec initial delay (of course that would have to be optional) and then
> seeking 10sec ahead or back from the current spot can probably done
> reasonably exact and with reasonable speed ...

One thing I was thinking on was rebuilding the index code based on a binary
tree, with a hash key based on fileoffset/timestamp/streamid. That would
solve the case where invalid timestamps are returned. But it is too much
work (and change) just to fix that, I am muzzling over what other advantages
there might be (possibly solving the nr memcopies and the linear search
through the streams to find the correct stream-id)

Something I have been looking at is to have the pts generated when playing
back (since ffmpeg can generate them for the target container/streams when
transcoding). But I haven't figured out how that would best be done.

Reason for all is that I wrote a simple protocol handler to allow multiple
files to be concated/searched at once (basically what one would get on a
cat/copy+ manually). It works fine for ffmpeg and ffplay in pure streaming,
but searching is totally of as noted.

> clean & seperate patches for all that are welcome questions &
> disscussion is welcome too ...
Much appreciated.


More information about the ffmpeg-devel mailing list