Using avifile-0.7.10-20020710.
I am trying to read in a MJPEG AVI created with lavrec in order to
learn how the library works.
The following loop tries to read all the frames:
-----------------------------------------------
video_stream->StartStreaming ();
while (video_stream->GetPos() < video_stream->GetLength())
{
cerr << "Current time is " << video_stream->GetTime () << endl;
cerr << "Current frame is " << video_stream->GetPos () << endl;
video_stream->ReadFrame ();
CImage * frame = video_stream->GetFrame ();
if (frame == NULL)
{
cerr << "Failed to get frame" << endl;
return 4;
}
cout << "Format number: " << frame->Format() << endl;
cout << "Bpp: " << frame->Bpp() << endl;
cout << "Bpl: " << frame->Bpl() << endl;
frame->Release();
}
-------------------------------------------------
However, each iteration reports the current frame as 0, and the
current time as twice what it was in the previous frame. Bpp is also
reported as 2, which seems unlikely.
Here are the more interesting lines of the output:
-------------------------------------------------
<AVI reader> : Reading index from 59217144
<AVI reader> : Stream 0 vids : 0x47504a4d (MJPG) 1810 chunks (28.28KB)
<AVI reader> : Stream 1 auds : 0x1 (PCM) 1301 chunks (20.33KB)
<StreamCache> : Creating cache for file descriptor: 3
<ReadStream> : Initialized video stream (chunk tblsz: 1810, fmtsz: 40)
<ReadStream> : Initialized audio stream (chunk tblsz: 5325366, fmtsz: 18)
<AVI reader> : Successfully opened test.avi
Number of streams: 2
Number of audio streams: 1
Number of video streams: 1
Video Stream Length: 1810
Audio Stream Length: 5325366
... <codec stuff snipped>
libavcodec: CPU flags: mmx mmxext 3dnow
<Codec keeper> : FFMPEG Motion JPEG video decoder created
Current time is 0
Current frame is 0
<Avi ReadV> : w:640 h:-480 bpp:12 0x32315659 - 1:1 (0x806a790)
mjpeg: workarounding buggy AVID
mjpeg: interleaved rows: 1
Format number: 842094169
Bpp: 2
Bpl: 640
Current time is -2.1684e-19
Current frame is 0
Format number: 842094169
Bpp: 2
Bpl: 640
Current time is -0.033367
Current frame is 0
Format number: 842094169
Bpp: 2
Bpl: 640
Current time is -0.133468
Current frame is 0
Format number: 842094169
Bpp: 2
Bpl: 640
Current time is -0.367037
Current frame is 0
Format number: 842094169
Bpp: 2
Bpl: 640
------------------------------------------------
avifile.h says that ReadFrame increments the position counter:
/**
* Reads one frame, decompresses it into internal buffer
* and increases position counter.
*/
virtual int ReadFrame(bool render = true)
Why does my frame number not increase?
Thanks,
Eric Buddington
[EMAIL PROTECTED]
_______________________________________________
Avifile mailing list
[EMAIL PROTECTED]
http://prak.org/mailman/listinfo/avifile