Format:Smacker
| On this wiki | Facts · Code · Notes · Topics |
|---|
RAD Game Tools' palettized video format (.smk, used by many 1990s games): magic SMK2 or SMK4, little-endian header with width, height, frame count and frame-time, flags, up to 7 audio tracks, Huffman tree data, then a table of frame sizes and per-frame flags before the frames.
Header (little endian)
| Offset | Field |
|---|---|
| 0 | magic 'SMK2' or 'SMK4' |
| 4 | width u32 |
| 8 | height u32 |
| 12 | frame count u32 |
| 16 | frame time: positive = milliseconds, negative = 1/100000 s units (FFmpeg: positive value multiplied by 100, negative negated, timebase 100000) |
| 20 | flags u32: 0x01 ring frame (one extra frame), 0x02 Y interlace, 0x04 Y double |
| 24 | 28 bytes of audio-related sizes (FFmpeg skips them) |
| 52 | tree size u32 (the Huffman trees blob has this many bytes) |
Then 16 bytes of tree sizes (read into the extradata), 7 audio entries of u24 sample rate + u8 flags, a u32 padding, frame_count u32 frame sizes, frame_count bytes of frame flags, and the packed Huffman trees. Offsets after 20 follow FFmpeg's read order. The absolute offsets follow from the read order in FFmpeg libavformat/smacker.c (c2bbf2b83d, lines 106-128): five u32 reads after the magic (width, height, frames, frame time, flags) end at offset 24, avio_skip(pb, 28) moves to 52, and the next u32 read is treesize.
Audio flags
0x80 packed (SMKA), 0x20 16-bit, 0x10 stereo, 0x08 Bink audio (RDFT), 0x04 use DCT (Bink audio DCT). A track with rate 0 is absent. Unpacked 8-bit audio is PCM U8, 16-bit is PCM S16LE.
Frames
The frame size table's low 2 bits are flags: FFmpeg masks sizes with ~3, and treats an entry with bit 0 set (and frame 0) as a keyframe. The frame flag byte: bit 0 = palette change present; bits 1-7 (flags >> 1) say which of the 7 audio tracks have data in this frame. Video is palettized 8-bit (pixel format PAL8).
Code & repositories
- https://github.com/FFmpeg/FFmpeg @
c2bbf2b83d064313ca3739f81c651553cfbb26fb· license: LGPL-2.1-or-later (declared by the contributor; GitHub's detector did not recognize COPYING.GPLv2)
FFmpeg libavformat demuxers smacker.c, idroqdec.c, flvdec.c, mpegts.c
Tested on: source read, not run: source reading only · checked 2026-10-18; last activity 2026-10-18
Evidence & references
- FFmpeg libavformat/smacker.c (LGPL-2.1+). Related: Format:Bink video (BIK, KB2), which shares the audio codecs.