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.
+ Reply to Thread
Results 1 to 6 of 6
-
-
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.
-
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 -
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.
-
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
Similar Threads
-
Movie Audio to MP3 results in AVI File
By valier_l in forum ffmpegX general discussionReplies: 1Last Post: 23rd Mar 2012, 12:27 -
Strange remuxing results of AVI
By 201flyer in forum Video ConversionReplies: 0Last Post: 20th May 2010, 01:32 -
Play All and Return to Same menu Problem
By cassy in forum Authoring (DVD)Replies: 0Last Post: 22nd Dec 2009, 19:14 -
Black space on bottom and left/video shifted?
By divergex in forum Newbie / General discussionsReplies: 4Last Post: 30th Jun 2009, 20:32 -
AVI to DVD results in weird playback fault
By JustGreg in forum Video ConversionReplies: 0Last Post: 26th May 2008, 09:51