[Libav-user] about index_entries in AVStream

YIRAN LI mrfun.china at gmail.com
Tue Sep 10 04:53:33 CEST 2013


Hi,

I met a problem when doing seek in a mpeg file (MPEG2 encoded MPEG-PS
video).

After the file is opened using avformat_open_input, seems the index_entries
of video stream is populated with incorrect values (the comment says these
index_entries are only used if format does not support seeking natively). I
can directly call av_seek_frame and it succeeded on this file. But I don't
understand if those index_entries are not valid, why they get populated
when file is opend

So I'd like to know if there's a way to judge if the index_entries are
valid, or if there's a list telling me what format natively doesn't support
seek (So if I know which format supports direct seek, I can ignore
index_entries and seek directly)

the index_entries of that mpeg files has following timestamps:

00:00:19.267  MAIN  entry[0].time = 21600
00:00:20.109  MAIN  entry[1].time = 57600
00:00:20.842  MAIN  entry[2].time = 100800
00:00:20.842  MAIN  entry[3].time = 144000
00:00:20.842  MAIN  entry[4].time = 187200
00:00:20.842  MAIN  entry[5].time = 230400
00:00:20.842  MAIN  entry[6].time = 273600
00:00:20.842  MAIN  entry[7].time = 316800
00:00:20.842  MAIN  entry[8].time = 360000
00:00:20.842  MAIN  entry[9].time = 403200
00:00:20.842  MAIN  entry[10].time = 446400
00:00:20.842  MAIN  entry[11].time = 489600
00:00:20.842  MAIN  entry[12].time = 532800
00:00:20.842  MAIN  entry[13].time = 576000
00:00:20.842  MAIN  entry[14].time = 619200
00:00:20.842  MAIN  entry[15].time = 662400
00:00:20.842  MAIN  entry[16].time = 705600
00:00:20.842  MAIN  entry[17].time = 285264000

the last timestamp is quite close to the end of video so the first 17 are
quite close to the beginning. So if I seek based on these indexes, it
always goes to the the very beginning first.

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130910/bfad9e6e/attachment.html>


More information about the Libav-user mailing list