[FFmpeg-devel] MPEG index entries
Taylan O. Toygarlar
tozgorto
Tue Nov 6 16:26:30 CET 2007
Thanks for your reply Nico..
I know that mpeg files don't have indexes, and that's actually where the
problem starts. I cannot convert my files for two reasons, first I have
a huge amount of dataset(1000s of hours), and second, some files are
reached through network, or harddisk images for which I have written url
handlers for ffmpeg to work with, and which should stay actually read-only.
I have succeeded in having frame accuracy by saving the positions of
keyframes to an external index file, and then jumping to the keyframes
positions, but the parser/demuxer I used was external(It's actually
modified from AVIDemux source code), and they failed for some mpegs we
had. So now I want to manage the same thing from inside ffmpeg
libraries, which, in theory, should be possible.
I know the technique works as long as you seek to a relevant
position(bytewise) and sync the stream to the next keyframe(in order not
to have artifacts). If the information for the start of keyframes/GOP is
there, I'd like to use it to obtain the correct indexing.
I take the FIXME comment in the parser code as a bug, and my plan now,
is to fix the indexing for MPEGs, and have frame accurate seeks at least
for the part that has been parsed/decoded. After that I can write these
indexes to external files to use in subsequent operations.
As you suggested, I will look into AVParser for the GOP/keyframe start
positions.
All the best,
T.
Nico Sabbi wrote:
> mpeg files don't have indexes (almost: a kind of index structure
> is specified but no one ever used it), consequently seeking
> in mpeg files is random without an index.
> I've never looked at av_add_index(), but what it's being fed
> is the position of the starting position of the PES packet, that
> in no way indicates the position of a frame.
> Additionally, in order to know if a frame is a keyframe or not
> you have to rely on the AVParser, that is called on the already
> demuxed payload (that is, after the mpeg demuxer).
>
> If you want more accurate seeking to individual frame remux
> to a format with an index, such as AVI or use avidemux
> with its built-in indexer
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
--
Taylan Ozgur Toygarlar
Scientific Programmer, B.Sc.
Intelligent Systems Lab Amsterdam
__________________________________________
Faculty of Science - Informatics Institute
University of Amsterdam
Kruislaan 403 1098 SJ
Amsterdam, The Netherlands
Telephone: +31 20 525 7555
Mobile : +31 64 096 2866
Fax : +31 20 525 7490
__________________________________________
More information about the ffmpeg-devel
mailing list