-2

My task is to create an avi file by saving n number of frames in c++ . There are many inbuilt function which can be used to create .avi file as given in below link .

https://learn.microsoft.com/en-us/windows/desktop/multimedia/avifile-reference

Using them we can create our own avifile , one such example.is

http://www.wischik.com/lu/programmer/avi_utils.html

But i want to create it without using Windows.h and vfw.h as they are very extensive. So i need to make my own function of avifilewrite , appendframes etc But i can't find any reference link on internet .

Can anyone please explain how can i build avifile without using Windows.h and vfw.h .

Thank you ,

Zaid
  • 31
  • 5
  • 3
    If you can't stomach calling someone else's API, then you aren't going to have much success writing your own implementation either. I recommend either biting the bullet and learning how to use the Microsoft calls, or finding some other library that you like better that does the same thing and using that. Trying to write your own implementation would be an enormous commitment and it is unlikely to yield useful results. – Jeremy Friesner Oct 24 '18 at 17:02
  • 3
    This is not even remotely a trivial task. Unless the requirement is to reinvent the wheel (make your own avi library) use a library. You will save weeks to months of work. – drescherjm Oct 24 '18 at 17:04
  • 2
    You really don't want to write your own AVI file from scratch, the format is arcane, extremely quirky, and while documented, is not necessarily friendly. Use a library or Windows API for that's already tested as working. Video encoding is difficult enough as it is. – tadman Oct 24 '18 at 17:10
  • Any Windows executable that does anything useful will use the Windows API (possibly indirectly) - trying to avoid it is silly. –  Oct 24 '18 at 17:11
  • What if i just need to save one frame , is that simplify the task , actually my instructor want me to do that for better understanding of structure of avi file – Zaid Oct 24 '18 at 17:20
  • 1
    Sounds like you are being set up to write your own as a learning exercise. That pretty much dooms you to A) read the standard. B) implement enough of the standard to perform the tasks you require. It does not seem like there are any worthwhile shortcuts here. – user4581301 Oct 24 '18 at 17:36
  • I assume that your professor should at least help with this task in the course lectures. Maybe you are trying to start the assignment too early. – drescherjm Oct 24 '18 at 17:58

1 Answers1

2

How to create an ... file ...?

You can use the standard file stream API to create a file. To write a binary file, you'll need to use an unformatted output function such as std::ofstream::write().

... an avi file from scratch?

The AVI format is specified by Microsoft: https://learn.microsoft.com/en-us/windows/desktop/directshow/avi-riff-file-reference

However, you can save a lot of effort by using an existing API.

eerorika
  • 232,697
  • 12
  • 197
  • 326