Re: Seeking Postion in an .avi file
- From: "Alessandro Angeli [MVP::DigitalMedia]" <nobody@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 4 Jan 2006 11:50:19 +0100
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
.
- Follow-Ups:
- Re: Seeking Postion in an .avi file
- From: Judi
- Re: Seeking Postion in an .avi file
- References:
- Re: Seeking Postion in an .avi file
- From: Alessandro Angeli [MVP::DigitalMedia]
- Re: Seeking Postion in an .avi file
- Prev by Date: waveInOpen question
- Next by Date: VOIP application recorder
- Previous by thread: Re: Seeking Postion in an .avi file
- Next by thread: Re: Seeking Postion in an .avi file
- Index(es):
Relevant Pages
|