Re: Seeking Postion in an .avi file

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



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

  • Re: Seeking Postion in an .avi file
    ... single rec chunk always have sound data first followed by video data.Do I ... >> resides in an .avi format file. ... taking into consideration the bitrate for audio (if ... > audio) and frame rate for video (which is constant for AVI, ...
    (microsoft.public.win32.programmer.mmedia)
  • Re: size of DV/1394 video stream
    ... | into the AVI file with a few bytes of identifiaction at the head. ... is the need to work with that format to some degree, ... Simply storing raw DV into a file may not be what an NLE expects ... As long as I can see where one frame ends and another frame begins ...
    (rec.video.production)
  • Re: Matlab speed changes with license connection
    ... video frame by frame, create a trajectory list, and then an AVI of ... The AVI bit especially. ... First let me say something about license servers. ... Now back to the pesky movies. ...
    (comp.soft-sys.matlab)
  • Re: Saving to DV-AVI loses 6 seconds of movie length
    ... The dropped 27th frame isn't related to still pictures... ... >> with DV AVI. ... >> www.rehanfx.org - get transitions and effects for Windows Movie Maker ... >>> I am trying to overcome a bug in WMM2 with audio popping when saving to ...
    (microsoft.public.windowsxp.moviemaker)