bbMPEG and AVI2MPG2 are Windows programs that convert AVI files to MPEG-2 or MPEG-1 (including VideoCD and SuperVCD) files. They are freeware, and the source code for version 1.23 is available here although you will need Borland C++ Builder 4.0 or higher and the ADOBE Premiere 5.x SDK to compile it as is.
Our Review: bbMPEG is free software for converting AVI files to good old MPG format. The stand-alone version features a deceptively simple interface, but contains a huge range of settings which control the framing, buffering, audio and video streaming etc. for output as MPG 1 & 2, VCD, SVCD and DVD. Although I experienced some problems with the audio/video sync for a simple AVI to MPG transfer at first, playing around with the myriad of settings should get you there in the end. Recommended.