Re: Seeking Postion in an .avi file

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi,
Thank you very much.It was quite useful to me.Would you please give me some
details about writing an interleaved 'rec' chunk?What do we specify in
dwInitialFrames field?If I specify audio preload value, does that mean a
single rec chunk always have sound data first followed by video data.Do I
need to implement a timer to decode/encode rec chunk.
Many Thanks


"Alessandro Angeli [MVP::DigitalMedia]" wrote:

> Judi wrote:
>
> > Am not using MSDN APis.Iam writing the code on my own.I
> > would like to know ,where the position information
> > resides in an .avi format file.
>
> Then I don't know what you mean by position information in
> an AVI file. If you are parsing the RIFF structure of the
> AVI yourself, you should have noticed that an AVI just
> contains the stream format definitions, the interleaved
> stream data and the optional index.
>
> If you want to seek to time T in the clip timeline, you must
> guess the byte offset in the file where the sample at time T
> is stored. To do that, you must scan the file and count the
> samples, because there is no timing information in the AVI
> itself, taking into consideration the bitrate for audio (if
> the audio is CBR, otherwise you can not reliably seek the
> audio) and frame rate for video (which is constant for AVI,
> so it is reliable). The information in the index will help
> you scan the file in a very efficient way.
>
> Of course, you must also take into account dropped samples
> (usually dropped video frames), and the video frame types
> (key- or delta-frame) because you can not start decoding
> from a delta-frame (and only the index will tell which
> frames are keyframes). You must also take into account the
> audio preroll.
>
> Also, when you have a video format with bidirectionally
> predicted frames (like MPEG-4 using B-BOPs), the frame order
> in the file is not the presentation order, so you may have
> frame lag when you seek and there is no reliable way to
> handle this only based on the info in the AVI.
>
>
> --
> // Alessandro Angeli
> // MVP :: Digital Media
> // a dot angeli at psynet dot net
>
>
>
.



Relevant Pages