[FFmpeg-devel] MPEG index entries

Michael Niedermayer michaelni
Tue Nov 6 19:56:58 CET 2007


On Tue, Nov 06, 2007 at 04:26:30PM +0100, Taylan O. Toygarlar wrote:
> 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.

improving seeking in mpeg-ps/ts is definitly welcome, as long as all
improvments are clean!
first, look at AVFMT_GENERIC_INDEX as the related code does already
extract keyframe positions, its just limited for raw files not mpeg-ps/ts
currently, thought its likely not hard to use it for mpeg-ps/ts as well

writing the (AV)Index out into a file is a interresting idea as well, if
done so that it works with all formats and if its done cleanly
that is no direct file IO like (f)open()/(f)write() but rather leaving it to
the application to decide how and where to store it

PS:dont top post please
PS2: keep the 2 things seperate (1 or more patches for mpeg ps/ts seeking
improvements and 1 or more patches for the index "writing"/"reading" no
huge hard to review patches please ...)

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071106/3346e6f1/attachment.pgp>

More information about the ffmpeg-devel mailing list