libkohn_avi - AVI creator
This is a tiny library I made (with zero dependencies) for creating AVI files. It basically has 3 functions:
struct kavi_t *kavi_open(char *filename, int width, int height, char *fourcc, int fps, struct kohn_avi_audio_t *audio);
I've been working on an RTSP client API for recording video and decided
to add these three functions. As long as they are called before the AVI
file is closed, the framerate, codec, and size can be changed for the whole
To use this library, simply call kavi_open() to create the avi file, kavi_add_frame() for every raw frame, and kavi_close() to finalize it all. I included a sample program called jpeg2avi which can take a series of jpeg files and create an avi using the mjpeg codec. The mjpeg code of course is just an avi file with a series of jpegs in it. To use this program, if you had a directory full of jpegs with filenames like frame000.jpeg, frame001.jpeg, frame002.jpeg, etc, simply run jpeg2avi like so:
jpeg2avi out.avi /path/to/jpegs/frame%03d.jpeg 15
I also have a new demo program which I called axis2avi. It's a pretty short program that uses popen() with wget (yeah, cheesy.. but I was in a hurry and it works great) to grab JPEG frames and stick them in an AVI file. It has the URL to an Axis camera hardcoded in the source code, so it will have to be edited to work with another networked camera. The program can grab frames every X seconds or every time the user presses enter. A ctrl-C should safely close the AVI file. I made a demo video using my Axis 211 camera doing "stop motion" video with some toys and put it on YouTube here: http://www.youtube.com/watch?v=cI3yd0oAP20.
May 13, 2010 - Audio was completely broken until this version :(. So anyway, audio works now. Audio is really only useful in the case of mjpeg, raw, or RLE compressed video since those frames can't include audio information. With mpeg and such audio can be mixed into the video. Also, I created a program that can fix broken AVI files using this library. Check the video_fixer_upper page for more info.
This library is distributed under the LGPL license.
Related Projects @mikekohn.net
libkohn_avi-2011-01-30.tar.gz (Source Code)
Copyright 1997-2018 - Michael Kohn