I'm creating a large 640x480 AVI file (about 250MB, about 60 frames, uncompressed RGB, video only), using Windows functions
AVIFileCreateStream(), AVISaveOptions(), AVIMakeCompressedStream(), AVIStreamSetFormat(), AVIStreamWrite(), etc...
and when playing it back in Windows Media Player, it is extremely slow and choppy.
However, if I take the same AVI file, import it into VirtualDub, and write it out again (I change nothing), it plays much better.
Why is this?
I've compared the bitmap data and indexing in both AVI files, and they are identical. VirtualDub has built-in hex editor that
lets you view the RIFF chunk tree. It looks like VirtualDUB writes out some extra 'odml' chunk and JUNK description chunk,
but besides that, I see no real difference. Those chunks don't contain any important data.
+ Reply to Thread
Results 1 to 11 of 11
-
-
What about the A/V multiplexing/interleaving? VirtualDub interleaves one frame of video and one frame worth of audio by default. If the "bad" file has all the video at the start and all the audio at the end the drive will have to seek back and forth a lot.
Note the alternating stream 0 and stream 1 chunks. -
This is a video only file (no audio). There is only one stream 0. No interleaving data. Windows Media Player stuggles to play it,
as if it's buffering huge amounts of data. I even modified the existing headers so they contained the same info and flags as VirtualDub,
but it still lags.
I thought it might be some padding issue, but I think this is the purpose of the JUNK chunk? To pad the section with zeroes,
so the data is aligned? But I would think Windows already knows how to pad their own file format. -
Sorry, I missed that your file was video only. Yes, the JUNK chunk is there to align the video data. But with modern operating systems and hard drives that's not critical. Your file is small enough that an ODML header isn't necessary.
When you compare playback of the two video files -- are they on the same hard drive? Same partition? 640x480 uncompressed RGB at 30 (?) fps is getting close to the transfer limits for many hard drives. Especially on the inner cylinders.
Any chance the problematic file is 32 bit RGB? -
I write 24-bit bitmap images, properly DWORD-aligned.
Code:BITMAPINFO binfo; memset( &binfo, 0, sizeof(BITMAPINFO)); binfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); binfo.bmiHeader.biWidth = 640; binfo.bmiHeader.biHeight = 480; binfo.bmiHeader.biPlanes = 1; binfo.bmiHeader.biBitCount = 24; binfo.bmiHeader.biCompression = BI_RGB; binfo.bmiHeader.biSizeImage = WIDTHBYTES(binfo.bmiHeader.biWidth * 24) * binfo.bmiHeader.biHeight; AVISTREAMINFO stream; memset( &stream, 0, sizeof(AVISTREAMINFO)); stream.fccType = streamtypeVIDEO; stream.fccHandler = 0; stream.dwScale = 1; stream.dwRate = (DWORD)30 stream.dwQuality = (DWORD)-1; stream.dwSuggestedBufferSize = binfo.bmiHeader.biSizeImage; strcpy( stream.szName, name ); SetRect( &stream.rcFrame, 0, 0, info.bmiHeader.biWidth, info.bmiHeader.biHeight );
-
I do realize that this is lot of data to process at 30fps, but I don't understand why running it through VirtualDub seems to cure
my buffering problems with WMP? -
It plays extremely smooth in VirtualDUB. It also plays well in Quicktime too after the first run has cached it memory.
Only WMP has problems with it. -
Perhaps the difference I'm seeing has something to do with the way the AVI file was created?
When I create the AVI file, it's created frame by frame. But, when I run through VirtualDUB, it already knows everything about the file,
and perhaps the newly created AVI file is less fragmented?
But I don't think that would do anything unless WMP is accessing it directly from file, and not from memory.
Does that make any sense? -
Originally Posted by JeffM
Similar Threads
-
slow HD playback even though i have an okay PC (pic)
By edgeofthecosmos in forum DVB / IPTVReplies: 28Last Post: 30th Jul 2011, 20:17 -
Movie slows playback like slow motion
By skorpinok in forum Newbie / General discussionsReplies: 1Last Post: 11th Sep 2010, 04:10 -
Very slow playback software
By bryankendall in forum Newbie / General discussionsReplies: 2Last Post: 26th Jun 2010, 15:30 -
Slow playback on HD MP4 video
By excelsion in forum Newbie / General discussionsReplies: 3Last Post: 23rd Jan 2009, 23:22 -
Slow MKV 1080p Playback!
By The_WRATH in forum Newbie / General discussionsReplies: 3Last Post: 19th Aug 2008, 13:50