Filename extension |
.smk |
---|---|
Internet media type | video/vnd.radgamettools.smacker |
Type code | Smk2 |
Developed by | Epic Games Tools |
Type of format | Video codec |
Container for | Smacker |
Smacker video is a video file format (with the .SMK file extension) developed by Epic Games Tools, and primarily used for full-motion video in video games.[1] Smacker uses an adaptive 8-bit RGB palette. RAD's format for video at higher color depths is Bink Video. The Smacker format specifies a container format, a video compression format, and an audio compression format.[2] Since its release in 1994, Smacker has been used in over 2300 games.[1] Blizzard used this format for the cinematic videos seen in its games Warcraft II, StarCraft and Diablo I.[3]
The format has been reverse engineered and implemented in libavcodec.[4][5][6] A non-commercial SourceForge project libsmacker released an open source decoder in 2013.[7]
Technical details
File format (container)
Smacker defines its own container format.[2] A Smacker file can contain a Smacker video track and up to seven audio tracks. Each audio track can have either one channel (mono) or two channels (stereo) with a bit depth of either 8-bit or 16-bit. The audio can either be uncompressed PCM, compressed in the Smacker Audio format, or, in newer versions of Smacker, compressed in the Bink Audio format.[2]
Video
Smacker video supports 256 colors, but no transparency support.[2] While being a palette-based format, which is inherently limited to having not more than 256 colors in each frame, Smacker videos may still contain more colors in total due to "palette rotation", whereby the palette is updated on a per-frame basis.[2] This usually results in SMK files that look better if the source video has more than 256 colors. The compression rate depends on the content. The encoding of a video consisting of still or barely moving frames is after the first frame practically free.[2] Frames with random colors might more than double the raw size.
In Smacker video, a frame is split into 4×4 blocks in raster-scan order.[2] Each block can be coded in one of six coding modes: skip, fill, mono, and three full modes. Each mode can be signaled for multiple blocks in a run-length encoding scheme. In skip mode, the current block is copied from the previous frame in a conditional replenishment fashion. In fill mode, the current block is filled with a single color. In mono mode, the palette is locally reduced from 256 colors to two colors. Both colors are written to the bitstream and one bit per pixel is used to indicate which of the two colors a pixel should be.[2] The mono mode can be interpreted as vector quantization, where a three-dimensional vector with the components red, green, and blue is quantized using an adaptive codebook with two entries. There are three full modes, one was specified in version 2 of the Smacker format, while the other two were added in version 4.[2] In the original full mode, 16 colors are transmitted, one for each pixel, equivalent to raw uncompressed PCM. The two full modes added in version 4 use 4 and 8 colors in a block, respectively.[2] In the 4-color mode, the 4×4 block is split into four 2×2 blocks, each of which is filled with a solid color. In the 8-color mode, the 4×4 block is split into eight 1×2 blocks, each of which is filled with a solid color.[2]
Further compression is achieved by entropy coding using Huffman coding of the various bitstream elements that result from the process above.[2] There are four separate Huffman tables, each with 16-bit entries: one for mode decision, run-length, and fill color in fill color mode, one for the color indices in mono mode, one for the bitmap in mono mode, and one for all data in the full mode. Each table is adaptive and transmitted once per file in the header. The Huffman tables in the header are themselves compressed: the 16 bit values in the leaves of the code tree are split into a high byte and a low byte. Each byte is compressed using a Huffman table that is also contained in the header.[2]
Audio
Smacker audio is one of the audio formats that can be used in the Smacker container. For compression, Differential pulse code modulation (DPCM) is used. The difference between two successive samples is compressed using Huffman coding. The Huffman tables are adapted once per audio frame.[2]
See also
- Indexed color
- Color quantization
- Bink Video, RAD's format for video at higher color depths
- Apple Video, a codec based on a similar design
- Microsoft Video 1, a codec based on a similar design
- QuickTime Graphics, a codec based on a similar design
- S3 Texture Compression, a texture compression format based on a similar design
References
- 1 2 "Smacker video Technology". RAD Game Tools. Retrieved 4 May 2013.
- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 "Smacker". MultimediaWiki. 11 April 2007. Retrieved 4 April 2013.
- ↑ Ladislav Zezula (2010). "MPQ Archives - Overview". Retrieved 4 May 2013.
- ↑ "FFmpeg Documentation". FFmpeg. Retrieved 4 April 2013.
- ↑ FFmpeg: Smacker video and Smacker audio decoder
- ↑ FFmpeg: Smacker container demuxer
- ↑ SourceForge project libsmacker