oteem
28th May 2007, 01:03
I'm trying to experiment on creating my own uncompressed soundless avi files, but Windows Media Player fails with error "Windows Media Player cannot play the file. The file is either corrupt or the Player does not support the format you are trying to play." I'd like to find out what I'm doing wrong, or in some other way find out how to create video files programatically. So any answer to either question below is highly appreaciated.
1. Is there a simple example I can download an uncompressed (24-bit RGB) avi-file? It might be small in size and length, I'm only interrested in how the file is put together. Preferably without sound.
2. Is there some code I can include (C++) for creating uncompressed files, where I specify the RGB-value of every pixel in every frame?
3. This is how my avi-file is put up. What am I doing wrong? (pixel size is 256 x 256, 100 frames total, 25 frames/sec)
RIFF ('avi '
LIST ('hdrl'
'avih' [ from struct AVIHEADER ]
dwMicroSecPerFrame = 40000
dwMaxBytesPerSec = 25 * (8 + 256*256*3)
dwPaddingGranularity = 1
dwFlags = 0
dwTotalFrames = 100
dwInitialFrames = 0
dwStreams = 1
dwSuggestedBufferSize = 8 + 256*256*3
dwWidth = 256
dwHeight = 256
dwReserved[4] = {0, 0, 0, 0}
LIST ('strl'
'strh' [ from struct AVISTREAMHEADER ]
fccType = 'vids'
fccHandler = 'raw '
dwFlags = 0
wPriority = 0
wLanguage = 0
dwInitialFrames = 0
dwScale = 400000 [ example copied from a compressed avi-file already available ]
dwRate = 10000000 [ as above ]
dwStart = 0
dwLength = 100
dwSuggestedBufferSize = 8 + 256*256*3
dwQuality = 0
dwSampleSize = 0
left = 0 [2 bytes]
top = 0 [2 bytes]
right = 256 [2 bytes]
bottom = 256 [2 bytes]
'strf' [ from struct BITMAPINFO and RGBQUAD ]
biSize = 40 [4 bytes]
biWidth = 256 [4 bytes]
biHeight = 256 [4 bytes]
biPlanes = 1 [2 bytes]
biBitCount = 24 [2 bytes]
biCompression = 'raw ' [4 bytes]
biSizeImage = 0 [4 bytes]
biXPelsPerMeter = 0 [2 bytes]
biYPelsPerMeter = 0 [2 bytes]
biClrUsed = 0 [4 bytes]
biClrImportant = 0 [4 bytes]
RGBQUAD = 0 [4 bytes]
)
)
LIST ('movi'
'00db' {256*256*3 bytes}
'00db' {256*256*3 bytes}
...
'00db' {256*256*3 bytes}
)
)
1. Is there a simple example I can download an uncompressed (24-bit RGB) avi-file? It might be small in size and length, I'm only interrested in how the file is put together. Preferably without sound.
2. Is there some code I can include (C++) for creating uncompressed files, where I specify the RGB-value of every pixel in every frame?
3. This is how my avi-file is put up. What am I doing wrong? (pixel size is 256 x 256, 100 frames total, 25 frames/sec)
RIFF ('avi '
LIST ('hdrl'
'avih' [ from struct AVIHEADER ]
dwMicroSecPerFrame = 40000
dwMaxBytesPerSec = 25 * (8 + 256*256*3)
dwPaddingGranularity = 1
dwFlags = 0
dwTotalFrames = 100
dwInitialFrames = 0
dwStreams = 1
dwSuggestedBufferSize = 8 + 256*256*3
dwWidth = 256
dwHeight = 256
dwReserved[4] = {0, 0, 0, 0}
LIST ('strl'
'strh' [ from struct AVISTREAMHEADER ]
fccType = 'vids'
fccHandler = 'raw '
dwFlags = 0
wPriority = 0
wLanguage = 0
dwInitialFrames = 0
dwScale = 400000 [ example copied from a compressed avi-file already available ]
dwRate = 10000000 [ as above ]
dwStart = 0
dwLength = 100
dwSuggestedBufferSize = 8 + 256*256*3
dwQuality = 0
dwSampleSize = 0
left = 0 [2 bytes]
top = 0 [2 bytes]
right = 256 [2 bytes]
bottom = 256 [2 bytes]
'strf' [ from struct BITMAPINFO and RGBQUAD ]
biSize = 40 [4 bytes]
biWidth = 256 [4 bytes]
biHeight = 256 [4 bytes]
biPlanes = 1 [2 bytes]
biBitCount = 24 [2 bytes]
biCompression = 'raw ' [4 bytes]
biSizeImage = 0 [4 bytes]
biXPelsPerMeter = 0 [2 bytes]
biYPelsPerMeter = 0 [2 bytes]
biClrUsed = 0 [4 bytes]
biClrImportant = 0 [4 bytes]
RGBQUAD = 0 [4 bytes]
)
)
LIST ('movi'
'00db' {256*256*3 bytes}
'00db' {256*256*3 bytes}
...
'00db' {256*256*3 bytes}
)
)