JPEGTOAVI
by Phillip Bruce
I. Introduction
In the tradition of the Unix computing philosophy, here is yet another operator that does one simple task, namely the creation of an AVI/MJPEG file given a list of JPEG/JFIF files.
I had some difficulty in performing this extremely simple task in Linux, mostly because it is so simple and all of the existing code to do it lie at the bottom of complicated and more ambitious projects--e.g. xawtv, avifile, etc. I then had to waste time reading M$ docs and xawtv source to find out how to do it.
II. Installation
The code is pretty basic, and so it should be pretty easy to install: "make all" compiles the program, "make install" installs it. If you want the files to reside in some directory besides /usr/local/bin and /usr/local/man, edit "Makefile".
II. Usage
There are three basic modes of operation:
- jpegtoavi per_usec width height [img1 ... imgN]
- jpegtoavi -f fps width height [img1 ... imgN]
- jpegtoavi -fsz [img1 ... imgN]
The first two print an AVI to stdout using the width and height parameters and the images named in chronological order. (No checks are made on the validity of the JPEG/JFIFs or their dimensions.) The first mode specifies the frame rate in terms of the period in microseconds for each frame, whereas the second specifies frames per second.
The third mode was added to give size hints during the transfer of AVIs without the use of a temporary file. Instead of generating the AVI it outputs the size in bytes that of the AVI that could have been generated.
The names of the JPEG/JFIF files may either be passed via stdin or via an argument list. It should be pointed out that for large lists, it is generally safer to pass the names through stdin. In either case, the order in which the files are named is the order in which their corresponding frames shall occur in the resulting AVI.
III. Contact, Bug Reports, and Suggestions
Send them to me at dI77IHd@yahoo.com
