Thwimp is a hybrid GUI/CLI Windows utility which allows users easily to view, to rip, and to encode Nintendo THP video files for Mario Kart Wii (and for other GCN/Wii games, to an extent). Written in Visual Basic (from Visual Studio 2010 IDE), the Thwimp application calls some FOSS and other command line tools (not included) "from arms length" via the Command Prompt to perform its tasks.
Specifically, Thwimp uses:
BMP to JPG conversion
JPG Quality setting applied
Non-progressive JPG files
Definitely not included!
Encoding JPG frames + WAV file into THP videos
The FOSS Utilities that
Thwimp uses "at-arms length"
Thwimp can show the hard-coded information about how each THP file is formatted in Mario Kart Wii. Thwimp can also view MKWii's THP files, as well as convert them to everyday video files. It can crop the THP video files (both physically and in terms of time length), and then convert them to MP4 (H.264 codec) video files, to WAV files (for videos with audio), and padding to BMP files.
The THP video files in Mario Kart Wii tend to be an array of multiple subvideo cells inside, with each cell playing back several other videos in multiple time chunks ("multiplicities"). As required by the file format specification, THP video files must have their dimensions be a multiple of 16px. Often times the size of the subvideo array will not be enough to meet the specification, so padding is added to the bottom of the THP video array. This padding is not only used to meet the specification, but sometimes used for control information. For example, some of the videos shown during menus will have a white rectangle move at integral positions at each multiplicity within this padding space. This white rectangle controls which row in a menu is highlighted during THP playback, for synchronization purposes.
Thwimp can intelligently handle audio, subvideo array, multiplicity, and padding/control information when encoding THP files to replace ones in-game. It does this by accepting appropriately named, input MP4 video files for each subvideo cell in the array, and for each multiplicity. Where applicable, it will also accept a WAV audio file, and BMP image frames for each multiplicity for creating an appropriate padding area as needed. After reading the input files, Thwimp will intelligently process and composite all of the files together appropriately, in order to create a high-quality, properly formatted THP video replacement file!
Please watch the YouTube playlist near the bottom of page for sample usage of the application.
Example set of input files for battle_cup_select.thp
(Array of 2x1 videos, each video has multplicity of 5,
with control padding frames at bottom)