Even though you can already generate AVI files, this library has not reached a final version yet and is still a work in progress. You've been warned... ;)
libgwavi is a fork of
libkohn-avi. It is a tiny C library aimed at creating
Original credits go to Michael Kohn, who released his library under the LGPL license. He, however, allowed me to release my forked version under the less restrictive 3-clause BSD license so... Thanks to him!
Anyway, why the fork you might ask? I used it in an application that needed the
library to be reliable. So here is what has already changed from
added library documentation
removed dead code
improved error checking
added unit tests
This library has no dependencies, you only need the standard C library.
libgwavi.so, just type the following from the root's directory:
To generate the documentation of the library functions, type the following:
The code includes a demo application that uses
libgwavi. You can build it
using this command:
HOW TO USE IT
For a complete example, have a look at the demo application in the examples folder.
If your in a hurry, here is a small explanation on how to use it.
First, you need to include the header file.
There is basically four main function that you will need to use:
Please, note that error checking has been voluntarily omitted int the examples below for the sake of the clarification.
So first, you should declare a
gwavi_t structure and initialize it. You can
optionally declare a
gwavi_audio_t structure if you need to add an audio
channel to your AVI file.
struct gwavi_t *gwavi; struct gwavi_audio_t audio; gwavi = gwavi_open("foo.avi", 1920, 1080, "MJPG", 30, &audio);
Note that the audio channel is optional and that you can pass
NULL as the last
gwavi_open() if you don't need it.
Then you add your video frames:
gwavi_add_frame(gwavi, buffer, buffer_length);
You can also add audio with
And at the end, you can close the output file and free the allocated memory by
The library documentation can be generated with
make doc if you have
doxygen installed. Otherwise, you can just visit