klaushorst
Programmer
Hello,
when I try to read large AVI files (> 1 or 2GB) with the MFC AVI API,
then it works without problems as long as the frame number is below of
a limit. If I'm above of a certain value, then AVIStreamRead returns
AVIERR_FILEREAD. It has something to do with a 1GB (or sometimes,
dependant of the Codec?) or 2GB limit. As long as the frames are
within the first GB of the AVI, I can read them, when they are behind
the 1 GB of the AVI, the error is returned. The sample code shows the
steps I did.
I'm wondering, that other programs (Windows MM player) have no
problems with these large AVIs. Is there a workarround for my problem?
Or am I doing something wrong? Should I use other APIs?
Thanks in advance
-Klaus Horst-
=============================================================================================
PAVIFILE pAviFile;
PAVISTREAM pVideoStream;
ULONG Result;
ULONG FrameNr;
LONG BytesRead;
static BYTE Buffer[2000000];
AVIFileInit();
// LARGE.AVI contains 9000 frames, size is 1.5GB
Result = AVIFileOpen (&pAviFile, "D:\\TEMP\\LARGE.AVI", OF_READ |
OF_SHARE_DENY_WRITE, NULL);
if (Result)
{
... cleanup, display error and return
}
Result = AVIFileGetStream (pAviFile, &pVideoStream, streamtypeVIDEO,
0);
if (Result)
{
... cleanup, display error and return
}
FrameNr = 0; // this works
FrameNr = 3000; // this works also
FrameNr = 8000; // this returns AVIERR_FILEREAD
Result = AVIStreamRead (pVideoStream, FrameNr, 1, Buffer, sizeof
(Buffer), &BytesRead, NULL);
if (Result)
{
... cleanup, display error and return
}
... cleanup and return
=============================================================================================
when I try to read large AVI files (> 1 or 2GB) with the MFC AVI API,
then it works without problems as long as the frame number is below of
a limit. If I'm above of a certain value, then AVIStreamRead returns
AVIERR_FILEREAD. It has something to do with a 1GB (or sometimes,
dependant of the Codec?) or 2GB limit. As long as the frames are
within the first GB of the AVI, I can read them, when they are behind
the 1 GB of the AVI, the error is returned. The sample code shows the
steps I did.
I'm wondering, that other programs (Windows MM player) have no
problems with these large AVIs. Is there a workarround for my problem?
Or am I doing something wrong? Should I use other APIs?
Thanks in advance
-Klaus Horst-
=============================================================================================
PAVIFILE pAviFile;
PAVISTREAM pVideoStream;
ULONG Result;
ULONG FrameNr;
LONG BytesRead;
static BYTE Buffer[2000000];
AVIFileInit();
// LARGE.AVI contains 9000 frames, size is 1.5GB
Result = AVIFileOpen (&pAviFile, "D:\\TEMP\\LARGE.AVI", OF_READ |
OF_SHARE_DENY_WRITE, NULL);
if (Result)
{
... cleanup, display error and return
}
Result = AVIFileGetStream (pAviFile, &pVideoStream, streamtypeVIDEO,
0);
if (Result)
{
... cleanup, display error and return
}
FrameNr = 0; // this works
FrameNr = 3000; // this works also
FrameNr = 8000; // this returns AVIERR_FILEREAD
Result = AVIStreamRead (pVideoStream, FrameNr, 1, Buffer, sizeof
(Buffer), &BytesRead, NULL);
if (Result)
{
... cleanup, display error and return
}
... cleanup and return
=============================================================================================