AVI just doesn't work....
Hi, i tried to use 2 different avi writing code (one from code project and one from variant) and they both crash after you say what compression you want. This because of some (it looks like a) infinite loop in MSVCRT (Context: MSVCRT! 77c13404).
Does anyone know how i can fix this?
Any help is very much appreciated!!!
It''s been awhile since I''ve used that code, and unfortunately I don''t have a ton of time to redo it. Have you tried different compression codecs each time? I do know that a large number of the codecs listed when you choose compression simply don''t work. Maybe even start with uncompressed frames ( I think that''s an option). I''ll try to look at it again if I get a chance.
I just tried it out with the nehe simple base code and it seems to work just fine. I tried it with uncompressed frames and the Indeo codec, which I think is pretty standard. Maybe you could give an example of how you incorporated the avi code into your framework?
Well, i used it uncompressed too. The problem is that when i call the initialization function (the function that calls the dialog in which you can choose the codec) the program jams, whatever i use for a codec. this is the code, how i implement it:
//Initialize avi generator
aviEngine = new AviCreator();
// Fill in the bitmap info
bmpInfo.biSize=sizeof(BITMAPINFOHEADER);
bmpInfo.biWidth=m_WindowWidth;
bmpInfo.biHeight=m_WindowHeight;
bmpInfo.biPlanes=1;
bmpInfo.biBitCount=24;
bmpInfo.biSizeImage=m_WindowWidth*m_WindowHeight*3;
bmpInfo.biCompression=BI_RGB;
RECT rect;
rect.left = 0;
rect.top = 0;
rect.right = m_WindowWidth;
rect.bottom = m_WindowHeight;
glPixelStorei(GL_PACK_ALIGNMENT,1);
aviEngine->setBitmapInfoHeader(bmpInfo);
aviEngine->setVideoRate(m_render_fps);
// The open funtion causes the jam, after the codec dialog
if(aviEngine->open("c:\\test.avi",rect) == FALSE){
MessageBox("Couldn\''t open file");
return false;
};
//Initialize avi generator
aviEngine = new AviCreator();
// Fill in the bitmap info
bmpInfo.biSize=sizeof(BITMAPINFOHEADER);
bmpInfo.biWidth=m_WindowWidth;
bmpInfo.biHeight=m_WindowHeight;
bmpInfo.biPlanes=1;
bmpInfo.biBitCount=24;
bmpInfo.biSizeImage=m_WindowWidth*m_WindowHeight*3;
bmpInfo.biCompression=BI_RGB;
RECT rect;
rect.left = 0;
rect.top = 0;
rect.right = m_WindowWidth;
rect.bottom = m_WindowHeight;
glPixelStorei(GL_PACK_ALIGNMENT,1);
aviEngine->setBitmapInfoHeader(bmpInfo);
aviEngine->setVideoRate(m_render_fps);
// The open funtion causes the jam, after the codec dialog
if(aviEngine->open("c:\\test.avi",rect) == FALSE){
MessageBox("Couldn\''t open file");
return false;
};
So far I haven''t figured anything out. I did find that if the window size isn''t divisible by four it may have problems with the AVI settings, but it shouldn''t hang, you should get a message box. Are you using a debugger? Do you know what command it seems to be hanging on?
Code: (in function AviCreator::open(char *name,RECT rect))
if(AVIStreamSetFormat(aviCompressedStream, 0, &bmpInfo,bmpInfo.biSize + bmpInfo.biClrUsed * sizeof(RGBQUAD)) != AVIERR_OK)
Disassembly:
77C13404 rep movs dword ptr [edi],dword ptr [esi]
Infinite loop? Something else? Anyway this is really strange...
Any help is really much appreciated!
if(AVIStreamSetFormat(aviCompressedStream, 0, &bmpInfo,bmpInfo.biSize + bmpInfo.biClrUsed * sizeof(RGBQUAD)) != AVIERR_OK)
Disassembly:
77C13404 rep movs dword ptr [edi],dword ptr [esi]
Infinite loop? Something else? Anyway this is really strange...
Any help is really much appreciated!
I''m in the process of switching computers so I don''t have access to my docs - so this is just a guess but I''ll take a stab at it:
You didn''t zero out the BITMAPINFOHEADER struture and thus there are undefined fields present. Some I don''t think matter - but a couple might. I did a quick check on the web and the first unofficial doc I found claimed that:
biClrUsed - blah blah blah "If biBitCount is 16 or greater, then biClrUsed member specifies the size of the color table" blah blah
I would also set biClrImportant to zero as well.
Now, I know your image is 24 bit rgb but this may affect the routines you are using.
Like I said - just a guess.
You didn''t zero out the BITMAPINFOHEADER struture and thus there are undefined fields present. Some I don''t think matter - but a couple might. I did a quick check on the web and the first unofficial doc I found claimed that:
biClrUsed - blah blah blah "If biBitCount is 16 or greater, then biClrUsed member specifies the size of the color table" blah blah
I would also set biClrImportant to zero as well.
Now, I know your image is 24 bit rgb but this may affect the routines you are using.
Like I said - just a guess.
Setting the ClrUsed and ClrImportant variables to zero resulted in acces violation in NVOGLNT.DLL (which i guess means NVidia OpenGL NT). So the init problem is fixed and the problem now lies with OpenGL.
What i did was using glReadPixels twice, once for bitmap capture and once for avi frame capture, i now use the same data (and therefor call it only once) and the error is fixed. Thanks a LOT JotDot!
I think the acces violation was simply caused because i didn''t allocate memory for the avi frame data array so nvoglnt.dll was writing to unallocated memory, anyway IT WORKS
!!
What i did was using glReadPixels twice, once for bitmap capture and once for avi frame capture, i now use the same data (and therefor call it only once) and the error is fixed. Thanks a LOT JotDot!
I think the acces violation was simply caused because i didn''t allocate memory for the avi frame data array so nvoglnt.dll was writing to unallocated memory, anyway IT WORKS

This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement