[FFmpeg-devel] [PATCH] lavf: add a concat demuxer.

Nicolas George nicolas.george at normalesup.org
Mon Aug 27 19:44:43 CEST 2012


Le nonidi 9 fructidor, an CCXX, Michael Niedermayer a écrit :
> if this would also work with timestamp discontinuities within files
> (possibly through a full demux scan through the file and possibly
> also through caching of the timestamp info in some file)
> then this would allow timestamp accurate seeking in mpeg-ts/ps with
> discontinuities. At the cost of some startup delay
> this could be quite usefull sometimes i think ...

I am not completely sure this is related, but I do not understand the
generic seeking code well enough to be sure. Can you correct if I am
mistaken:

At startup, tu MPEG-[PT]S demuxers seek near the end of the file to get the
duration.

When a seek is requested and there is no index, the seek engine finds the
two nearest known seek points and does a binary search by offset between
them, making the demuxer read a packet to get the timestamp.

When there are discontinuities, it does not work because it is not possible,
when reading the timestamp from a packet after seeking in the file, to know
whether the discontinuity is before or after, or maybe both.


A trivial solution would be to walk through the whole file and let the
demuxer build the index of all seek points and be ready, like mplayer does
with the -idx option. In that mode, discontinuities can be detected and
compensated. Maybe just setting analyzeduration and probesize to huge values
would be enough to implement that method.

A more efficient way would be to seek by small amounts in the file, but that
requires to have a predefined idea of what the discontinuities look like (go
back from 2^33 to 0? from anything to 0? from anything to anything else?).

In any case, it may be possible to dump the detected discontinuities, and
then to accept them back later in the same format, avoiding the need for a
new scan.

Am I speaking complete nonsense?

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120827/b353eb58/attachment.asc>


More information about the ffmpeg-devel mailing list