Source Preparation

The XDC encoder currently does not perform any format conversion or load movie files directly; it is driven by a script that points to individual frames that make up a video, and a .wav file that contains the audio.  The video frames and audio file must be prepared beforehand before they can be turned into a movie.

You can use any tools you like to perform the conversion, but you must follow some constraints, listed below.

Video format

The encoder loads Windows .BMP files in the following formats:

  • 160×200, 256 colors (only first 16 are used)
  • 160×100, 256 colors (only first 16 are used)
  • 640×200, 2 colors

For color files, the first 16 colors must adhere to a specific palette if you want the video to display properly.  There are two palettes supported, one for composite CGA output:

#090909
#009c3a
#4018ff
#00c5ff
#e3054b
#9a9d96
#ff1dff
#ddc5ff
#4c7400
#07ff00
#9e9a9a
#53ffd2
#ff7800
#f5ff00
#ff98fa
#ffffff

…and another for Tandy 160x200x16 RGB output:

#000000
#0000AA
#00AA00
#00AAAA
#AA0000
#AA00AA
#AA5500
#AAAAAA
#555555
#5555FF
#55FF55
#55FFFF
#FF5555
#FF55FF
#FFFF55
#FFFFFF

A directory containing both palettes in a few forms, as well as example frames in the correct format, are at the XDC github repository.  The example frames can be used as a reference for any files you are creating.

160×200 or 160×100?

160×100 files encode better than 160×200, but have only half the resolution.  For extremely “busy” sources (action movies, etc.) where every single pixel is changing every frame, 160×100 may provide a better overall result.

Reducing colors

When reducing colors to one of the 16-color formats, you can either perform no dithering (good for cartoons/animation) or you can perform ordered dithering.  Unfortunately, very few tools perform color ordered dithering properly; the only consumer-level tool I’ve found that does it properly is Photoshop.  (I illustrate how to do this in the XDC screencast.)  I had hoped to create a better command-line tool to perform ordered dithering using one of Bisqwit’s algorithms, but thus far I have not found the time.

Do not use error-diffusion dithering, such as Floyd-Steinberg.  The end result will neither look good in motion, nor encode well.

Black And White

If you don’t own Photoshop and can’t find another reasonable method of color ordered-dithering, try the 640×200 B&W mode instead.  There are tons of command-line programs (imagemagick) that can create ordered-dither (sometimes called Bayer dither) B&W files properly.  For example, this imagemagick command-line converts 640×200 24-bit color .PNG files into the correct format for use with XDC:

mogrify -colorspace Gray -ordered-dither o8x8 -colors 2 -format bmp -define bmp:format=bmp3 *.png

(For traditional cell animation, you may get better results with o4x4 instead of o8x8.)  If you haven’t resized your input frames, you can add a “-resize 640×200” at the beginning of the above example.

Audio format

Audio must be provided as a .wav file that is mono, 8-bit, and uncompressed.  You can choose any samplerate from 8KHz to 44KHz, although larger  samplerates will leave less room for video data in the file, so only use rates as high as you really need.  There is really no reason to go above 32KHz for anything you want to feed to XDC.

Nearly every audio editor can perform conversion to the above format, such as Audacity, so use that if you have no editor (it’s free).