HuVIDEO is -as its name implied- a video format for the PC Engine developed by Hudson Soft. This format support videos up to 192 by 112 pixels, 10 frames per seconds and 16KHz ADPCM audio.
Here is the list of games featuring HuVIDEO in chronological order:
research history / Beyond shadow gate code / Rich's doc
Offset | Size (bytes) | Description |
---|---|---|
0 | 16 | Signature ⚬ “HuVIDEO ” for Power Golf 2 and John Madden ⚬ “HuVideo\0\0\0\0\0\0\0\0\0” for Yuna and Gulliver Boy |
16 | 2 | Video frame count |
18 | 2 | Width (in pixels) |
20 | 2 | Height (in pixels) |
22 | 1 | Flag (unused) |
23 | 1 | VRAM format (0: background tiles, 1: sprites) |
24 | 2 | ADPCM buffer length |
26 | 6 | Unknown |
The next 32 bytes following the header contains the palette of the video. The first frame is located 8 sectors away from the header. Frames are stored sequentially. There's no ADPCM and all frames use the palette. All videos have the same size which is 128 by 128 pixels.
Here is the header of one of the video.
Offset | Hex | ASCII | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
03739450 | 48 | 75 | 56 | 49 | 44 | 45 | 4F | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | H | u | V | I | D | E | O | |||||||||
03739460 | 77 | 00 | 80 | 00 | 80 | 00 | 00 | 00 | 80 | 7C | 3E | 80 | 7C | 44 | 80 | 7C | w | . | . | . | . | . | . | . | . | | | > | . | | | D | . | | |
According to the header description, this video contains 119 (77h) frames of 128 (80h) by 128 (80h) pixels encoded as background tiles. As we know that the videos does not contain ADPCM, we can safely the last 8 bytes of the header.
Sector | Description |
---|---|
00 | header + palette |
01 | skip |
02 | |
03 | |
04 | |
05 | |
06 | |
07 | |
08 | |
09 | frame #0 |
0a | |
0b | |
0c | |
0d | frame #1 |
0e | |
0f | |
10 |
The header is the same as Power Golf 2. The only way to tell if a video has ADPCM is to check its size. There are 3 kind of videos:
The ADPCM data is stored between the palette and graphical data.
The length to read is given by the word stored at the offset 24 in the header.
As the ADPCM chip in the PC-Engine CD ROM is an Oki MSM5205, the encoding is compatible with Dialogic ADPCM.
You can easily replay or convert it with sox. Note that the file must have .vox
extension.
sox --rate 16k adpcm_sample.vox sample.ogg
For those games, the signature changes to HuVideo
where spaces are replaced by 0.
The graphics are encoded as tiles and the ADPCM length specifies the number of sectors used by a single frame.
Unlike John Madden Duo CD Football, the ADPCM is split between each frame. As the video are played at 10 frame per seconds and the audio sample rate is 16KHz, the ADPCM buffer is 800 bytes long.
Another difference is that the whole 16 tile palettes are used. An auxiliary array is also stored in order to specify the palette for each tile.
Sector | Description |
---|---|
00 | header |
01 | skip |
02 | |
03 | |
04 | frame #0 |
… | |
4+N | frame #1 |
… | |
4+N*2 | frame #2 |
… |
The layout of a frame is as follow:
Offset | Description |
---|---|
0 | tile data |
… | |
N0 | palette #0 |
N0+32 | palette #1 |
… | … |
N0+512 | tile palettes |
… | |
N0+512+w*h/128 | adpcm audio |
… |
Here N0
is the size of the tile data. With w
and h
being the width and height in pixels of a frame, and knowing the each tile is 8 by 8 pixels wide, we have:
N0 = w * h * 32 / 8 / 8
The size of the tile palettes is w*h/128
because 1 bytes contains the palettes for two consecutive tiles. The palette of tile i
is stored in the last 4 bits, and the one for tile i+1
in the first 4 ones.