VideoHelp Forum




+ Reply to Thread
Results 1 to 6 of 6
  1. Hello,

    I am using AVIStreamRead to read AVI video,
    AVIStreamRead(gapavi[0], i, 1, frame, bsize, &nBytes, &nSamples)

    but the data returned in frame is shifted 3 DWORDs. for example
    the data returned in frame is:
    00 00 00 00 30 30 64 63 00 60 09 00 86 79 87 80 ...

    where 86 is the first pixel of the video. and I think 30 30 64 63 (00dc) means video chunk
    and 00 60 09 00 is the picture size (buffer size) first four 00 are last JUNK chunk data

    So anyone know why AVIStreamRead read the data wrong? really appreciate your help.
    thanks in advance.
    Quote Quote  
  2. 00 60 09 00 is the chunk size in little endian format -- 0x00096000 or 614400 bytes. I'm not sure what your issue is but VirtualDub has a nice hex editor with a RIFF Chunk Tree view (Tools -> Hex Editor) that will show you the structure of the AVI file.
    Quote Quote  
  3. yes, the size is 640x480, yuy2 format, so the buffer is 614400.
    my question is why AVIStreamRead put
    00 00 00 00 30 30 64 63 00 60 09 00 86 79 87 80 ...
    in buffer instead of
    86 79 87 80 ...

    where 86 is the real first pixel of the picture.

    note: the movi has JUNK as its first chunk followed by 00db ...

    thank you
    Quote Quote  
  4. Junk chunks are used to align the following chunks on 512, 1024, 4096 etc. byte boundaries.

    It's been a very long time since I've programmed VFW. Maybe AviStreamRead() is supposed to return the ID and length fields along with the data?

    <edit>
    I went back and looked at the VFW lib docs and it doesn't look like AviStreamRead() is supposed to read the ID and length fields. Maybe you should post your source code and someone will review it?
    </edit>
    Last edited by jagabo; 3rd Apr 2010 at 11:48.
    Quote Quote  
  5. I think it is a bug in AVIStreamRead, if the movi first chunk is not JUNK, it read pixels to buffer OK. but if first chunk is JUNK, the first data in buffer is not not the first pixel...

    thank you
    Quote Quote  
  6. Weird. But that's Microsoft for you!
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!