Search code examples
c++vfw

Edit the frame rate of an avi file


Is it possible to change the frame rate of an avi file using the Video for windows library? I tried the following steps but did not succeed.

  1. AviFileInit
  2. AviFileOpen(OF_READWRITE)
  3. pavi1 = AviFileGetStream
  4. avi_info = AviStreamInfo
  5. avi_info.dwrate = 15
  6. EditStreamSetInfo(dwrate) returns -2147467262.

Solution

  • I'm pretty sure the AVIFile* APIs don't support this. (Disclaimer: I was the one who defined those APIs, but it was over 15 years ago...)

    You can't just call EditStreamSetInfo on an plain AVIStream, only one returned from CreateEditableStream.

    You could use AVISave, then, but that would obviously re-copy the whole file.

    So, yes, you would probably want to do this by parsing the AVI file header enough to find the one DWORD you want to change. There are lots of documents on the RIFF and AVI file formats out there, such as http://www.opennet.ru/docs/formats/avi.txt.