Some hints and caveats for compressing captured demos.

If you have captured demos with DOSBox or kkapture you'll want to compress them afterwards. There are some things I ran into, figured out or got information about from nice people (hello hellfire ;) that might be useful to you...

Primary / intermediate compression
  • You can use VirtualDub to convert/filter/compress the video. It supports jobs and scripting too, making your life much easier for standard jobs. Information about the scripting language is here.
  • There's also Avidemux which can use many codecs (MP3/AAC, XVID/H.264...) and container formats (AVI/MKV/MP4). It lacks some of VirtualDubs options but has a fancier interface. The builtin ECMA scripting language also looks dandy. Watch out though: The Avidemux releases before v2.4 r3775 have swapped colors when decoding HuffyUV material! You'll need to use a "Swap U-V" filter when encoding the video! And it doesn't seem to support ZMBV at all.
  • DOSBox captures to .avi files encoded with ZMBV. You can install ZMBV using the .inf file in the "\zmbv" subdirectory of DOSBox. If you try to use it as a compression codec keep in mind that it currently only supports 16 or 32Bit color depths for its in/output formats!
  • If you're capturing higher-resolution demos with kkapture you should consider using HuffyUV. It is lossless too and somewhat faster, but videos take up much more space than with ZMBV.
  • If you have video parts with a framerate that doesn't match (happens with DOSBox sometimes if the demo switches resolutions while capturing), you usually can't concat them. To fix that just cut off some frames in a part of the video where people won't notice (black screen, whatever) and then combine the captures. Voila.
Final / lossy codecs
  • I convert all my videos to Xvid in 2 passes. Why? Take a look at this: Quality comparison image
    (quality-comparison picture from the demo "Toasted" showing 1-pass vs. 2-pass compression)
  • Resolution and bitrate should change as needed. Check the results. Some scenes may look good, while others are really fugly. For Xvid I usually choose the "Home" profile in the encoder. If you need bitrates above 4800kBps, you'll have to choose the "Highdef" profile.
  • Also note that some codecs e.g. Xvid only accept even video sizes (multiples of 2) and/or certain bitdepths. If you run into strange errors, take a look at bitdepth and sizes...
  • You can use "zones" in the Xvid codec to distribute more bits/s to some parts of the video that need them and save some on other parts.
  • If you want to compress to H.264 video which has comparable or better quality at nearly half the bitrates of Xvid, get the free x264 codec you can use with VirtualDub.
  • To mux streams into a MP4 container, use MP4Box from the GPAC package. Have fun compiling it. Be sure to download the extra libraries too...
Audio
  • I compress audio to 44.1kHz, Stereo, 128-160kBps CBR-MP3s. Get the LAME ACM-codec to compress to MP3 in VirtualDub. Note that audio may be broken when you encode with VBR, probably because of interleaving. This is because of the crappy AVI container format, as it seems to work with MP4 containers...
  • AAC audio has better quality at smaller file sizes. Though there's not much gain, because audio data is only ~5-10% of the video, AAC should be the preferred audio format when compressing to MP4 video/containers. Get FAAC to compress your audio to AAC and add tags (group, title, ...) to the files.
General
  • Grainy video and/or a lot of movement requires a higher bitrate when compressing...
  • Videos that have a high amount of flashes and/or fast movement may need to be captured at >25fps to look good. If you can, do your captures and encodes in 60fps and avoid framerate conversions.
  • Scale low resolution captures (e.g. 320x200) up 2x using a pixel-doubling filter (nearest neighbour), that keeps the video crisp and "original" because of higher chroma resolution...
  • Note that you can mux subtitle streams (preferably SRT for Xvid, TTXT for MP4) into the container file so you can add things like group, demo title or year of creation in a non-destructive way! Here is a template TTXT file I use. Please keep in mind that not all hardware players support SRT subtitles muxed into AVI containers. It should work for TTXT/MP4 though, because it is part of the 3GP standard. You can still put the subtitle ASCII file on the disc along with the video. If they have the same name and the player supports it, it may work...
  • You can use AtomicParsley to add iTunes tags to your files.

My workflow for creating a Xvid/MP3 and H.264/AAC encode with tags and subtitles (VirtualDub)
  1. Capture the video files.
  2. Load them into VirtualDub and do everything necessary to be able process the whole file (matching framerates etc.)
  3. Save the audio to disk as a WAV file.
  4. Queue jobs for first pass Xvid/MP3 and second pass Xvid/MP3.
  5. Optional: Run jobs and check quality of resulting file. Iterate if necessary going back to 4, adding zones if needed.
  6. Queue jobs for first and second pass H.264 encode. Add a third pass if you like. Bitrates should be ~60-80% of the Xvid. Choose to add "No audio" stream.
  7. Run jobs. While they encode, compress the WAV to AAC with FAAC. Update the subtitles file (don"t forget to change video sizes) and get a coffee.
    faac music.wav -b <BITRATE> -w --mpeg-vers 4 -o music.mp4 --artist "<GROUP>" --title "<TITLE> soundtrack" --year <YEAR>
  8. When done, check quality of videos. Iterate if necessary, going back to 6 or 4.
  9. Demux the H.264 avi to raw H.264 format again using MP4Box.
    mp4box -aviraw video "<VIDEO>.avi"
  10. Remux the H.264 avi, the AAC audio file and the subtitles to a new MP4 container. Be sure to specify the framerate and the language of the subtitles.
    mp4box -new -add "<VIDEO>.h264" -add "music.mp4" -add "<SUBTITLE>.ttxt:lang=eng" -fps 60.000 "<OUT>.mp4"
    In case of problems when trying to import the h264 file use:
    "<VIDEO>.h264"#video
  11. Tag the files with AtomicParsley.
    AtomicParsley "<OUT>.mp4" --metaEnema --artist "<GROUP>" --title "<TITLE>" --year <YEAR> --stik Normal --freefree --overWrite
  12. You can additionally hint the MP4 files for streaming playback, but I haven"t found this to be necessary.
    mp4box -unhint -hint "<OUT>.mp4"
  13. Happy, happy, joy, joy.
My workflow for creating a Xvid/MP3 and H.264/AAC encode with tags and subtitles (Avidemux)
  1. Capture the video files.
  2. Load them into Avidemux and do everything necessary to be able process the whole file (matching framerates etc.). You might need to combine them with VirtualDub if Avidemux fails to do this.
  3. Queue jobs for first pass Xvid/MP3 and second pass Xvid/MP3.
  4. Optional: Run jobs and check quality of resulting file. Iterate if necessary going back to 3, adding zones if needed.
  5. Queue jobs for first and second pass H.264/AAC encode. Add a third pass if you like. Bitrates should be ~60-80% of the Xvid.
  6. Run jobs and get a coffee.
  7. When done, check quality of videos. Iterate if necessary, going back to 5 or 3.
  8. Mux subtitles into the mp4.
    mp4box -add "<SUBTITLE>.ttxt:lang=eng" -fps 60.000 "<OUT>.mp4"
  9. Tag the files with AtomicParsley.
    AtomicParsley "<OUT>.mp4" --metaEnema --artist "<GROUP>" --title "<TITLE>" --year <YEAR> --stik Normal --freefree --overWrite
  10. You can additionally hint the MP4 files for streaming playback, but I haven"t found this to be necessary.
    mp4box -unhint -hint "<OUT>.mp4"
  11. Done.
Note: You could also use mencoder, which might be good for batch processing etc. Haven't tried yet. The problem might be to make it work with HuffyUV and ZMBV and being able to combine files. If you have something working and can tell me how, go ahead and drop me an email!

If you want you can contact me: The address is in the image...