?
Solved

AVI File Size Limit?

Posted on 2004-10-13
11
Medium Priority
?
580 Views
Last Modified: 2013-11-20
I'm not sure this is an MFC question, C++ or just plain windows.

I have a C++/MFC application that captures video. Is there a limit other than the size of my hard-drive to the size of the captured AVI? I thought I heard somewhere of a windows limitation on AVI files to ~2GB, but  I can't find a definitive answer.

thanks
-Paul
0
Comment
Question by:PMH4514
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 2
11 Comments
 
LVL 14

Accepted Solution

by:
wayside earned 200 total points
ID: 12302387
The the type of file system imposes a system limitation - FAT is 2 GB, FAT32 is 4 Gb, NTFS is essentially only limited by the volume size.

http://www.microsoft.com/windowsxp/home/using/productdoc/en/default.asp?url=/windowsxp/home/using/productdoc/en/choosing_between_NTFS_FAT_and_FAT32.asp

However, even on NTFS, the software you are using may restrict itself to  2 or 4 Gb limit depending on how it accesses files; for example, if  the program uses 32 bit addressing internally to control how it deals with files, you will be restricted to 4 Gb regardless of the file system.

0
 

Author Comment

by:PMH4514
ID: 12302689
hmm.. my capture works past those sizes.. (using 2000 Pro with NTFS)

I captured an AVI and stopped it at 4.3GB with my software. I then captured one and stopped it at 3.3 GB.. The 3.3GB one played just fine in windows media player.  the 4.3GB opened and played as well, only every frame was shifted over and down, maybe 200 pixels, with the "bumped off" portions appearing on the left and top respectively..  the capture is 24bit, all frames are black and white, and I "stamp" on each frame while capturing, a color rectangle in which I show text values.. the color is supposed to be blue, it is blue on the 3.3GB version, it is pink on the 4.3GB version..

so nothing crashed, and I know I'm writing frames out correctly because everything is good up to some point between 3.3GB and 4.3GB, at which point clearly Windows has a problem rendering it.. Any thoughts on this?

0
 
LVL 14

Expert Comment

by:wayside
ID: 12302923
> I know I'm writing frames out correctly because everything is good up to some point between 3.3GB and 4.3GB, at which point clearly Windows has a problem rendering it.

Until you can get the entire file to display correctly I'd say this is not a safe assumption.

Have you tried using a different player than WMP, such as Quicktime? It would be interesting to see how it looks on some other program.

Maybe there's a problem with your graphics drivers, see if there are any updates available, or try the playback on different hardware/OS and see what it looks like. XP for example will most likely do a better job of displaying video than W2K.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:Skonen
ID: 12303030
To test whether or not it is your software or the player. Create two 2.2 GB captures, or just 1 and duplicate it. Then join the files together, there are plenty of free programs to do it. Or you can write your own c++ joining operation. Attempt to play the file in the media player, if it works fine, then the problem is in your software. If it does not, the problem is caused by the player.
0
 
LVL 4

Expert Comment

by:Skonen
ID: 12303067
My guess is that you're using 32 bit data types when writing the file, an unsigned 32 bit data type can only store a value less than about 4.29 million,  which when used as a file size (bytes), equals just a little over 4 GB. __int64 is a prime example of a 64 bit data type, and it supports well over 4 GB's if used as a filesize.
0
 

Author Comment

by:PMH4514
ID: 12303712
thanks I'll take a look at the data type suggestion

>>Maybe there's a problem with your graphics drivers, see if there are any updates available, or try the playback on different hardware/OS and see what it looks like.

Perhaps.. I built a viewer into my app that uses the IMediaPlayer filter graph, and it shows up the same way.  I'll post again later on..
0
 

Author Comment

by:PMH4514
ID: 12309282
well the I downloaded a freeware movie joiner, it's running right now.. meantime, back to Skonen's comments, I'm using the following to open the file:

HRESULT hr = AVIFileOpen(&m_pAviFile, m_sMoviePath, OF_WRITE | OF_CREATE, NULL);

I don't see anything in MSDN that goes to the data type it uses.. or am I confused?

thanks
-Paul
0
 

Author Comment

by:PMH4514
ID: 12309851
- I used VirtualDub to join two 3.3GB files and a 2.1GB into huge file. It played back just fine.

But I don't understand, if the size of the AVI I'm writing to has an impact, wouldn't the first 4GB or less of frames be rendered correctly? My rendering is threaded, it's going on as frames are captured and buffered. When I stop capturing in my software, the rest of the frames in the memory buffer are written to the file and it is closed. If there were a size value at which the frames were corrupted, wouldn't the frames in the file leading up to that point be OK? After all, my software saves out a 3.3GB capture just fine.. (ie.. how would previously written frames be "gone back to and corrupted") ??

odd..
0
 
LVL 14

Expert Comment

by:wayside
ID: 12310330
> every frame was shifted over and down, maybe 200 pixels, with the "bumped off" portions appearing on the left and top respectively

I had b+w tv that used to do something like this when the vertical hold wasn't set properly. :)

I don't know anything about avi file formats or the MS avi api, so this is pure speculation, I don't even know if this makes sense...

As part of closing the file, does the avi api go back to the beginning of the file and write out some header information describing the length of the file, pixel size, etc? Perhaps there is a bug that this information gets incorrectly written when the file gets over a certain size.

Do you have tools that can analyze any header information? If you compare between files that work and files that don't,  perhaps you'll find something interesting.

Pure WAG on my part :)

Is there a newer SDK you could try? Maybe this bug has been fixed...
0
 

Author Comment

by:PMH4514
ID: 12311191
thanks wayside..  to close the file I use

AVIStreamClose
AVIFileRelease and
AVIFileExit
0
 

Author Comment

by:PMH4514
ID: 12311577
I just tried saving the AVI stream as 16bit.. while the image quality was shot as expected, I could still only to go just under 4GB before all frames seemed to get corruped.
0

Featured Post

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month14 days, 3 hours left to enroll

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question