Source Code


"Use the source, Luke."


I'm a big fan of Linux and the Open Source movement. This page is my attempt to give something back. (Some of these things are pretty dated, and have been absorbed into other projects or made obsolete by other advances, so please check to make sure your project needs these tools before installing.)




 

Video Tools


    Digital Video (DV) Tools Here are some miscellaneous tools for taking DV and encoding it in a form that you can burn to DVD. This is to be used in conjunction with Kino, the mjpegtools, and the smilutils. Included are a couple of different encoding scripts, a tool to show the frame count on a smil file, and one to split a smil file into several shorter files (useful for test encodes, as well as for being able to avoid reencoding the whole thing if something goes awry someplace). There is also a tool that uses mplayer to verify that all the frames in the smil file were actually encoded, so you can fire off a batch encode and come back later and make sure everything encoded. The included README.TXT should get you started. Click here to download.

    MPlayer YUV4MPEG output plugin I'm a big fan of the mjpegtools toolkit (mjpeg.sourceforge.net) for video encoding. Their tools expect the video stream in a YUV4MPEG format, which you can get from the tools themselves, or from transcode. However, for anything coming from an AVI file, they use libavifile, and that doesn't always seem to get along with things I feed it. MPlayer, on the other hand, usually works fine on the same files. So this little plugin will give you a new output plugin for mplayer to create YUV4MPEG streams that you can encode with mjpegtools. Update The YUV4MPEG output plugin has been accepted by the mplayer developers, and is now included in the CVS version of mplayer. Now you can use the "-vo yuv4mpeg" option. Note that the video stream is always written to "stream.yuv". If you like, you can pipe that directly to the encoder by doing a "mkfifo stream.yuv" before running mplayer, then just run mplayer in one terminal, and the encoder in another, pulling from the stream.yuv fifo. Update There is a bug in the output plugin when playing YUV source material (DVD's) that can be corrected by applying this patch.

    YUV Pixelate This filter allows you to "block out" parts of a video by "pixelating" areas. This is similar to what you see on various TV shows where the identity of someone is concealed and they block out their face on camera. To use it, just create an edit list -- a simple text file that has the position, size, and start/end frames where you want the video pixelated, and run the video through it. Works with the mjpegtools video format, YUV4MPEG. It is designed to operate as a filter, like the other mjpegtoools filters. The easiest way to build it is copy it to your mjpegtools source tree in the "lavtools" directory, edit the makefile to add an entry for it, and build. The source is here. (Note that this is a C++ source file, so you'll need to link against libstdc++.)

    YUV 3-2 pulldown This is used to convert a 25-fps video to a 30-fps video by using a 3-2 pulldown on it. Note that with videos with a lot of motion, this produces a "tearing" in the video that ranges from mildly annoying to totally unwatchable. Works with the mjpegtools video format, YUV4MPEG. It is designed to operate as a filter, like the other mjpegtoools filters. The easiest way to build it is copy it to your mjpegtools source tree in the "lavtools" directory, edit the makefile to add an entry for it, and build. The source is here. You'll need to use sox to stretch the audio before muxing it back together. (Depending on the video, you may get a better conversion by using the mplayer output plugin above and forcing a framerate of 24 fps. You still have to stretch the audio and remux.)

Widgets


    FLTK editor widget -- A word-wrapping text editor widget for FLTK. Supports CUA-style editing keys, automatic scrollbar, load and save to file or buffer, and more. Includes subclasses with status display, find and replace, etc. Also includes a couple of utility widgets -- a status panel, and a progress bar. For more info, you can read the Readme, browse the documentation, or download the source archive. For changes made in the most recent version, check the change log. For old versions or other archive formats, check the ftp site.

    Note that the latest source is designed to work with FLTK 1.1 or FLTK 2.x (CVS). It should build on FLTK 1.0, but has not been heavily tested on that environment for a while. If you are running with FLTK 1.0 and encounter difficulty, you may want to try the previous version.

    Having trouble building MySQLGui? This is getting to be a FAQ, so I put together some instructions. If you're having trouble building that, or Fl_Editor itself, you might want to check these instructions.

C++ Tools


    INI File Tools (STLINI) -- I know there must be at least a million people who have written code to read/write Windows-style INI files under Linux, but when I went looking for one, I couldn't find one that fit what I wanted and didn't include a lot of extra stuff I didn't want. So here is a simple set of INI file management routines that should work on any platform that supports the C++ STL (Standard Template Library), including Linux. You can read and write INI files all you want with just four simple function calls -- LoadIni, SaveIni, GetIniSetting, and PutIniSetting. The whole set of functions is less than a hundred lines of code. Includes a test program and build instructions (for Linux). Click here to download it

Perl / CGI scripts


    Photo Album -- If you just can't help yourself, and you just have to put your family pictures online for the world to look at, this script makes it a little eaiser. It generates web-based photo albums "on the fly", taking thumbnails and captions from files it finds in a directory. Easy to set up and use, and makes maintenance of your album a snap, since all you have to do is add or remove files to a directory. See it in action here, or download it here (tarball format) or here (zip format).

    There is also a PHP version available. The PHP version has more features, including the ability to view only new pictures since last visit, sort the pictures by various criteria, uploading pictures, etc. It comes ready to deploy (just unpack and drop it on your web server someplace), and comes complete with documentation. You can see that version in action here, and download it here, or in zip format here.

    Font Tools -- Do fonts under Linux drive you crazy? Well, you're not alone. For a font to be fully useful under Linux, your X server has to know about them, your printer driver has to know about them, and in many cases your applications have to know about them. Here is a collection of tools that will make life easier in that regard. This archive includes type1inst, a perl script by James Macnicol that generates font maps for X and Ghostscript, afmmaker.ps, a postscript tool by Yeong Yu that creates AFM files for postscript fonts, and finally makeafms, a perl script by me, Robert Kesterson. Makeafms.pl reads the Ghostscript font map and uses ghostscript and makeafms.ps to generate AFMs for all the fonts Ghostscript knows about. Then it puts them in the proper places based on your ghostscript environment. The point of all this is that by running two scripts and copying a couple of text files, you will be able to use your Postscript fonts on screen and in print! Now you can dress up your documents in Applixware, Star Office, WordPerfect, etc. If you need to download the pieces individually, visit the ftp site.

    Bodyfat Calculator - For the computer geek who has everything. This is little perl script that asks you several questions (age, gender, weight, and several skinfold measurements). It then plugs it all into a couple of equations and prints out your current bodyfat percentage, your lean mass, and your fat mass. It also asks for your desired bodyfat percentage, and tells you how much fat you have to lose to hit that percentage (assuming the same lean mass). You can download the script here. It should run on any platform that can run perl. Please note that this is not a CGI script, just a standalone perl script.

Miscellaneous


    Via VT6410 Patch -- Some time ago, I got a nifty new Asus P4P800 Deluxe motherboard. Unfortunately, the chipset it uses for the IDE RAID controller is not supported directly in the Linux kernel, and the driver on Asus' website only works with Redhat 7.2. Fortunately, I found a patch online that turns on the IDE functionality. No hardware RAID support, but fortunately, Linux has software RAID that works quite well if you need it. With this patch, I am able to attach a 200G ATA133 drive and get transfers of 52Mb/sec from it in udma6 mode. I also have a DVD burner on that interface and it works fine. I have not encountered any problems so far. I did not write the original version of this patch. I am just providing it here since it seems extremely hard to find (I can't even find where I originally got it). My thanks to whoever wrote it, and apologies for not being unable to give you proper credit.

    I've tried to keep the patch up to date for newer kernel versions. The patches below will generally apply to kernel versions newer than the patch listed, up until the next patch. So, for example, the 2.6.7 patch will apply all the way up through 2.6.10, until you hit 2.6.11-rc4, when you'd switch to the later patch.

    The functionality of this patch is already included in the main linux kernel versions 2.6.15-rc2 and later.

    Kernel Version Patch
    2.4.22 + patch
    2.6.2 + patch
    2.6.6 patch
    2.6.7 + patch
    2.6.11rc4 + patch
    2.6.13.2 + patch

While you're in the neighborhood,
stop by robertk.com, or drop me a line.

Note: Like most of the Internet, this page is a work in progress.