<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multimedia.cx/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Clone2727</id>
	<title>MultimediaWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multimedia.cx/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Clone2727"/>
	<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php/Special:Contributions/Clone2727"/>
	<updated>2026-04-18T09:27:08Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.5</generator>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=QDraw&amp;diff=13696</id>
		<title>QDraw</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=QDraw&amp;diff=13696"/>
		<updated>2011-11-13T05:06:57Z</updated>

		<summary type="html">&lt;p&gt;Clone2727: add link to Apple PICT documents; expand the description a bit (still very incomplete)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''This page is based on the codec description written by Konstantin Shishkov found in the document Description of the Apple QuickTime Animation (RLE) Format located at [http://multimedia.cx/qtrle.txt http://multimedia.cx/qtrle.txt].''&lt;br /&gt;
&lt;br /&gt;
* FourCC: qdrw&lt;br /&gt;
* Company: [[Apple]]&lt;br /&gt;
* Specification: [http://developer.apple.com/legacy/mac/library/documentation/mac/QuickDraw/QuickDraw-333.html http://developer.apple.com/legacy/mac/library/documentation/mac/QuickDraw/QuickDraw-333.html]&lt;br /&gt;
* Samples: [http://samples.mplayerhq.hu/V-codecs/QT-qdrw/ http://samples.mplayerhq.hu/V-codecs/QT-qdrw/]&lt;br /&gt;
&lt;br /&gt;
QDraw is really just a standard QuickDraw PICT resource inside of a QuickTime container. It is identified by the FOURCC 'qdrw'. The PICT format can support both vector- and raster-based images. &lt;br /&gt;
&lt;br /&gt;
However, only v2 8-bit paletted PackBits images have been found in QuickTime files so far. Most of this document is based on this assumption as well as having no other QuickDraw opcodes present in the frame and is therefore incomplete.&lt;br /&gt;
&lt;br /&gt;
== Data Format ==&lt;br /&gt;
&lt;br /&gt;
All multi-byte numbers are encoded in big-endian format.&lt;br /&gt;
&lt;br /&gt;
An encoded QDraw frame is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-1      low two bytes of the frame size&lt;br /&gt;
  bytes 2-103    QuickDraw header/opcode data&lt;br /&gt;
  bytes 104-107  number of colors - 1&lt;br /&gt;
  bytes 108..    color table (8 bytes per entry)&lt;br /&gt;
&lt;br /&gt;
One color table entry is laid out as:&lt;br /&gt;
&lt;br /&gt;
  byte 0-1   index of palette table entry to replace&lt;br /&gt;
  byte 2-3   16-bit red component&lt;br /&gt;
  byte 4-5   16-bit green component&lt;br /&gt;
  byte 6-7   16-bit blue component&lt;br /&gt;
&lt;br /&gt;
Thus, the color table can update arbitrary entries in the palette.&lt;br /&gt;
&lt;br /&gt;
Following the color table are 18 bytes describing the PackBits source/destination rectangles and mode. After these bytes, there is a series of RLE-encoded lines using the standard PackBits compression (if mode is 0 &amp;quot;default&amp;quot; or greater than 2). For each line in the image:&lt;br /&gt;
&lt;br /&gt;
  if (row bytes is &amp;gt; 250)&lt;br /&gt;
    two bytes compressed line size&lt;br /&gt;
  else&lt;br /&gt;
    one byte compressed line size&lt;br /&gt;
 &lt;br /&gt;
  while (remaining bytes in compressed line)&lt;br /&gt;
    code = next byte in encoded frame&lt;br /&gt;
    if (top bit is set (code &amp;amp; 0x80))&lt;br /&gt;
      output next byte in encoded frame to decoded frame (257-code) &lt;br /&gt;
         times&lt;br /&gt;
    else&lt;br /&gt;
      copy (code + 1) bytes from encoded frame to decoded frame&lt;br /&gt;
&lt;br /&gt;
[[Category:Video Codecs]]&lt;/div&gt;</summary>
		<author><name>Clone2727</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Sega_FILM&amp;diff=13516</id>
		<title>Sega FILM</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Sega_FILM&amp;diff=13516"/>
		<updated>2011-07-05T13:39:58Z</updated>

		<summary type="html">&lt;p&gt;Clone2727: byte 23 of FDSC is the audio compression field&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''This page is based on the document 'Description of the Sega FILM/CPK File Format' by Mike Melanson found at [http://multimedia.cx/film-format.txt http://multimedia.cx/film-format.txt].''&lt;br /&gt;
&lt;br /&gt;
* Extensions: cpk, cak, film&lt;br /&gt;
* Company: [[Sega (Company)|Sega]]&lt;br /&gt;
* Samples:&lt;br /&gt;
** [http://samples.mplayerhq.hu/game-formats/film-cpk/ http://samples.mplayerhq.hu/game-formats/film-cpk/]&lt;br /&gt;
** Batman and Robin Sega CD with 'Seg4' data: [http://samples.mplayerhq.hu/game-formats/segacd/batmanandrobin-film-seg4/ http://samples.mplayerhq.hu/game-formats/segacd/batmanandrobin-film-seg4/]&lt;br /&gt;
** Dracula Unleashed/Sega CD: [http://samples.mplayerhq.hu/game-formats/segacd/dracula-unleashed-film/ http://samples.mplayerhq.hu/game-formats/segacd/dracula-unleashed-film/]&lt;br /&gt;
** Jurassic Park/Sega CD: [http://samples.mplayerhq.hu/game-formats/segacd/jurassicpark-film/ http://samples.mplayerhq.hu/game-formats/segacd/jurassicpark-film/]&lt;br /&gt;
&lt;br /&gt;
FILM is a multimedia container file format developed by Sega for use on its early CD-ROM home video game consoles. Based on analysis of a number of Sega CD and Saturn games, it appears that the format was first developed sometime during the era of the Sega CD, Sega's first CD-based video game console. There are many early variations of the FILM format observed on a number of Sega CD titles. Further, early FILM files have been observed on at least one 3DO game ([http://www.mobygames.com/game/3do/lemmings Lemmings]).&lt;br /&gt;
&lt;br /&gt;
The Sega Saturn video game console, released in 1994, was also CD-ROM-based and apparently offered developers a standardized SDK for full motion video (FMV) playback using a modified variant of the well-known [[Cinepak]] video codec.&lt;br /&gt;
&lt;br /&gt;
It is possible to store both audio and video in a FILM file. Alternatively, the format is able to handle either video without audio, or vice versa.&lt;br /&gt;
 &lt;br /&gt;
== Sega Saturn CPK File Format ==&lt;br /&gt;
&lt;br /&gt;
All multi-byte numbers are stored in big endian format.&lt;br /&gt;
&lt;br /&gt;
Many Sega Saturn CD-ROM games use this file format to store frames of a Cinepak-compressed video interleaved with uncompressed [[PCM]] audio. When this is the case, the files will typically have the extension .CPK (which is why FILM files are usually known as CPK files). Sometimes, audio-only FILM files will have a .SND extension.&lt;br /&gt;
&lt;br /&gt;
The general format is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 +-----------------------+&lt;br /&gt;
 | +-------------------+ |&lt;br /&gt;
 | | FILM header       | |&lt;br /&gt;
 | |                   | |&lt;br /&gt;
 | | +---------------+ | |&lt;br /&gt;
 | | | FDSC chunk    | | |&lt;br /&gt;
 | | +---------------+ | |&lt;br /&gt;
 | |                   | |&lt;br /&gt;
 | | +---------------+ | |&lt;br /&gt;
 | | | STAB chunk    | | |&lt;br /&gt;
 | | +---------------+ | |&lt;br /&gt;
 | |                   | |&lt;br /&gt;
 | +-------------------+ |&lt;br /&gt;
 |                       |&lt;br /&gt;
 | Audio or Video Data   |&lt;br /&gt;
 |  ..                   |&lt;br /&gt;
 |  ..                   |&lt;br /&gt;
 +-----------------------+&lt;br /&gt;
&lt;br /&gt;
A FILM file will usually consist of a header followed by interleaved audio and video chunks. The FILM header has the following structure:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-3    'FILM' signature&lt;br /&gt;
  bytes 4-7    length of FILM header (including signature and length&lt;br /&gt;
               fields)&lt;br /&gt;
  bytes 8-11   FILM format version in ASCII (ex: '1.01' or '1.07')&lt;br /&gt;
  bytes 12-15  unknown (may be reserved and set to 0)&lt;br /&gt;
  bytes 16-n   remainder of FILM header&lt;br /&gt;
&lt;br /&gt;
Different Sega Saturn games include FILM files with a variety of FILM version numbers. Sometimes, the same game will include FILM files with a variety of format versions. A version number implies that there has been some change to the file format, but I have yet to observe any differences between different FILM file versions (except possibly for version '1.09'; see STAB chunk for more details).&lt;br /&gt;
&lt;br /&gt;
The remainder of the FILM header contains a number of chunks describing the media data in the file. Usually, the number of chunks is 2: A FDSC chunk and a STAB chunk.&lt;br /&gt;
&lt;br /&gt;
A FDSC chunk contains file description information. The chunk format is as follows:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-3    'FDSC' chunk signature&lt;br /&gt;
  bytes 4-7    length of FDSC chunk (including signature and length&lt;br /&gt;
               fields); an FDSC chunk should be 32 (0x20) bytes long&lt;br /&gt;
  bytes 8-11   FOURCC of video codec (usually 'cvid' for Cinepak or null&lt;br /&gt;
               for no video)&lt;br /&gt;
  bytes 12-15  height of video frames&lt;br /&gt;
  bytes 16-19  width of video frames&lt;br /&gt;
  byte 20      bits per pixel (always seems to be 24)&lt;br /&gt;
  byte 21      number of audio channels&lt;br /&gt;
  byte 22      audio sampling resolution in bits (either 8 or 16)&lt;br /&gt;
  byte 23      audio compression&lt;br /&gt;
  bytes 24-25  audio sampling frequency in Hz&lt;br /&gt;
  bytes 26-31  unknown (may be reserved and set to 0)&lt;br /&gt;
&lt;br /&gt;
Note that the height field precedes the width field, which is unusual since width usually precedes height when expressing video resolution.&lt;br /&gt;
&lt;br /&gt;
The fields pertaining to audio (channels, bits, compression, and sample rate) will all be 0 if there is no audio present in the file.&lt;br /&gt;
&lt;br /&gt;
A STAB chunk contains a table of media sample information. The chunk format is as follows:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-3    'STAB' chunk signature&lt;br /&gt;
  bytes 4-7    length of STAB chunk (including signature and length&lt;br /&gt;
               fields)&lt;br /&gt;
  bytes 8-11   framerate base frequency in Hz&lt;br /&gt;
  bytes 12-15  number of entries in the sample table&lt;br /&gt;
  bytes 16-n   sample table&lt;br /&gt;
&lt;br /&gt;
Note that the length field ought to take the first 16 chunk bytes into account. However, it has been observed from some games (notably [http://www.mobygames.com/game/saturn/burning-rangers Burning Rangers] using '1.09' version FILM files) that the length field sometimes does not account for these 16 bytes.&lt;br /&gt;
&lt;br /&gt;
The sample table consists of a series of 16-byte sample records. Each record is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-3    offset of sample chunk from beginning of sample data&lt;br /&gt;
  bytes 4-7    length of sample chunk&lt;br /&gt;
  bytes 8-11   sample info 1&lt;br /&gt;
  bytes 12-15  sample info 2&lt;br /&gt;
&lt;br /&gt;
The offset is the offset from the start of the sample data, not the absolute offset in the file. The length of the FILM header implicitly serves as a pointer to the beginning of the sample data in the file.&lt;br /&gt;
&lt;br /&gt;
If the sample info 1 field is set to all ones, the sample is an audio chunk. Otherwise, it is a video chunk. If it is a video chunk, the top bit of the 32-bit number specifies whether the chunk is an inter-coded or an intra-coded frame. 0=intra-coded (a.k.a. keyframe), 1=inter-coded. This is useful for seeking since it is a good idea to only jump to key frames when seeking through a file.&lt;br /&gt;
&lt;br /&gt;
The rest of the first sample info field and the second sample info field pertain to framerate calculation. Refer to the section on FILM framerate calculation for more information on proper FILM playback using these sample info fields.&lt;br /&gt;
&lt;br /&gt;
== FILM Framerate Calculation ==&lt;br /&gt;
&lt;br /&gt;
The STAB chunk contains a framerate base frequency in bytes 8-11. This frequency is expressed in ticks/second (Hz). Every video chunk has a frame tick count. For example, movie files in Panzer Dragoon I &amp;amp; II (FILM format versions 1.04 and 1.07, respectively) have a base frequency of 600 Hz. The frames have tick counts of 0, 20, 40, 60, 80, etc. Thus, there are 20 ticks between each successive frame.&lt;br /&gt;
&lt;br /&gt;
  (600 ticks/sec) / (20 ticks/frame) = 30 frames/second&lt;br /&gt;
&lt;br /&gt;
However, not all FILM files exhibit such a nice, even framerate. Myst, for example, contains FILM files (version 1.01) with a base frequency of 30 Hz. Some of the frames skip 2, then 3 ticks. Here's a sample tick count progression: 0, 2, 5, 7, 10, 12, 15, 17...&lt;br /&gt;
&lt;br /&gt;
Each STAB record has 2 32-bit sample info fields. For an audio chunk, sample info 1 is all ones and sample info 2 is always 1. For a video chunk, sample info 1 contains the keyframe bit (as described in the STAB section) and the absolute timestamp in clock ticks of the video frame with respect to the file's base frequency clock. The sample info 2 field contains the number of clock ticks until the next frame is rendered. This type of information would be particularly useful in an interrupt-driven, real-time multimedia system like, for instance, a video game console (such as the Sega Saturn).&lt;br /&gt;
&lt;br /&gt;
It is important to note that an application that knows how to play FILM files can not assume a constant framerate. The files will not play correctly with such a method. It is also important to note that&lt;br /&gt;
converting FILM files to file formats that only support constant framerates (such as AVI) is not a winning strategy. The converted file will not play correctly.&lt;br /&gt;
&lt;br /&gt;
== Video Codecs ==&lt;br /&gt;
&lt;br /&gt;
If the video codec is 'cvid' in the FDSC chunk, the codec used is the deviant Cinepak format. A couple Dark Seed II videos also have the 'raw ' codec FourCC representing simple RGB888 data.&lt;br /&gt;
&lt;br /&gt;
=== FILM Deviant Cinepak ('cvid') Video Data ===&lt;br /&gt;
&lt;br /&gt;
The Cinepak data inside of a FILM file can not be decoded with a general purpose Cinepak decoding algorithm. It is reasonable to think that this was no accident. If FILM files contained standard CVID data, the files could be played on any computer that had some kind of Cinepak decoder implementation.&lt;br /&gt;
&lt;br /&gt;
This document assumes familiarity with the [[Cinepak]] algorithm.&lt;br /&gt;
&lt;br /&gt;
A CVID chunk is supposed to start with a 10-byte chunk header:&lt;br /&gt;
&lt;br /&gt;
  byte 0     flags&lt;br /&gt;
  bytes 1-3  length of CVID data&lt;br /&gt;
  bytes 4-5  width of coded frame&lt;br /&gt;
  bytes 6-7  height of coded frame&lt;br /&gt;
  bytes 8-9  number of coded strips&lt;br /&gt;
&lt;br /&gt;
Following the chunk header ought to be the first byte of the first strip header. In the deviant CVID data stored in a FILM file, there appear to be an extra 2 bytes at the end of the chunk header, bringing the total header size to 12 bytes.&lt;br /&gt;
&lt;br /&gt;
The length of the chunk as reported by the deviant CVID data chunk is also incorrect. The length field is supposed to report the length of the entire chunk including the header. The deviant CVID data reports a length that is 8 bytes too short. That is, the length reported in the CVID chunk is 8 bytes shorter than the length reported in the corresponding record of the FILM file's STAB chunk. The STAB chunk length takes into account the proper length, including the extra 2 bytes at the end of the chunk header.&lt;br /&gt;
&lt;br /&gt;
Finally, the deviant CVID data appears to throw a potential decoder one more curveball with what appears to be data chunks that don't have, for lack of a better term, properly divisible chunk lengths. For example, a 0x2000 chunk commonly has a length of 0x604 bytes, which provides 2 bytes for the chunk ID, 2 bytes for the chunk length, and 0x600 bytes for 256 6-byte vectors. However, the deviant CVID data might have a 0x2000 chunk with a length of 0x600 bytes, which provides for the 4 chunk preamble bytes and 0x5FC bytes for the 6-byte vectors which is not evenly divisible by 6. This apparently confuses Cinepak decoders. The solution in this case is to unpack 255 6-byte vectors and then skip 2 bytes before attempting to decode the next chunk in the strip.&lt;br /&gt;
&lt;br /&gt;
== FILM Audio Data ==&lt;br /&gt;
&lt;br /&gt;
Audio data in a FILM file can be stored in a variety of formats which are mostly linear [[PCM]] variants.&lt;br /&gt;
&lt;br /&gt;
The compression field of the FDSC chunk describes what kind of audio the video has. Two known values have been observed: 0 and 2. 0 is linear PCM and 2 is [[CRI ADX ADPCM]]. CRI ADX ADPCM has so far only been observed in Burning Rangers, with all other samples using linear PCM.&lt;br /&gt;
&lt;br /&gt;
Saturn CPK audio data is always stored as signed data. This is important to remember when playing 8-bit CPK audio data on a PC which generally expects 8-bit data to be unsigned.&lt;br /&gt;
&lt;br /&gt;
When a CPK file contains 16-bit audio data, the individual PCM samples are stored in big endian format. Again, this is important to remember when playing on a PC since a PC will generally expect little endian&lt;br /&gt;
16-bit data.&lt;br /&gt;
&lt;br /&gt;
If the CPK audio data is stereo (8- or 16-bit), the channel data is non-interleaved. Usually, stereo data is stored interleaved as a left channel sample followed by a right channel sample as follows:&lt;br /&gt;
&lt;br /&gt;
  L R L R L R L R ...&lt;br /&gt;
&lt;br /&gt;
In a stereo CPK file, for each audio data chunk, the first half of the chunk contains left channel samples and the second half contains right channel samples. The likely reason for this scheme is that console audio hardware such as that found on the Sega Saturn usually features a number of audio channels which can each play a mono PCM stream at a particular pan position (e.g., from 0-15 where 0 is extreme left, 7 and 8 are center, and 15 is extreme right). In order to play a stereo PCM stream, one physical audio channel must be assigned to extreme left while a second channel is assigned to extreme right. Then the appropriate channel samples are sent to the correct channel. Since these files are optimized for playback on the Sega Saturn it makes sense to arrange the audio samples like this.&lt;br /&gt;
&lt;br /&gt;
The Sega CD audio playback hardware ostensibly supports native sign/magnitude audio samples. All Sega CD games studied use this format to store audio data. Sign/magnitude number coding for 8-bit numbers&lt;br /&gt;
means that for each 8-bit byte:&lt;br /&gt;
&lt;br /&gt;
  bit 7      sign&lt;br /&gt;
  bits 6-0   magnitude (value)&lt;br /&gt;
&lt;br /&gt;
This is slightly different from twos complement encoding which is how computers typically store signed numbers. For example, in the sign/magnitude scheme, 0x81 represents -1 and 0xFF represents -127. 0x01&lt;br /&gt;
and 0x7F still represent 1 and 127, respectively, just as in unsigned, and signed twos complement coding.&lt;br /&gt;
&lt;br /&gt;
== Early Sega CD FILM Files ==&lt;br /&gt;
&lt;br /&gt;
Some Sega CD games as well as at least one 3DO game (Lemmings) use an early version of the FILM format. Unfortunately, there are a lot of variations and a general-purpose player will probably require a lot of&lt;br /&gt;
special-case logic in order to deal with every known circumstance.&lt;br /&gt;
&lt;br /&gt;
The first difference in these early files is the version number. These early files do not have ASCII-readable version fields. Some have NULL or other non-ASCII versions. This helps automatic detection.&lt;br /&gt;
&lt;br /&gt;
The second major difference that all of these early files appear to exhibit is an abbreviated FDSC chunk which omits any audio information. Thus, the FDSC chunk is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-3    'FDSC' chunk signature&lt;br /&gt;
  bytes 4-7    length of FDSC chunk (including signature and length&lt;br /&gt;
               fields); this FDSC chunk is 20 (0x14) bytes long&lt;br /&gt;
  bytes 8-11   FOURCC of video codec&lt;br /&gt;
  bytes 12-15  height of video frames&lt;br /&gt;
  bytes 16-19  width of video frames&lt;br /&gt;
&lt;br /&gt;
The lack of audio information leaves room for experimentation. The following is a list of known games which have early FILM files along with any special quirks observed.&lt;br /&gt;
&lt;br /&gt;
On the Lemmings 3DO game, there are 2 files with the .film extension (the 3DO game console uses a custom filesystem which allows for file extensions longer than 3 characters). The files have a NULL version field. The files use CVID data which is deviant in the same manner as typical FILM CVID data with an added quirk: There appear to be 6 extra bytes between the end of the CVID chunk header and the start of the first strip header, rather than the usual 2 extra bytes. The Lemmings FILM files also contain 8-bit signed, monaural PCM data with a sampling frequency of 22050 Hz.&lt;br /&gt;
&lt;br /&gt;
The Batman and Robin Sega CD title has a series of files with the extension .s. They are early FILM files with a version field of 0x00020000. Further, bytes 12-15 of the main FILM header are not set to 0 as is usually seen in FILM files. The files have a video fourcc of 'Seg4' which is probably Cinepak for Sega or a variant thereof. The files have STAB chunks which are a constant 0x20 (32) bytes long. This consists of the 'STAB' signature, a 4-byte chunk length, the base playback frequency, a sample count, and one 16-byte sample record. These files do not store the sample table in one place. Instead, they store one sample record followed immediately by the data corresponding to that sample record. Repeat until the end of the file.&lt;br /&gt;
&lt;br /&gt;
The Dracula Unleashed Sega CD title contains a series of files beginning with video?? with no file extension. They are early FILM files with a NULL version field, abbreviated FDSC chunk, and 'sega' as a video codec (Cinepak for Sega). The audio is 8-bit sign/magnitude audio with a sampling frequency of 16000 Hz.&lt;br /&gt;
&lt;br /&gt;
Jurassic Park for the Sega CD has a large number of files with the file extension .MVD. They are early FILM files with the same characteristics as the FILM files in Dracula Unleashed.&lt;br /&gt;
&lt;br /&gt;
The Tomcat Alley title for the Sega CD has a massive data file called tca.bin. Inside this data file are a lot of FILM files. These files have NULL version fields. The files have abbreviated FDSC chunks and the&lt;br /&gt;
'sega' video fourcc. They also have short STAB chunks with an Apple Quicktime 'mdia' atom appended at the end.&lt;br /&gt;
&lt;br /&gt;
== Strategy For Detecting FILM File Types ==&lt;br /&gt;
&lt;br /&gt;
There are quite a few variations and deviations in the FILM file format. This section presents logic for detecting and dealing with the variations.&lt;br /&gt;
&lt;br /&gt;
File extension detection is not especially useful since many games will masquerade their files with another extension. The best method to determine whether a file is a FILM file is to read the first 4 bytes and check for the signature 'FILM'.&lt;br /&gt;
&lt;br /&gt;
Upon validating the signature:&lt;br /&gt;
&lt;br /&gt;
* read the file version in the FILM header&lt;br /&gt;
* if the file version consists of ASCII characters&lt;br /&gt;
** if the file version is '1.09', watch out for bad length of STAB chunk as well as ADPCM audio&lt;br /&gt;
** load as standard FILM file, be sure to feed CVID data through Cinepak decoder that can handle it&lt;br /&gt;
* if the file version is 0x00020000&lt;br /&gt;
** read the video fourcc&lt;br /&gt;
** if the video fourcc is 'Seg4'&lt;br /&gt;
*** assume the file comes from Batman and Robin&lt;br /&gt;
* if the file version is NULL&lt;br /&gt;
** read the video fourcc&lt;br /&gt;
** if the video fourcc is 'cvid'&lt;br /&gt;
*** assume the file comes from the Lemmings 3DO game&lt;br /&gt;
*** be prepared to decode special variant of modified CVID data&lt;br /&gt;
*** assume 8-bit, mono, 22050 Hz PCM audio&lt;br /&gt;
** if the video fourcc is 'sega'&lt;br /&gt;
*** assume the file comes from one of several Sega CD games that agreed on this format&lt;br /&gt;
*** assume 8-bit, mono, 16000 Hz sign/magnitude audio&lt;br /&gt;
&lt;br /&gt;
== Games That Use FILM Files ==&lt;br /&gt;
&lt;br /&gt;
These games are known to use some variation of FILM files. Observed file version numbers are noted where known.&lt;br /&gt;
&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/astal Astal (Sega Saturn)]: '0.91', '1.06'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/burning-rangers Burning Rangers (Sega Saturn)]: '1.09'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/clockwork-knight Clockwork Knight (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/criticom Criticom (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/d D (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/sega-saturn/dark-seed-ii Dark Seed II (Sega Saturn)]: '1.09'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/defcon-5 Defcon 5 (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/iron-storm_ Iron Storm (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/3do/lemmings Lemmings (3DO)]: unversioned&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/myst Myst (Sega Saturn)]: '1.01'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/nights-into-dreams Nights Into Dreams (Sega Saturn)]: '0.91', '1.01', '1.06', '1.07', '1.08'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/panzer-dragoon Panzer Dragoon (Sega Saturn)]: '1.04'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/panzer-dragoon-ii-zwei Panzer Dragoon II: Zwei (Sega Saturn)]: '1.07'&lt;br /&gt;
* [http://www.mobygames.com/game/sega-saturn/roberta-williams-phantasmagoria Phantasm (Sega Saturn)]: '1.06', '1.08', '1.09'&lt;br /&gt;
* [http://www.mobygames.com/game/sega-saturn/return-to-zork Return to Zork (Sega Saturn)]: '1.02', '1.06', '1.07'&lt;br /&gt;
* Sega Saturn Bootleg Sampler (Sega Saturn): '1.04'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/shockwave-assault Shockwave Assault (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/skeleton-warriors Skeleton Warriors (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/space-jam Space Jam (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/street-fighter-the-movie Street Fighter: The Movie (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/virtua-squad-virtual-cop Virtua Cop (Sega Saturn)]: '1.08'&lt;br /&gt;
* World Series Baseball II (Sega Saturn)&lt;br /&gt;
&lt;br /&gt;
[[Category:Container Formats]]&lt;br /&gt;
[[Category:Game Formats]]&lt;/div&gt;</summary>
		<author><name>Clone2727</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Sega_FILM&amp;diff=13515</id>
		<title>Sega FILM</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Sega_FILM&amp;diff=13515"/>
		<updated>2011-07-05T13:31:16Z</updated>

		<summary type="html">&lt;p&gt;Clone2727: /* Games That Use FILM Files */ add RTZ&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''This page is based on the document 'Description of the Sega FILM/CPK File Format' by Mike Melanson found at [http://multimedia.cx/film-format.txt http://multimedia.cx/film-format.txt].''&lt;br /&gt;
&lt;br /&gt;
* Extensions: cpk, cak, film&lt;br /&gt;
* Company: [[Sega (Company)|Sega]]&lt;br /&gt;
* Samples:&lt;br /&gt;
** [http://samples.mplayerhq.hu/game-formats/film-cpk/ http://samples.mplayerhq.hu/game-formats/film-cpk/]&lt;br /&gt;
** Batman and Robin Sega CD with 'Seg4' data: [http://samples.mplayerhq.hu/game-formats/segacd/batmanandrobin-film-seg4/ http://samples.mplayerhq.hu/game-formats/segacd/batmanandrobin-film-seg4/]&lt;br /&gt;
** Dracula Unleashed/Sega CD: [http://samples.mplayerhq.hu/game-formats/segacd/dracula-unleashed-film/ http://samples.mplayerhq.hu/game-formats/segacd/dracula-unleashed-film/]&lt;br /&gt;
** Jurassic Park/Sega CD: [http://samples.mplayerhq.hu/game-formats/segacd/jurassicpark-film/ http://samples.mplayerhq.hu/game-formats/segacd/jurassicpark-film/]&lt;br /&gt;
&lt;br /&gt;
FILM is a multimedia container file format developed by Sega for use on its early CD-ROM home video game consoles. Based on analysis of a number of Sega CD and Saturn games, it appears that the format was first developed sometime during the era of the Sega CD, Sega's first CD-based video game console. There are many early variations of the FILM format observed on a number of Sega CD titles. Further, early FILM files have been observed on at least one 3DO game ([http://www.mobygames.com/game/3do/lemmings Lemmings]).&lt;br /&gt;
&lt;br /&gt;
The Sega Saturn video game console, released in 1994, was also CD-ROM-based and apparently offered developers a standardized SDK for full motion video (FMV) playback using a modified variant of the well-known [[Cinepak]] video codec.&lt;br /&gt;
&lt;br /&gt;
It is possible to store both audio and video in a FILM file. Alternatively, the format is able to handle either video without audio, or vice versa.&lt;br /&gt;
 &lt;br /&gt;
== Sega Saturn CPK File Format ==&lt;br /&gt;
&lt;br /&gt;
All multi-byte numbers are stored in big endian format.&lt;br /&gt;
&lt;br /&gt;
Many Sega Saturn CD-ROM games use this file format to store frames of a Cinepak-compressed video interleaved with uncompressed [[PCM]] audio. When this is the case, the files will typically have the extension .CPK (which is why FILM files are usually known as CPK files). Sometimes, audio-only FILM files will have a .SND extension.&lt;br /&gt;
&lt;br /&gt;
The general format is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 +-----------------------+&lt;br /&gt;
 | +-------------------+ |&lt;br /&gt;
 | | FILM header       | |&lt;br /&gt;
 | |                   | |&lt;br /&gt;
 | | +---------------+ | |&lt;br /&gt;
 | | | FDSC chunk    | | |&lt;br /&gt;
 | | +---------------+ | |&lt;br /&gt;
 | |                   | |&lt;br /&gt;
 | | +---------------+ | |&lt;br /&gt;
 | | | STAB chunk    | | |&lt;br /&gt;
 | | +---------------+ | |&lt;br /&gt;
 | |                   | |&lt;br /&gt;
 | +-------------------+ |&lt;br /&gt;
 |                       |&lt;br /&gt;
 | Audio or Video Data   |&lt;br /&gt;
 |  ..                   |&lt;br /&gt;
 |  ..                   |&lt;br /&gt;
 +-----------------------+&lt;br /&gt;
&lt;br /&gt;
A FILM file will usually consist of a header followed by interleaved audio and video chunks. The FILM header has the following structure:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-3    'FILM' signature&lt;br /&gt;
  bytes 4-7    length of FILM header (including signature and length&lt;br /&gt;
               fields)&lt;br /&gt;
  bytes 8-11   FILM format version in ASCII (ex: '1.01' or '1.07')&lt;br /&gt;
  bytes 12-15  unknown (may be reserved and set to 0)&lt;br /&gt;
  bytes 16-n   remainder of FILM header&lt;br /&gt;
&lt;br /&gt;
Different Sega Saturn games include FILM files with a variety of FILM version numbers. Sometimes, the same game will include FILM files with a variety of format versions. A version number implies that there has been some change to the file format, but I have yet to observe any differences between different FILM file versions (except possibly for version '1.09'; see STAB chunk for more details).&lt;br /&gt;
&lt;br /&gt;
The remainder of the FILM header contains a number of chunks describing the media data in the file. Usually, the number of chunks is 2: A FDSC chunk and a STAB chunk.&lt;br /&gt;
&lt;br /&gt;
A FDSC chunk contains file description information. The chunk format is as follows:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-3    'FDSC' chunk signature&lt;br /&gt;
  bytes 4-7    length of FDSC chunk (including signature and length&lt;br /&gt;
               fields); an FDSC chunk should be 32 (0x20) bytes long&lt;br /&gt;
  bytes 8-11   FOURCC of video codec (usually 'cvid' for Cinepak or null&lt;br /&gt;
               for no video)&lt;br /&gt;
  bytes 12-15  height of video frames&lt;br /&gt;
  bytes 16-19  width of video frames&lt;br /&gt;
  byte 20      bits per pixel (always seems to be 24)&lt;br /&gt;
  byte 21      number of audio channels&lt;br /&gt;
  byte 22      audio sampling resolution in bits (either 8 or 16)&lt;br /&gt;
  byte 23      unknown&lt;br /&gt;
  bytes 24-25  audio sampling frequency in Hz&lt;br /&gt;
  bytes 26-31  unknown (may be reserved and set to 0)&lt;br /&gt;
&lt;br /&gt;
Note that the height field precedes the width field, which is unusual since width usually precedes height when expressing video resolution.&lt;br /&gt;
&lt;br /&gt;
The fields pertaining to audio (channels, bits, and sample rate) will all be 0 if there is no audio present in the file.&lt;br /&gt;
&lt;br /&gt;
A STAB chunk contains a table of media sample information. The chunk format is as follows:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-3    'STAB' chunk signature&lt;br /&gt;
  bytes 4-7    length of STAB chunk (including signature and length&lt;br /&gt;
               fields)&lt;br /&gt;
  bytes 8-11   framerate base frequency in Hz&lt;br /&gt;
  bytes 12-15  number of entries in the sample table&lt;br /&gt;
  bytes 16-n   sample table&lt;br /&gt;
&lt;br /&gt;
Note that the length field ought to take the first 16 chunk bytes into account. However, it has been observed from some games (notably [http://www.mobygames.com/game/saturn/burning-rangers Burning Rangers] using '1.09' version FILM files) that the length field sometimes does not account for these 16 bytes.&lt;br /&gt;
&lt;br /&gt;
The sample table consists of a series of 16-byte sample records. Each record is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-3    offset of sample chunk from beginning of sample data&lt;br /&gt;
  bytes 4-7    length of sample chunk&lt;br /&gt;
  bytes 8-11   sample info 1&lt;br /&gt;
  bytes 12-15  sample info 2&lt;br /&gt;
&lt;br /&gt;
The offset is the offset from the start of the sample data, not the absolute offset in the file. The length of the FILM header implicitly serves as a pointer to the beginning of the sample data in the file.&lt;br /&gt;
&lt;br /&gt;
If the sample info 1 field is set to all ones, the sample is an audio chunk. Otherwise, it is a video chunk. If it is a video chunk, the top bit of the 32-bit number specifies whether the chunk is an inter-coded or an intra-coded frame. 0=intra-coded (a.k.a. keyframe), 1=inter-coded. This is useful for seeking since it is a good idea to only jump to key frames when seeking through a file.&lt;br /&gt;
&lt;br /&gt;
The rest of the first sample info field and the second sample info field pertain to framerate calculation. Refer to the section on FILM framerate calculation for more information on proper FILM playback using these sample info fields.&lt;br /&gt;
&lt;br /&gt;
== FILM Framerate Calculation ==&lt;br /&gt;
&lt;br /&gt;
The STAB chunk contains a framerate base frequency in bytes 8-11. This frequency is expressed in ticks/second (Hz). Every video chunk has a frame tick count. For example, movie files in Panzer Dragoon I &amp;amp; II (FILM format versions 1.04 and 1.07, respectively) have a base frequency of 600 Hz. The frames have tick counts of 0, 20, 40, 60, 80, etc. Thus, there are 20 ticks between each successive frame.&lt;br /&gt;
&lt;br /&gt;
  (600 ticks/sec) / (20 ticks/frame) = 30 frames/second&lt;br /&gt;
&lt;br /&gt;
However, not all FILM files exhibit such a nice, even framerate. Myst, for example, contains FILM files (version 1.01) with a base frequency of 30 Hz. Some of the frames skip 2, then 3 ticks. Here's a sample tick count progression: 0, 2, 5, 7, 10, 12, 15, 17...&lt;br /&gt;
&lt;br /&gt;
Each STAB record has 2 32-bit sample info fields. For an audio chunk, sample info 1 is all ones and sample info 2 is always 1. For a video chunk, sample info 1 contains the keyframe bit (as described in the STAB section) and the absolute timestamp in clock ticks of the video frame with respect to the file's base frequency clock. The sample info 2 field contains the number of clock ticks until the next frame is rendered. This type of information would be particularly useful in an interrupt-driven, real-time multimedia system like, for instance, a video game console (such as the Sega Saturn).&lt;br /&gt;
&lt;br /&gt;
It is important to note that an application that knows how to play FILM files can not assume a constant framerate. The files will not play correctly with such a method. It is also important to note that&lt;br /&gt;
converting FILM files to file formats that only support constant framerates (such as AVI) is not a winning strategy. The converted file will not play correctly.&lt;br /&gt;
&lt;br /&gt;
== Video Codecs ==&lt;br /&gt;
&lt;br /&gt;
If the video codec is 'cvid' in the FDSC chunk, the codec used is the deviant Cinepak format. A couple Dark Seed II videos also have the 'raw ' codec FourCC representing simple RGB888 data.&lt;br /&gt;
&lt;br /&gt;
=== FILM Deviant Cinepak ('cvid') Video Data ===&lt;br /&gt;
&lt;br /&gt;
The Cinepak data inside of a FILM file can not be decoded with a general purpose Cinepak decoding algorithm. It is reasonable to think that this was no accident. If FILM files contained standard CVID data, the files could be played on any computer that had some kind of Cinepak decoder implementation.&lt;br /&gt;
&lt;br /&gt;
This document assumes familiarity with the [[Cinepak]] algorithm.&lt;br /&gt;
&lt;br /&gt;
A CVID chunk is supposed to start with a 10-byte chunk header:&lt;br /&gt;
&lt;br /&gt;
  byte 0     flags&lt;br /&gt;
  bytes 1-3  length of CVID data&lt;br /&gt;
  bytes 4-5  width of coded frame&lt;br /&gt;
  bytes 6-7  height of coded frame&lt;br /&gt;
  bytes 8-9  number of coded strips&lt;br /&gt;
&lt;br /&gt;
Following the chunk header ought to be the first byte of the first strip header. In the deviant CVID data stored in a FILM file, there appear to be an extra 2 bytes at the end of the chunk header, bringing the total header size to 12 bytes.&lt;br /&gt;
&lt;br /&gt;
The length of the chunk as reported by the deviant CVID data chunk is also incorrect. The length field is supposed to report the length of the entire chunk including the header. The deviant CVID data reports a length that is 8 bytes too short. That is, the length reported in the CVID chunk is 8 bytes shorter than the length reported in the corresponding record of the FILM file's STAB chunk. The STAB chunk length takes into account the proper length, including the extra 2 bytes at the end of the chunk header.&lt;br /&gt;
&lt;br /&gt;
Finally, the deviant CVID data appears to throw a potential decoder one more curveball with what appears to be data chunks that don't have, for lack of a better term, properly divisible chunk lengths. For example, a 0x2000 chunk commonly has a length of 0x604 bytes, which provides 2 bytes for the chunk ID, 2 bytes for the chunk length, and 0x600 bytes for 256 6-byte vectors. However, the deviant CVID data might have a 0x2000 chunk with a length of 0x600 bytes, which provides for the 4 chunk preamble bytes and 0x5FC bytes for the 6-byte vectors which is not evenly divisible by 6. This apparently confuses Cinepak decoders. The solution in this case is to unpack 255 6-byte vectors and then skip 2 bytes before attempting to decode the next chunk in the strip.&lt;br /&gt;
&lt;br /&gt;
== FILM Audio Data ==&lt;br /&gt;
&lt;br /&gt;
Audio data in a FILM file can be stored in a variety of formats which are mostly linear [[PCM]] variants.&lt;br /&gt;
&lt;br /&gt;
CPK files from Sega Saturn games almost always contain linear PCM audio. The one known exception is Burning Rangers. This game apparently uses [[CRI ADX ADPCM]] audio coding.&lt;br /&gt;
&lt;br /&gt;
Saturn CPK audio data is always stored as signed data. This is important to remember when playing 8-bit CPK audio data on a PC which generally expects 8-bit data to be unsigned.&lt;br /&gt;
&lt;br /&gt;
When a CPK file contains 16-bit audio data, the individual PCM samples are stored in big endian format. Again, this is important to remember when playing on a PC since a PC will generally expect little endian&lt;br /&gt;
16-bit data.&lt;br /&gt;
&lt;br /&gt;
If the CPK audio data is stereo (8- or 16-bit), the channel data is non-interleaved. Usually, stereo data is stored interleaved as a left channel sample followed by a right channel sample as follows:&lt;br /&gt;
&lt;br /&gt;
  L R L R L R L R ...&lt;br /&gt;
&lt;br /&gt;
In a stereo CPK file, for each audio data chunk, the first half of the chunk contains left channel samples and the second half contains right channel samples. The likely reason for this scheme is that console audio hardware such as that found on the Sega Saturn usually features a number of audio channels which can each play a mono PCM stream at a particular pan position (e.g., from 0-15 where 0 is extreme left, 7 and 8 are center, and 15 is extreme right). In order to play a stereo PCM stream, one physical audio channel must be assigned to extreme left while a second channel is assigned to extreme right. Then the appropriate channel samples are sent to the correct channel. Since these files are optimized for playback on the Sega Saturn it makes sense to arrange the audio samples like this.&lt;br /&gt;
&lt;br /&gt;
The Sega CD audio playback hardware ostensibly supports native sign/magnitude audio samples. All Sega CD games studied use this format to store audio data. Sign/magnitude number coding for 8-bit numbers&lt;br /&gt;
means that for each 8-bit byte:&lt;br /&gt;
&lt;br /&gt;
  bit 7      sign&lt;br /&gt;
  bits 6-0   magnitude (value)&lt;br /&gt;
&lt;br /&gt;
This is slightly different from twos complement encoding which is how computers typically store signed numbers. For example, in the sign/magnitude scheme, 0x81 represents -1 and 0xFF represents -127. 0x01&lt;br /&gt;
and 0x7F still represent 1 and 127, respectively, just as in unsigned, and signed twos complement coding.&lt;br /&gt;
&lt;br /&gt;
== Early Sega CD FILM Files ==&lt;br /&gt;
&lt;br /&gt;
Some Sega CD games as well as at least one 3DO game (Lemmings) use an early version of the FILM format. Unfortunately, there are a lot of variations and a general-purpose player will probably require a lot of&lt;br /&gt;
special-case logic in order to deal with every known circumstance.&lt;br /&gt;
&lt;br /&gt;
The first difference in these early files is the version number. These early files do not have ASCII-readable version fields. Some have NULL or other non-ASCII versions. This helps automatic detection.&lt;br /&gt;
&lt;br /&gt;
The second major difference that all of these early files appear to exhibit is an abbreviated FDSC chunk which omits any audio information. Thus, the FDSC chunk is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-3    'FDSC' chunk signature&lt;br /&gt;
  bytes 4-7    length of FDSC chunk (including signature and length&lt;br /&gt;
               fields); this FDSC chunk is 20 (0x14) bytes long&lt;br /&gt;
  bytes 8-11   FOURCC of video codec&lt;br /&gt;
  bytes 12-15  height of video frames&lt;br /&gt;
  bytes 16-19  width of video frames&lt;br /&gt;
&lt;br /&gt;
The lack of audio information leaves room for experimentation. The following is a list of known games which have early FILM files along with any special quirks observed.&lt;br /&gt;
&lt;br /&gt;
On the Lemmings 3DO game, there are 2 files with the .film extension (the 3DO game console uses a custom filesystem which allows for file extensions longer than 3 characters). The files have a NULL version field. The files use CVID data which is deviant in the same manner as typical FILM CVID data with an added quirk: There appear to be 6 extra bytes between the end of the CVID chunk header and the start of the first strip header, rather than the usual 2 extra bytes. The Lemmings FILM files also contain 8-bit signed, monaural PCM data with a sampling frequency of 22050 Hz.&lt;br /&gt;
&lt;br /&gt;
The Batman and Robin Sega CD title has a series of files with the extension .s. They are early FILM files with a version field of 0x00020000. Further, bytes 12-15 of the main FILM header are not set to 0 as is usually seen in FILM files. The files have a video fourcc of 'Seg4' which is probably Cinepak for Sega or a variant thereof. The files have STAB chunks which are a constant 0x20 (32) bytes long. This consists of the 'STAB' signature, a 4-byte chunk length, the base playback frequency, a sample count, and one 16-byte sample record. These files do not store the sample table in one place. Instead, they store one sample record followed immediately by the data corresponding to that sample record. Repeat until the end of the file.&lt;br /&gt;
&lt;br /&gt;
The Dracula Unleashed Sega CD title contains a series of files beginning with video?? with no file extension. They are early FILM files with a NULL version field, abbreviated FDSC chunk, and 'sega' as a video codec (Cinepak for Sega). The audio is 8-bit sign/magnitude audio with a sampling frequency of 16000 Hz.&lt;br /&gt;
&lt;br /&gt;
Jurassic Park for the Sega CD has a large number of files with the file extension .MVD. They are early FILM files with the same characteristics as the FILM files in Dracula Unleashed.&lt;br /&gt;
&lt;br /&gt;
The Tomcat Alley title for the Sega CD has a massive data file called tca.bin. Inside this data file are a lot of FILM files. These files have NULL version fields. The files have abbreviated FDSC chunks and the&lt;br /&gt;
'sega' video fourcc. They also have short STAB chunks with an Apple Quicktime 'mdia' atom appended at the end.&lt;br /&gt;
&lt;br /&gt;
== Strategy For Detecting FILM File Types ==&lt;br /&gt;
&lt;br /&gt;
There are quite a few variations and deviations in the FILM file format. This section presents logic for detecting and dealing with the variations.&lt;br /&gt;
&lt;br /&gt;
File extension detection is not especially useful since many games will masquerade their files with another extension. The best method to determine whether a file is a FILM file is to read the first 4 bytes and check for the signature 'FILM'.&lt;br /&gt;
&lt;br /&gt;
Upon validating the signature:&lt;br /&gt;
&lt;br /&gt;
* read the file version in the FILM header&lt;br /&gt;
* if the file version consists of ASCII characters&lt;br /&gt;
** if the file version is '1.09', watch out for bad length of STAB chunk as well as ADPCM audio&lt;br /&gt;
** load as standard FILM file, be sure to feed CVID data through Cinepak decoder that can handle it&lt;br /&gt;
* if the file version is 0x00020000&lt;br /&gt;
** read the video fourcc&lt;br /&gt;
** if the video fourcc is 'Seg4'&lt;br /&gt;
*** assume the file comes from Batman and Robin&lt;br /&gt;
* if the file version is NULL&lt;br /&gt;
** read the video fourcc&lt;br /&gt;
** if the video fourcc is 'cvid'&lt;br /&gt;
*** assume the file comes from the Lemmings 3DO game&lt;br /&gt;
*** be prepared to decode special variant of modified CVID data&lt;br /&gt;
*** assume 8-bit, mono, 22050 Hz PCM audio&lt;br /&gt;
** if the video fourcc is 'sega'&lt;br /&gt;
*** assume the file comes from one of several Sega CD games that agreed on this format&lt;br /&gt;
*** assume 8-bit, mono, 16000 Hz sign/magnitude audio&lt;br /&gt;
&lt;br /&gt;
== Games That Use FILM Files ==&lt;br /&gt;
&lt;br /&gt;
These games are known to use some variation of FILM files. Observed file version numbers are noted where known.&lt;br /&gt;
&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/astal Astal (Sega Saturn)]: '0.91', '1.06'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/burning-rangers Burning Rangers (Sega Saturn)]: '1.09'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/clockwork-knight Clockwork Knight (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/criticom Criticom (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/d D (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/sega-saturn/dark-seed-ii Dark Seed II (Sega Saturn)]: '1.09'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/defcon-5 Defcon 5 (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/iron-storm_ Iron Storm (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/3do/lemmings Lemmings (3DO)]: unversioned&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/myst Myst (Sega Saturn)]: '1.01'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/nights-into-dreams Nights Into Dreams (Sega Saturn)]: '0.91', '1.01', '1.06', '1.07', '1.08'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/panzer-dragoon Panzer Dragoon (Sega Saturn)]: '1.04'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/panzer-dragoon-ii-zwei Panzer Dragoon II: Zwei (Sega Saturn)]: '1.07'&lt;br /&gt;
* [http://www.mobygames.com/game/sega-saturn/roberta-williams-phantasmagoria Phantasm (Sega Saturn)]: '1.06', '1.08', '1.09'&lt;br /&gt;
* [http://www.mobygames.com/game/sega-saturn/return-to-zork Return to Zork (Sega Saturn)]: '1.02', '1.06', '1.07'&lt;br /&gt;
* Sega Saturn Bootleg Sampler (Sega Saturn): '1.04'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/shockwave-assault Shockwave Assault (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/skeleton-warriors Skeleton Warriors (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/space-jam Space Jam (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/street-fighter-the-movie Street Fighter: The Movie (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/virtua-squad-virtual-cop Virtua Cop (Sega Saturn)]: '1.08'&lt;br /&gt;
* World Series Baseball II (Sega Saturn)&lt;br /&gt;
&lt;br /&gt;
[[Category:Container Formats]]&lt;br /&gt;
[[Category:Game Formats]]&lt;/div&gt;</summary>
		<author><name>Clone2727</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Sofdec&amp;diff=13423</id>
		<title>Sofdec</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Sofdec&amp;diff=13423"/>
		<updated>2011-04-23T23:15:44Z</updated>

		<summary type="html">&lt;p&gt;Clone2727: typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: sfd&lt;br /&gt;
* Company: [[CRI]]&lt;br /&gt;
* Website: http://www.cri-mw.co.jp/products/product_sfd_e.htm&lt;br /&gt;
* Samples: Official website above, http://samples.mplayerhq.hu/game-formats/sfd/&lt;br /&gt;
&lt;br /&gt;
SFD is a format commonly found on [[Sega Dreamcast]] console games, and is also available for a number of other video game consoles. The files package [[MPEG]] video with a custom ADPCM audio codec called [[CRI ADX ADPCM]] in a standard [[MPEG-PS]] container.&lt;br /&gt;
&lt;br /&gt;
Currently many MPEG decoders (ex. [[FFmpeg]]) fails to process recent SFD files properly, generating highly blocky/garbled output.&lt;br /&gt;
&lt;br /&gt;
== Games Using Sofdec ==&lt;br /&gt;
* Battle Stadium DON (Nintendo GameCube)&lt;br /&gt;
* Crysis Demo (PC)&lt;br /&gt;
* [http://www.mobygames.com/game/gamecube/f-zero-gx F-Zero GX (Nintendo GameCube)]&lt;br /&gt;
* Marvel Ultimate Allience (PC, Sony Playstation 2)&lt;br /&gt;
* [http://www.mobygames.com/game/dreamcast/resident-evil-code-veronica Resident Evil: Code Veronica (Sega Dreamcast)]&lt;br /&gt;
* [http://www.mobygames.com/game/gamecube/resident-evil-code-veronica-x Resident Evil: Code Veronica X (Nintendo GameCube)]&lt;br /&gt;
* [http://www.mobygames.com/game/gamecube/resident-evil-4 Resident Evil 4 (Nintendo GameCube)]&lt;br /&gt;
* [http://www.mobygames.com/game/gamecube/sonic-adventure-2-battle Sonic Adventure 2: Battle (Nintendo GameCube)]&lt;br /&gt;
* [http://www.mobygames.com/game/gamecube/soulcalibur-ii SoulCalibur 2 (Nintendo GameCube)]&lt;br /&gt;
* [http://www.mobygames.com/game/gamecube/star-fox-assault Starfox Assault (Nintendo GameCube)]&lt;br /&gt;
* [http://www.mobygames.com/game/gamecube/star-wars-bounty-hunter Star Wars: Bounty Hunter (Nintendo GameCube)]&lt;br /&gt;
&lt;br /&gt;
[[Category:Game Formats]]&lt;/div&gt;</summary>
		<author><name>Clone2727</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Smush&amp;diff=13420</id>
		<title>Smush</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Smush&amp;diff=13420"/>
		<updated>2011-04-19T02:17:08Z</updated>

		<summary type="html">&lt;p&gt;Clone2727: fill in some more versions; note that Rebel Assault has the old ANIM v1 format&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page attempts to document the [[LucasArts]] Smush codec. The [[SANM]] codec document is complete; the SAN codec is still under (de)construction.&lt;br /&gt;
&lt;br /&gt;
Samples from various games are located at http://samples.mplayerhq.hu/game-formats/la-san/ and http://samples.mplayerhq.hu/game-formats/la-snm/.&lt;br /&gt;
&lt;br /&gt;
== Usage Matrix ==&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Name !! Variant !! Video Codec || Audio Codec&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/dos/star-wars-rebel-assault Rebel Assault]&lt;br /&gt;
| ANIM v1 || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/dos/star-wars-rebel-assault-ii-the-hidden-empire Rebel Assault II]&lt;br /&gt;
| ANIM v2 || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Rebel Assault II demo&lt;br /&gt;
| ANIM v2 || FOBJ Codec 37 || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Rebel Assault II trailer&lt;br /&gt;
| ANIM v2 || &amp;amp;nbsp; || PSAD&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/dos/full-throttle Full Throttle]&lt;br /&gt;
| ANIM v2 || FOBJ Codec 37 || PSAD&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/dos/dig The Dig]&lt;br /&gt;
| ANIM v2 || FOBJ Codec 37 || IACT&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/curse-of-monkey-island The Curse Of Monkey Island]&lt;br /&gt;
| ANIM v2 || FOBJ Codec 47 || IACT&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/outlaws Outlaws]&lt;br /&gt;
| ANIM v2 || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Outlaws demo&lt;br /&gt;
| ANIM v2 || FOBJ Codec 47 || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Grim Fandango demo&lt;br /&gt;
| ANIM v2 || FOBJ Codec 47 || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Grim Fandango trailer&lt;br /&gt;
| ANIM v2 || &amp;amp;nbsp; || IACT&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/grim-fandango Grim Fandango]&lt;br /&gt;
| SANM || Bl16 (blocky16) || [[VIMA]]&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/star-wars-shadows-of-the-empire Shadows of the Empire (PC)]&lt;br /&gt;
| ANIM v2 || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-	 &lt;br /&gt;
| [http://www.mobygames.com/game/windows/star-wars-x-wing-alliance X-Wing Alliance]&lt;br /&gt;
| SANM || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/star-wars-episode-i-racer Star Wars Racer]&lt;br /&gt;
| SANM + gzip (ZNM) || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/star-wars-droidworks Star Wars DroidWorks]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/indiana-jones-and-the-infernal-machine Indiana Jones and the Infernal Machine]&lt;br /&gt;
| SANM || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/star-wars-jedi-knight-mysteries-of-the-sith Jedi Knight: Mysteries of the Sith]&lt;br /&gt;
| ANIM v2 || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/mortimer-and-the-riddles-of-the-medallion Mortimer and the Riddles of the Medallion]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Making Magic CDROM (not a game but still uses smush)&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/escape-from-monkey-island Escape From Monkey Island] &lt;br /&gt;
| &amp;amp;nbsp; || apparently has Smush headers but uses [[Bink Container|Bink]] || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Star Wars Episode 1: Insider's Guide&lt;br /&gt;
| SANM || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Jar Jar's Journey Storybook&lt;br /&gt;
| SANM || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Variants ==&lt;br /&gt;
Smush comes in two variants. FOURCC &amp;quot;[[SAN|ANIM]]&amp;quot; was used up until Grim Fandango, and this variant has two sub-variants: v1 (Rebel Assault only) and v2 (all others). FOURCC &amp;quot;[[SNM|SANM]]&amp;quot; was used from Grim Fandango up until its replacement by [[Bink Container|Bink]], possibly in Escape From Monkey Island.&lt;br /&gt;
&lt;br /&gt;
[[Category:Game Formats]]&lt;br /&gt;
[[Category:Undiscovered Game Formats]]&lt;/div&gt;</summary>
		<author><name>Clone2727</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Sega_FILM&amp;diff=12893</id>
		<title>Sega FILM</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Sega_FILM&amp;diff=12893"/>
		<updated>2010-08-12T02:23:56Z</updated>

		<summary type="html">&lt;p&gt;Clone2727: add info on the Dark Seed II raw videos&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''This page is based on the document 'Description of the Sega FILM/CPK File Format' by Mike Melanson found at [http://multimedia.cx/film-format.txt http://multimedia.cx/film-format.txt].''&lt;br /&gt;
&lt;br /&gt;
* Extensions: cpk, cak, film&lt;br /&gt;
* Company: [[Sega (Company)|Sega]]&lt;br /&gt;
* Samples:&lt;br /&gt;
** [http://samples.mplayerhq.hu/game-formats/film-cpk/ http://samples.mplayerhq.hu/game-formats/film-cpk/]&lt;br /&gt;
** Batman and Robin Sega CD with 'Seg4' data: [http://samples.mplayerhq.hu/game-formats/segacd/batmanandrobin-film-seg4/ http://samples.mplayerhq.hu/game-formats/segacd/batmanandrobin-film-seg4/]&lt;br /&gt;
** Dracula Unleashed/Sega CD: [http://samples.mplayerhq.hu/game-formats/segacd/dracula-unleashed-film/ http://samples.mplayerhq.hu/game-formats/segacd/dracula-unleashed-film/]&lt;br /&gt;
** Jurassic Park/Sega CD: [http://samples.mplayerhq.hu/game-formats/segacd/jurassicpark-film/ http://samples.mplayerhq.hu/game-formats/segacd/jurassicpark-film/]&lt;br /&gt;
&lt;br /&gt;
FILM is a multimedia container file format developed by Sega for use on its early CD-ROM home video game consoles. Based on analysis of a number of Sega CD and Saturn games, it appears that the format was first developed sometime during the era of the Sega CD, Sega's first CD-based video game console. There are many early variations of the FILM format observed on a number of Sega CD titles. Further, early FILM files have been observed on at least one 3DO game ([http://www.mobygames.com/game/3do/lemmings Lemmings]).&lt;br /&gt;
&lt;br /&gt;
The Sega Saturn video game console, released in 1994, was also CD-ROM-based and apparently offered developers a standardized SDK for full motion video (FMV) playback using a modified variant of the well-known [[Cinepak]] video codec.&lt;br /&gt;
&lt;br /&gt;
It is possible to store both audio and video in a FILM file. Alternatively, the format is able to handle either video without audio, or vice versa.&lt;br /&gt;
 &lt;br /&gt;
== Sega Saturn CPK File Format ==&lt;br /&gt;
&lt;br /&gt;
All multi-byte numbers are stored in big endian format.&lt;br /&gt;
&lt;br /&gt;
Many Sega Saturn CD-ROM games use this file format to store frames of a Cinepak-compressed video interleaved with uncompressed [[PCM]] audio. When this is the case, the files will typically have the extension .CPK (which is why FILM files are usually known as CPK files). Sometimes, audio-only FILM files will have a .SND extension.&lt;br /&gt;
&lt;br /&gt;
The general format is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 +-----------------------+&lt;br /&gt;
 | +-------------------+ |&lt;br /&gt;
 | | FILM header       | |&lt;br /&gt;
 | |                   | |&lt;br /&gt;
 | | +---------------+ | |&lt;br /&gt;
 | | | FDSC chunk    | | |&lt;br /&gt;
 | | +---------------+ | |&lt;br /&gt;
 | |                   | |&lt;br /&gt;
 | | +---------------+ | |&lt;br /&gt;
 | | | STAB chunk    | | |&lt;br /&gt;
 | | +---------------+ | |&lt;br /&gt;
 | |                   | |&lt;br /&gt;
 | +-------------------+ |&lt;br /&gt;
 |                       |&lt;br /&gt;
 | Audio or Video Data   |&lt;br /&gt;
 |  ..                   |&lt;br /&gt;
 |  ..                   |&lt;br /&gt;
 +-----------------------+&lt;br /&gt;
&lt;br /&gt;
A FILM file will usually consist of a header followed by interleaved audio and video chunks. The FILM header has the following structure:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-3    'FILM' signature&lt;br /&gt;
  bytes 4-7    length of FILM header (including signature and length&lt;br /&gt;
               fields)&lt;br /&gt;
  bytes 8-11   FILM format version in ASCII (ex: '1.01' or '1.07')&lt;br /&gt;
  bytes 12-15  unknown (may be reserved and set to 0)&lt;br /&gt;
  bytes 16-n   remainder of FILM header&lt;br /&gt;
&lt;br /&gt;
Different Sega Saturn games include FILM files with a variety of FILM version numbers. Sometimes, the same game will include FILM files with a variety of format versions. A version number implies that there has been some change to the file format, but I have yet to observe any differences between different FILM file versions (except possibly for version '1.09'; see STAB chunk for more details).&lt;br /&gt;
&lt;br /&gt;
The remainder of the FILM header contains a number of chunks describing the media data in the file. Usually, the number of chunks is 2: A FDSC chunk and a STAB chunk.&lt;br /&gt;
&lt;br /&gt;
A FDSC chunk contains file description information. The chunk format is as follows:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-3    'FDSC' chunk signature&lt;br /&gt;
  bytes 4-7    length of FDSC chunk (including signature and length&lt;br /&gt;
               fields); an FDSC chunk should be 32 (0x20) bytes long&lt;br /&gt;
  bytes 8-11   FOURCC of video codec (usually 'cvid' for Cinepak or null&lt;br /&gt;
               for no video)&lt;br /&gt;
  bytes 12-15  height of video frames&lt;br /&gt;
  bytes 16-19  width of video frames&lt;br /&gt;
  byte 20      bits per pixel (always seems to be 24)&lt;br /&gt;
  byte 21      number of audio channels&lt;br /&gt;
  byte 22      audio sampling resolution in bits (either 8 or 16)&lt;br /&gt;
  byte 23      unknown&lt;br /&gt;
  bytes 24-25  audio sampling frequency in Hz&lt;br /&gt;
  bytes 26-31  unknown (may be reserved and set to 0)&lt;br /&gt;
&lt;br /&gt;
Note that the height field precedes the width field, which is unusual since width usually precedes height when expressing video resolution.&lt;br /&gt;
&lt;br /&gt;
The fields pertaining to audio (channels, bits, and sample rate) will all be 0 if there is no audio present in the file.&lt;br /&gt;
&lt;br /&gt;
A STAB chunk contains a table of media sample information. The chunk format is as follows:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-3    'STAB' chunk signature&lt;br /&gt;
  bytes 4-7    length of STAB chunk (including signature and length&lt;br /&gt;
               fields)&lt;br /&gt;
  bytes 8-11   framerate base frequency in Hz&lt;br /&gt;
  bytes 12-15  number of entries in the sample table&lt;br /&gt;
  bytes 16-n   sample table&lt;br /&gt;
&lt;br /&gt;
Note that the length field ought to take the first 16 chunk bytes into account. However, it has been observed from some games (notably [http://www.mobygames.com/game/saturn/burning-rangers Burning Rangers] using '1.09' version FILM files) that the length field sometimes does not account for these 16 bytes.&lt;br /&gt;
&lt;br /&gt;
The sample table consists of a series of 16-byte sample records. Each record is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-3    offset of sample chunk from beginning of sample data&lt;br /&gt;
  bytes 4-7    length of sample chunk&lt;br /&gt;
  bytes 8-11   sample info 1&lt;br /&gt;
  bytes 12-15  sample info 2&lt;br /&gt;
&lt;br /&gt;
The offset is the offset from the start of the sample data, not the absolute offset in the file. The length of the FILM header implicitly serves as a pointer to the beginning of the sample data in the file.&lt;br /&gt;
&lt;br /&gt;
If the sample info 1 field is set to all ones, the sample is an audio chunk. Otherwise, it is a video chunk. If it is a video chunk, the top bit of the 32-bit number specifies whether the chunk is an inter-coded or an intra-coded frame. 0=intra-coded (a.k.a. keyframe), 1=inter-coded. This is useful for seeking since it is a good idea to only jump to key frames when seeking through a file.&lt;br /&gt;
&lt;br /&gt;
The rest of the first sample info field and the second sample info field pertain to framerate calculation. Refer to the section on FILM framerate calculation for more information on proper FILM playback using these sample info fields.&lt;br /&gt;
&lt;br /&gt;
== FILM Framerate Calculation ==&lt;br /&gt;
&lt;br /&gt;
The STAB chunk contains a framerate base frequency in bytes 8-11. This frequency is expressed in ticks/second (Hz). Every video chunk has a frame tick count. For example, movie files in Panzer Dragoon I &amp;amp; II (FILM format versions 1.04 and 1.07, respectively) have a base frequency of 600 Hz. The frames have tick counts of 0, 20, 40, 60, 80, etc. Thus, there are 20 ticks between each successive frame.&lt;br /&gt;
&lt;br /&gt;
  (600 ticks/sec) / (20 ticks/frame) = 30 frames/second&lt;br /&gt;
&lt;br /&gt;
However, not all FILM files exhibit such a nice, even framerate. Myst, for example, contains FILM files (version 1.01) with a base frequency of 30 Hz. Some of the frames skip 2, then 3 ticks. Here's a sample tick count progression: 0, 2, 5, 7, 10, 12, 15, 17...&lt;br /&gt;
&lt;br /&gt;
Each STAB record has 2 32-bit sample info fields. For an audio chunk, sample info 1 is all ones and sample info 2 is always 1. For a video chunk, sample info 1 contains the keyframe bit (as described in the STAB section) and the absolute timestamp in clock ticks of the video frame with respect to the file's base frequency clock. The sample info 2 field contains the number of clock ticks until the next frame is rendered. This type of information would be particularly useful in an interrupt-driven, real-time multimedia system like, for instance, a video game console (such as the Sega Saturn).&lt;br /&gt;
&lt;br /&gt;
It is important to note that an application that knows how to play FILM files can not assume a constant framerate. The files will not play correctly with such a method. It is also important to note that&lt;br /&gt;
converting FILM files to file formats that only support constant framerates (such as AVI) is not a winning strategy. The converted file will not play correctly.&lt;br /&gt;
&lt;br /&gt;
== Video Codecs ==&lt;br /&gt;
&lt;br /&gt;
If the video codec is 'cvid' in the FDSC chunk, the codec used is the deviant Cinepak format. A couple Dark Seed II videos also have the 'raw ' codec FourCC representing simple RGB888 data.&lt;br /&gt;
&lt;br /&gt;
=== FILM Deviant Cinepak ('cvid') Video Data ===&lt;br /&gt;
&lt;br /&gt;
The Cinepak data inside of a FILM file can not be decoded with a general purpose Cinepak decoding algorithm. It is reasonable to think that this was no accident. If FILM files contained standard CVID data, the files could be played on any computer that had some kind of Cinepak decoder implementation.&lt;br /&gt;
&lt;br /&gt;
This document assumes familiarity with the [[Cinepak]] algorithm.&lt;br /&gt;
&lt;br /&gt;
A CVID chunk is supposed to start with a 10-byte chunk header:&lt;br /&gt;
&lt;br /&gt;
  byte 0     flags&lt;br /&gt;
  bytes 1-3  length of CVID data&lt;br /&gt;
  bytes 4-5  width of coded frame&lt;br /&gt;
  bytes 6-7  height of coded frame&lt;br /&gt;
  bytes 8-9  number of coded strips&lt;br /&gt;
&lt;br /&gt;
Following the chunk header ought to be the first byte of the first strip header. In the deviant CVID data stored in a FILM file, there appear to be an extra 2 bytes at the end of the chunk header, bringing the total header size to 12 bytes.&lt;br /&gt;
&lt;br /&gt;
The length of the chunk as reported by the deviant CVID data chunk is also incorrect. The length field is supposed to report the length of the entire chunk including the header. The deviant CVID data reports a length that is 8 bytes too short. That is, the length reported in the CVID chunk is 8 bytes shorter than the length reported in the corresponding record of the FILM file's STAB chunk. The STAB chunk length takes into account the proper length, including the extra 2 bytes at the end of the chunk header.&lt;br /&gt;
&lt;br /&gt;
Finally, the deviant CVID data appears to throw a potential decoder one more curveball with what appears to be data chunks that don't have, for lack of a better term, properly divisible chunk lengths. For example, a 0x2000 chunk commonly has a length of 0x604 bytes, which provides 2 bytes for the chunk ID, 2 bytes for the chunk length, and 0x600 bytes for 256 6-byte vectors. However, the deviant CVID data might have a 0x2000 chunk with a length of 0x600 bytes, which provides for the 4 chunk preamble bytes and 0x5FC bytes for the 6-byte vectors which is not evenly divisible by 6. This apparently confuses Cinepak decoders. The solution in this case is to unpack 255 6-byte vectors and then skip 2 bytes before attempting to decode the next chunk in the strip.&lt;br /&gt;
&lt;br /&gt;
== FILM Audio Data ==&lt;br /&gt;
&lt;br /&gt;
Audio data in a FILM file can be stored in a variety of formats which are mostly linear [[PCM]] variants.&lt;br /&gt;
&lt;br /&gt;
CPK files from Sega Saturn games almost always contain linear PCM audio. The one known exception is Burning Rangers. This game apparently uses [[CRI ADX ADPCM]] audio coding.&lt;br /&gt;
&lt;br /&gt;
Saturn CPK audio data is always stored as signed data. This is important to remember when playing 8-bit CPK audio data on a PC which generally expects 8-bit data to be unsigned.&lt;br /&gt;
&lt;br /&gt;
When a CPK file contains 16-bit audio data, the individual PCM samples are stored in big endian format. Again, this is important to remember when playing on a PC since a PC will generally expect little endian&lt;br /&gt;
16-bit data.&lt;br /&gt;
&lt;br /&gt;
If the CPK audio data is stereo (8- or 16-bit), the channel data is non-interleaved. Usually, stereo data is stored interleaved as a left channel sample followed by a right channel sample as follows:&lt;br /&gt;
&lt;br /&gt;
  L R L R L R L R ...&lt;br /&gt;
&lt;br /&gt;
In a stereo CPK file, for each audio data chunk, the first half of the chunk contains left channel samples and the second half contains right channel samples. The likely reason for this scheme is that console audio hardware such as that found on the Sega Saturn usually features a number of audio channels which can each play a mono PCM stream at a particular pan position (e.g., from 0-15 where 0 is extreme left, 7 and 8 are center, and 15 is extreme right). In order to play a stereo PCM stream, one physical audio channel must be assigned to extreme left while a second channel is assigned to extreme right. Then the appropriate channel samples are sent to the correct channel. Since these files are optimized for playback on the Sega Saturn it makes sense to arrange the audio samples like this.&lt;br /&gt;
&lt;br /&gt;
The Sega CD audio playback hardware ostensibly supports native sign/magnitude audio samples. All Sega CD games studied use this format to store audio data. Sign/magnitude number coding for 8-bit numbers&lt;br /&gt;
means that for each 8-bit byte:&lt;br /&gt;
&lt;br /&gt;
  bit 7      sign&lt;br /&gt;
  bits 6-0   magnitude (value)&lt;br /&gt;
&lt;br /&gt;
This is slightly different from twos complement encoding which is how computers typically store signed numbers. For example, in the sign/magnitude scheme, 0x81 represents -1 and 0xFF represents -127. 0x01&lt;br /&gt;
and 0x7F still represent 1 and 127, respectively, just as in unsigned, and signed twos complement coding.&lt;br /&gt;
&lt;br /&gt;
== Early Sega CD FILM Files ==&lt;br /&gt;
&lt;br /&gt;
Some Sega CD games as well as at least one 3DO game (Lemmings) use an early version of the FILM format. Unfortunately, there are a lot of variations and a general-purpose player will probably require a lot of&lt;br /&gt;
special-case logic in order to deal with every known circumstance.&lt;br /&gt;
&lt;br /&gt;
The first difference in these early files is the version number. These early files do not have ASCII-readable version fields. Some have NULL or other non-ASCII versions. This helps automatic detection.&lt;br /&gt;
&lt;br /&gt;
The second major difference that all of these early files appear to exhibit is an abbreviated FDSC chunk which omits any audio information. Thus, the FDSC chunk is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-3    'FDSC' chunk signature&lt;br /&gt;
  bytes 4-7    length of FDSC chunk (including signature and length&lt;br /&gt;
               fields); this FDSC chunk is 20 (0x14) bytes long&lt;br /&gt;
  bytes 8-11   FOURCC of video codec&lt;br /&gt;
  bytes 12-15  height of video frames&lt;br /&gt;
  bytes 16-19  width of video frames&lt;br /&gt;
&lt;br /&gt;
The lack of audio information leaves room for experimentation. The following is a list of known games which have early FILM files along with any special quirks observed.&lt;br /&gt;
&lt;br /&gt;
On the Lemmings 3DO game, there are 2 files with the .film extension (the 3DO game console uses a custom filesystem which allows for file extensions longer than 3 characters). The files have a NULL version field. The files use CVID data which is deviant in the same manner as typical FILM CVID data with an added quirk: There appear to be 6 extra bytes between the end of the CVID chunk header and the start of the first strip header, rather than the usual 2 extra bytes. The Lemmings FILM files also contain 8-bit signed, monaural PCM data with a sampling frequency of 22050 Hz.&lt;br /&gt;
&lt;br /&gt;
The Batman and Robin Sega CD title has a series of files with the extension .s. They are early FILM files with a version field of 0x00020000. Further, bytes 12-15 of the main FILM header are not set to 0 as is usually seen in FILM files. The files have a video fourcc of 'Seg4' which is probably Cinepak for Sega or a variant thereof. The files have STAB chunks which are a constant 0x20 (32) bytes long. This consists of the 'STAB' signature, a 4-byte chunk length, the base playback frequency, a sample count, and one 16-byte sample record. These files do not store the sample table in one place. Instead, they store one sample record followed immediately by the data corresponding to that sample record. Repeat until the end of the file.&lt;br /&gt;
&lt;br /&gt;
The Dracula Unleashed Sega CD title contains a series of files beginning with video?? with no file extension. They are early FILM files with a NULL version field, abbreviated FDSC chunk, and 'sega' as a video codec (Cinepak for Sega). The audio is 8-bit sign/magnitude audio with a sampling frequency of 16000 Hz.&lt;br /&gt;
&lt;br /&gt;
Jurassic Park for the Sega CD has a large number of files with the file extension .MVD. They are early FILM files with the same characteristics as the FILM files in Dracula Unleashed.&lt;br /&gt;
&lt;br /&gt;
The Tomcat Alley title for the Sega CD has a massive data file called tca.bin. Inside this data file are a lot of FILM files. These files have NULL version fields. The files have abbreviated FDSC chunks and the&lt;br /&gt;
'sega' video fourcc. They also have short STAB chunks with an Apple Quicktime 'mdia' atom appended at the end.&lt;br /&gt;
&lt;br /&gt;
== Strategy For Detecting FILM File Types ==&lt;br /&gt;
&lt;br /&gt;
There are quite a few variations and deviations in the FILM file format. This section presents logic for detecting and dealing with the variations.&lt;br /&gt;
&lt;br /&gt;
File extension detection is not especially useful since many games will masquerade their files with another extension. The best method to determine whether a file is a FILM file is to read the first 4 bytes and check for the signature 'FILM'.&lt;br /&gt;
&lt;br /&gt;
Upon validating the signature:&lt;br /&gt;
&lt;br /&gt;
* read the file version in the FILM header&lt;br /&gt;
* if the file version consists of ASCII characters&lt;br /&gt;
** if the file version is '1.09', watch out for bad length of STAB chunk as well as ADPCM audio&lt;br /&gt;
** load as standard FILM file, be sure to feed CVID data through Cinepak decoder that can handle it&lt;br /&gt;
* if the file version is 0x00020000&lt;br /&gt;
** read the video fourcc&lt;br /&gt;
** if the video fourcc is 'Seg4'&lt;br /&gt;
*** assume the file comes from Batman and Robin&lt;br /&gt;
* if the file version is NULL&lt;br /&gt;
** read the video fourcc&lt;br /&gt;
** if the video fourcc is 'cvid'&lt;br /&gt;
*** assume the file comes from the Lemmings 3DO game&lt;br /&gt;
*** be prepared to decode special variant of modified CVID data&lt;br /&gt;
*** assume 8-bit, mono, 22050 Hz PCM audio&lt;br /&gt;
** if the video fourcc is 'sega'&lt;br /&gt;
*** assume the file comes from one of several Sega CD games that agreed on this format&lt;br /&gt;
*** assume 8-bit, mono, 16000 Hz sign/magnitude audio&lt;br /&gt;
&lt;br /&gt;
== Games That Use FILM Files ==&lt;br /&gt;
&lt;br /&gt;
These games are known to use some variation of FILM files. Observed file version numbers are noted where known.&lt;br /&gt;
&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/astal Astal (Sega Saturn)]: '0.91', '1.06'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/burning-rangers Burning Rangers (Sega Saturn)]: '1.09'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/clockwork-knight Clockwork Knight (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/criticom Criticom (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/d D (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/sega-saturn/dark-seed-ii Dark Seed II (Sega Saturn)]: '1.09'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/defcon-5 Defcon 5 (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/iron-storm_ Iron Storm (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/3do/lemmings Lemmings (3DO)]: unversioned&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/myst Myst (Sega Saturn)]: '1.01'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/nights-into-dreams Nights Into Dreams (Sega Saturn)]: '0.91', '1.01', '1.06', '1.07', '1.08'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/panzer-dragoon Panzer Dragoon (Sega Saturn)]: '1.04'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/panzer-dragoon-ii-zwei Panzer Dragoon II: Zwei (Sega Saturn)]: '1.07'&lt;br /&gt;
* [http://www.mobygames.com/game/sega-saturn/roberta-williams-phantasmagoria Phantasm (Sega Saturn)]: '1.06', '1.08', '1.09'&lt;br /&gt;
* Sega Saturn Bootleg Sampler (Sega Saturn): '1.04'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/shockwave-assault Shockwave Assault (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/skeleton-warriors Skeleton Warriors (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/space-jam Space Jam (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/street-fighter-the-movie Street Fighter: The Movie (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/virtua-squad-virtual-cop Virtua Cop (Sega Saturn)]: '1.08'&lt;br /&gt;
* World Series Baseball II (Sega Saturn)&lt;br /&gt;
&lt;br /&gt;
[[Category:Container Formats]]&lt;br /&gt;
[[Category:Game Formats]]&lt;/div&gt;</summary>
		<author><name>Clone2727</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Phantom_Cine&amp;diff=12691</id>
		<title>Phantom Cine</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Phantom_Cine&amp;diff=12691"/>
		<updated>2010-06-14T14:29:39Z</updated>

		<summary type="html">&lt;p&gt;Clone2727: typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Extensions: cine&lt;br /&gt;
* Company: [[Vision Research Inc.]]&lt;br /&gt;
* Samples: [http://samples.mplayerhq.hu/V-codecs/Phantom_Cine http://samples.mplayerhq.hu/V-codecs/Phantom_Cine]&lt;br /&gt;
&lt;br /&gt;
The Phantom Cine format&lt;br /&gt;
&lt;br /&gt;
Note: below information is based on looking at a sample file, please verify against the specification linked at the end.&lt;br /&gt;
&lt;br /&gt;
This is a raw uncompressed format.&lt;br /&gt;
&lt;br /&gt;
It contains a lot of metadata, and index and raw uncompressed frames, presumably in Bayer format.&lt;br /&gt;
Know samples store each Bayer sample with 16 bits, where only the lowest 14 bits are relevant (the value 16 can be determined from the BitmapInfoHeader, the 14 bits are somewhere in the file as well, as can be seen from the xml-representation of the metadata (the RealBPP entry) - all data in the xml file exists in the .cine file as well). Making the lowest instead of the highest 14 bits the relevant ones is a rather unfortunate choice since it makes conversion to standard formats more difficult.&lt;br /&gt;
&lt;br /&gt;
Note: some of the fixed offsets below might not always be at that offset, though they are for the known samples and there are no length fields that would allow calculating them in a sensible way.&lt;br /&gt;
&lt;br /&gt;
All values are stored in little-endian format.&lt;br /&gt;
&lt;br /&gt;
The files start with the bytes &amp;quot;CI&amp;quot;, followed by two bytes possibly giving a size or index (all files so far have the value 2c 00).&lt;br /&gt;
&lt;br /&gt;
This &amp;quot;main header&amp;quot; contains this data:&lt;br /&gt;
  2 bytes &amp;quot;CI&amp;quot;&lt;br /&gt;
  2 bytes length&lt;br /&gt;
  2 bytes &amp;quot;compression type&amp;quot; (always 2) ??&lt;br /&gt;
  2 bytes version (always 1)&lt;br /&gt;
  4 bytes number of first frame (usually negative)&lt;br /&gt;
  4 bytes number of frames in files&lt;br /&gt;
  4 bytes number of first frame (repeated?)&lt;br /&gt;
  4 bytes number of frames in files (repeated?)&lt;br /&gt;
  4 bytes offset of BitmapInfoHeader&lt;br /&gt;
  4 bytes offset of ???&lt;br /&gt;
  4 bytes offset of file index&lt;br /&gt;
  8 bytes recording time stamp (?)&lt;br /&gt;
&lt;br /&gt;
At offset 0x2c there is a BitmapInfoHeader structure. The first 4 bytes give its length (0x28).&lt;br /&gt;
&lt;br /&gt;
The next sections starts with &amp;quot;ST&amp;quot; at offset 0xe0, again followed by two bytes giving a size or index (so far always 6c 16).&lt;br /&gt;
&lt;br /&gt;
Variable length part seems to start at offset 0x16c0. Note that this is the sum of the possible length files from CI, ST and BitmapInfoHeader (i.e. 0x2c + 0x28 + 0x166c = 0x16c0).&lt;br /&gt;
&lt;br /&gt;
It consists of 3 parts:&lt;br /&gt;
&lt;br /&gt;
1) timestamps&lt;br /&gt;
&lt;br /&gt;
2) exposure values&lt;br /&gt;
&lt;br /&gt;
3) index&lt;br /&gt;
&lt;br /&gt;
The timestamp and exposure values parts start with a 4-byte length field allowing to skip them.&lt;br /&gt;
&lt;br /&gt;
The index contains a 8-byte offset value for each frame. It does not have a length field, the number of entries is determined from the number of frames in the main header.&lt;br /&gt;
&lt;br /&gt;
At each offset indicated by the index, there is first a header. The first 4 bytes of the header give the length of the header. Only the value 8 has a known meaning, in which case the next 4 bytes give the length of the frame data.&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
* [http://www.visionresearch.com/devzonedownloads/cine640.pdf http://www.visionresearch.com/devzonedownloads/cine640.pdf] The CINE File Format, Vision Research Inc., 2007&lt;br /&gt;
&lt;br /&gt;
[[Category:Container Formats]]&lt;/div&gt;</summary>
		<author><name>Clone2727</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Talk:IDA_Pro&amp;diff=12367</id>
		<title>Talk:IDA Pro</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Talk:IDA_Pro&amp;diff=12367"/>
		<updated>2010-03-11T06:48:20Z</updated>

		<summary type="html">&lt;p&gt;Clone2727: reply&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The freeware &amp;amp; graph tool link are both broken- time to put them on the mirror page if anyone knows of another link or has them downloaded. [[User:Dashcloud|Dashcloud]] 19:08, 10 March 2010 (EST)&lt;br /&gt;
: Done. -[[User:Clone2727|Clone2727]] 01:48, 11 March 2010 (EST)&lt;/div&gt;</summary>
		<author><name>Clone2727</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=IDA_Pro&amp;diff=12366</id>
		<title>IDA Pro</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=IDA_Pro&amp;diff=12366"/>
		<updated>2010-03-11T06:47:56Z</updated>

		<summary type="html">&lt;p&gt;Clone2727: update links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Website: http://www.hex-rays.com/idapro/ &lt;br /&gt;
* Demo version: http://www.hex-rays.com/idapro/idadowndemo.htm &lt;br /&gt;
* Freeware version (currently v4.9): http://www.hex-rays.com/idapro/idadownfreeware.htm&lt;br /&gt;
* Wingraph32 GPL source code: http://www.hex-rays.com/idapro/freefiles/wingraph32_src.zip &lt;br /&gt;
&lt;br /&gt;
IDA Pro is a disassembler and debugger with a lot of features that is very useful for reverse engineering.&lt;br /&gt;
&lt;br /&gt;
It is proprietary software that runs on Windows and Linux; there is a zero-cost evaluation version.&lt;br /&gt;
&lt;br /&gt;
== Boosting the freeware version ==&lt;br /&gt;
The freeware version of IDA Pro is an invaluable tool. One important function is the ability to produce different flow graphs&lt;br /&gt;
from the disassembly. Sometimes these graphs can be quite messy and needs to be processed. The version of wingraph32.exe that&lt;br /&gt;
is included with the freeware version of IDA Pro can't save the generated graphs. Just replace it with a version from a demo&lt;br /&gt;
version of IDA Pro and the save option will be available. Saved graphs will have a .gdl suffix.&lt;br /&gt;
&lt;br /&gt;
== Converting gdl flow graphs to dot files ==&lt;br /&gt;
Since there aren't any really good tools to display and edit gdl files, you can convert them with the following script&lt;br /&gt;
&lt;br /&gt;
 #!/usr/bin/perl &lt;br /&gt;
  &lt;br /&gt;
 use strict; &lt;br /&gt;
  &lt;br /&gt;
 my $FILE1 = $ARGV[0]; &lt;br /&gt;
 open(OUTFILE, &amp;quot;&amp;gt;&amp;quot;.$FILE1.&amp;quot;.dot&amp;quot;) or die &amp;quot;File doesn't exist\n&amp;quot;; &lt;br /&gt;
 my $indata = `cat $FILE1`; &lt;br /&gt;
 my @split = split(/node:/, $indata); &lt;br /&gt;
 my $graphname = shift @split; &lt;br /&gt;
 $graphname =~ s/^.*title:[^&amp;quot;]*&amp;quot;([^&amp;quot;]*)&amp;quot;.*$/$1/s; &lt;br /&gt;
 print OUTFILE &amp;quot;digraph \&amp;quot;$graphname\&amp;quot; {\n&amp;quot;; &lt;br /&gt;
 print OUTFILE &amp;quot;\tgraph [\n&amp;quot;; &lt;br /&gt;
 print OUTFILE &amp;quot;\t]\n&amp;quot;; &lt;br /&gt;
 print OUTFILE &amp;quot;\tnode [\n&amp;quot;; &lt;br /&gt;
 print OUTFILE &amp;quot;\t\tshape = \&amp;quot;box\&amp;quot;\n&amp;quot;; &lt;br /&gt;
 print OUTFILE &amp;quot;\t]\n&amp;quot;; &lt;br /&gt;
 print OUTFILE &amp;quot;\tedge [\n&amp;quot;; &lt;br /&gt;
 print OUTFILE &amp;quot;\t]\n&amp;quot;; &lt;br /&gt;
  &lt;br /&gt;
 # convert nodes &lt;br /&gt;
 foreach my $n (@split) { &lt;br /&gt;
   $n =~ s/}.*$//s; &lt;br /&gt;
   my $label = my $title = $n; &lt;br /&gt;
   $title =~ s/^.*title:[^&amp;quot;]*&amp;quot;([^&amp;quot;]*)&amp;quot;.*$/$1/s; &lt;br /&gt;
   $label =~ s/^.*label:[^&amp;quot;]*&amp;quot;([^&amp;quot;]*)&amp;quot;.*$/$1/s; &lt;br /&gt;
   $label =~ s/\n/\\n/sg; &lt;br /&gt;
   print OUTFILE &amp;quot;\t\&amp;quot;$title\&amp;quot; [\n&amp;quot;; &lt;br /&gt;
   print OUTFILE &amp;quot;\t\tlabel = \&amp;quot;$label\&amp;quot;\n&amp;quot;; &lt;br /&gt;
   print OUTFILE &amp;quot;\t];\n&amp;quot;; &lt;br /&gt;
 } &lt;br /&gt;
  &lt;br /&gt;
 @split = split(/edge:/, $indata); &lt;br /&gt;
 shift @split; &lt;br /&gt;
  &lt;br /&gt;
 # convert edges &lt;br /&gt;
 foreach my $e (@split) { &lt;br /&gt;
   $e =~ s/}.*$//s; &lt;br /&gt;
   my $color = my $label = my $source = my $target = $e; &lt;br /&gt;
   $source =~ s/^.*sourcename:[^&amp;quot;]*&amp;quot;([^&amp;quot;]*)&amp;quot;.*$/$1/s; &lt;br /&gt;
   $target =~ s/^.*targetname:[^&amp;quot;]*&amp;quot;([^&amp;quot;]*)&amp;quot;.*$/$1/s; &lt;br /&gt;
   print OUTFILE &amp;quot;\t\&amp;quot;$source\&amp;quot; -&amp;gt; \&amp;quot;$target\&amp;quot; [\n&amp;quot;; &lt;br /&gt;
   if ($label =~ s/^.*label:[^&amp;quot;]*&amp;quot;([^&amp;quot;]*)&amp;quot;.*$/$1/s) { &lt;br /&gt;
     $label =~ s/\n/\\n/sg; &lt;br /&gt;
     print OUTFILE &amp;quot;\t\tlabel = \&amp;quot;$label\&amp;quot;\n&amp;quot;; &lt;br /&gt;
   } &lt;br /&gt;
   if ($color =~ s/^.*color:&amp;lt;nowiki&amp;gt;[[:space:]]&amp;lt;/nowiki&amp;gt;*([^ ]*)[[:space:]}].*$/$1/s) { &lt;br /&gt;
     print OUTFILE &amp;quot;\t\tcolor = $color\n&amp;quot;; &lt;br /&gt;
   } &lt;br /&gt;
   print OUTFILE &amp;quot;\t];\n&amp;quot;; &lt;br /&gt;
 } &lt;br /&gt;
 print OUTFILE &amp;quot;}\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Recovering the function prototypes from the disassembly ==&lt;br /&gt;
Well it's not really possible but a good hint is possible without much work. First load the binary you want to analyse. IDA Pro&lt;br /&gt;
will process the file for some time. If you start browsing around you will see that IDA Pro can make a good guess on how many&lt;br /&gt;
arguments a function have. That is one thing that can be extracted. The other is if a function returns something or not. The x86 C ABI&lt;br /&gt;
declares that the return type if any has to be left in the eax register. So if the eax register is used after a call the function&lt;br /&gt;
that was called returned something. The following not so nice perl script can process the asm file that can be produced from IDA Pro&lt;br /&gt;
with Produce-&amp;gt;ASM-File (Alt+F10).&lt;br /&gt;
&lt;br /&gt;
 #!/usr/bin/perl&lt;br /&gt;
 #Argument parser&lt;br /&gt;
 &lt;br /&gt;
 if (@ARGV){&lt;br /&gt;
   print &amp;quot;@ARGV\n&amp;quot;;&lt;br /&gt;
   if ($ARGV[0] eq &amp;quot;-f&amp;quot;){&lt;br /&gt;
     $FILE1 = $ARGV[1];&lt;br /&gt;
     $FILE2 = $ARGV[2];&lt;br /&gt;
     $filter = 1;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 else{&lt;br /&gt;
   print &amp;quot;Usage:\n&amp;quot;;&lt;br /&gt;
   print &amp;quot;./argumentcounter.pl [command] file.asm output.txt\n&amp;quot;;&lt;br /&gt;
   print &amp;quot;-f dummy command\n&amp;quot;;&lt;br /&gt;
   exit;&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 #File IO&lt;br /&gt;
 open(OUTFILE, &amp;quot;&amp;gt;$FILE2&amp;quot;) or die &amp;quot;File problem\n&amp;quot;;&lt;br /&gt;
 @indata = `cat $FILE1`;&lt;br /&gt;
 &lt;br /&gt;
 $fn = 0;        #amount of founctions&lt;br /&gt;
 $functions[$fn] = &amp;quot;&amp;quot;;&lt;br /&gt;
 $arguments[$fn] = 0;&lt;br /&gt;
 $f_start = 0;&lt;br /&gt;
 $links= 0;&lt;br /&gt;
 foreach $rad (@indata)&lt;br /&gt;
 {&lt;br /&gt;
    $rowcounter++;&lt;br /&gt;
 &lt;br /&gt;
    if ($rad =~ m/ proc near/) {&lt;br /&gt;
        $functions[$fn] = $`;&lt;br /&gt;
        $fn++;&lt;br /&gt;
        $f_start = 1;&lt;br /&gt;
        $arguments[$fn] = 0;&lt;br /&gt;
        #print STDOUT &amp;quot;$`\n&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
    if ($f_start == 1) {&lt;br /&gt;
        $radsubstring = (substr $rad,0,3);&lt;br /&gt;
        if ($radsubstring eq &amp;quot;arg&amp;quot;) {&lt;br /&gt;
            $arguments[$fn]++;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    if ($rad =~ m/ endp/) {&lt;br /&gt;
        $f_start = 0;&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    #return type detector&lt;br /&gt;
    if ($rad =~ m/call\t/) {&lt;br /&gt;
        $retfunction = $';&lt;br /&gt;
        $retfunction =~ m/\n/;&lt;br /&gt;
        $retfunction = $`;&lt;br /&gt;
        chop($retfunction);&lt;br /&gt;
        $rowcounter = 0;&lt;br /&gt;
        $callcheck = 1;&lt;br /&gt;
    }&lt;br /&gt;
    if (($callcheck) &amp;amp;&amp;amp; ($rowcounter&amp;gt;0)) {&lt;br /&gt;
 &lt;br /&gt;
        @tmpsplit=split /\t/,$rad;&lt;br /&gt;
        chomp($tmpsplit[0]);&lt;br /&gt;
        chomp($tmpsplit[1]);&lt;br /&gt;
        chomp($tmpsplit[2]);&lt;br /&gt;
        chomp($tmpsplit[3]);&lt;br /&gt;
        $instruction = $tmpsplit[2];&lt;br /&gt;
        $arguments = $tmpsplit[3];&lt;br /&gt;
        chop($arguments);&lt;br /&gt;
        if ($arguments =~ m/, /) {&lt;br /&gt;
            @argum=split /, /,$arguments;&lt;br /&gt;
        }&lt;br /&gt;
        #chomp($argum[0]);&lt;br /&gt;
        #chomp($instruction);&lt;br /&gt;
        if ($argum[0] eq &amp;quot;eax&amp;quot;) {&lt;br /&gt;
            $callcheck = 0;&lt;br /&gt;
        }&lt;br /&gt;
        if ($argum[1] eq &amp;quot;eax&amp;quot;) {&lt;br /&gt;
            $callcheck = 0;&lt;br /&gt;
        }&lt;br /&gt;
 &lt;br /&gt;
        #check source operand if it is eax&lt;br /&gt;
        if (($argum[1] eq &amp;quot;eax&amp;quot;) &amp;amp;&amp;amp; ($instruction ne &amp;quot;xor&amp;quot;)) {&lt;br /&gt;
            $callcheck = 0;&lt;br /&gt;
            $nonvoid{$retfunction} = $nonvoid{$retfunction} +1;&lt;br /&gt;
            #print STDOUT &amp;quot;$retfunction returns nonvoid\n&amp;quot;;&lt;br /&gt;
        }&lt;br /&gt;
        if (($argum[0] eq &amp;quot;eax&amp;quot;) &amp;amp;&amp;amp; ($argum[1] ne &amp;quot;eax&amp;quot;)){&lt;br /&gt;
            $callcheck = 0;&lt;br /&gt;
            $void{$retfunction} = $void{$retfunction} +1;&lt;br /&gt;
            #print STDOUT &amp;quot;$retfunction returns void\n&amp;quot;;&lt;br /&gt;
        }&lt;br /&gt;
        if ($instruction =~ /retn/) {&lt;br /&gt;
            #stop searching when the current function returns&lt;br /&gt;
            $callcheck = 0;&lt;br /&gt;
            $void{$retfunction} = $void{$retfunction} +1;&lt;br /&gt;
            #print STDOUT &amp;quot;$retfunction returns void\n&amp;quot;;&lt;br /&gt;
        }&lt;br /&gt;
        if ($rowcounter &amp;gt; 10) {&lt;br /&gt;
            $callcheck = 0;&lt;br /&gt;
        }&lt;br /&gt;
        $argum[0] = &amp;quot;&amp;quot;;&lt;br /&gt;
        $argum[1] = &amp;quot;&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 for ($i=0 ; $i &amp;lt; $fn ; $i++){&lt;br /&gt;
    #returntype handling&lt;br /&gt;
    $returntype = &amp;quot;unknown&amp;quot;;&lt;br /&gt;
    if ($void{$functions[$i]} &amp;gt; 0) {&lt;br /&gt;
        $returntype = &amp;quot;void&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
    if ($nonvoid{$functions[$i]} &amp;gt; 0) {&lt;br /&gt;
        $returntype = &amp;quot;int&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
    if (($void{$functions[$i]} &amp;gt; 0) &amp;amp;&amp;amp; ($nonvoid{$functions[$i]} &amp;gt; 0)){&lt;br /&gt;
        $returntype = &amp;quot;void $void{$functions[$i]} - $nonvoid{$functions[$i]} int&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
    print STDOUT &amp;quot;$returntype $functions[$i] $arguments[$i]\n&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:RE Tools]]&lt;/div&gt;</summary>
		<author><name>Clone2727</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Sega_FILM&amp;diff=12306</id>
		<title>Sega FILM</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Sega_FILM&amp;diff=12306"/>
		<updated>2010-02-22T02:51:27Z</updated>

		<summary type="html">&lt;p&gt;Clone2727: /* Games That Use FILM Files */ Dark Seed II Saturn uses 1.09&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''This page is based on the document 'Description of the Sega FILM/CPK File Format' by Mike Melanson found at [http://multimedia.cx/film-format.txt http://multimedia.cx/film-format.txt].''&lt;br /&gt;
&lt;br /&gt;
* Extensions: cpk, cak, film&lt;br /&gt;
* Company: [[Sega (Company)|Sega]]&lt;br /&gt;
* Samples:&lt;br /&gt;
** [http://samples.mplayerhq.hu/game-formats/film-cpk/ http://samples.mplayerhq.hu/game-formats/film-cpk/]&lt;br /&gt;
** Batman and Robin Sega CD with 'Seg4' data: [http://samples.mplayerhq.hu/game-formats/segacd/batmanandrobin-film-seg4/ http://samples.mplayerhq.hu/game-formats/segacd/batmanandrobin-film-seg4/]&lt;br /&gt;
** Dracula Unleashed/Sega CD: [http://samples.mplayerhq.hu/game-formats/segacd/dracula-unleashed-film/ http://samples.mplayerhq.hu/game-formats/segacd/dracula-unleashed-film/]&lt;br /&gt;
** Jurassic Park/Sega CD: [http://samples.mplayerhq.hu/game-formats/segacd/jurassicpark-film/ http://samples.mplayerhq.hu/game-formats/segacd/jurassicpark-film/]&lt;br /&gt;
&lt;br /&gt;
FILM is a multimedia container file format developed by Sega for use on its early CD-ROM home video game consoles. Based on analysis of a number of Sega CD and Saturn games, it appears that the format was first developed sometime during the era of the Sega CD, Sega's first CD-based video game console. There are many early variations of the FILM format observed on a number of Sega CD titles. Further, early FILM files have been observed on at least one 3DO game ([http://www.mobygames.com/game/3do/lemmings Lemmings]).&lt;br /&gt;
&lt;br /&gt;
The Sega Saturn video game console, released in 1994, was also CD-ROM-based and apparently offered developers a standardized SDK for full motion video (FMV) playback using a modified variant of the well-known [[Cinepak]] video codec.&lt;br /&gt;
&lt;br /&gt;
It is possible to store both audio and video in a FILM file. Alternatively, the format is able to handle either video without audio, or vice versa.&lt;br /&gt;
 &lt;br /&gt;
== Sega Saturn CPK File Format ==&lt;br /&gt;
&lt;br /&gt;
All multi-byte numbers are stored in big endian format.&lt;br /&gt;
&lt;br /&gt;
Many Sega Saturn CD-ROM games use this file format to store frames of a Cinepak-compressed video interleaved with uncompressed [[PCM]] audio. When this is the case, the files will typically have the extension .CPK (which is why FILM files are usually known as CPK files). Sometimes, audio-only FILM files will have a .SND extension.&lt;br /&gt;
&lt;br /&gt;
The general format is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 +-----------------------+&lt;br /&gt;
 | +-------------------+ |&lt;br /&gt;
 | | FILM header       | |&lt;br /&gt;
 | |                   | |&lt;br /&gt;
 | | +---------------+ | |&lt;br /&gt;
 | | | FDSC chunk    | | |&lt;br /&gt;
 | | +---------------+ | |&lt;br /&gt;
 | |                   | |&lt;br /&gt;
 | | +---------------+ | |&lt;br /&gt;
 | | | STAB chunk    | | |&lt;br /&gt;
 | | +---------------+ | |&lt;br /&gt;
 | |                   | |&lt;br /&gt;
 | +-------------------+ |&lt;br /&gt;
 |                       |&lt;br /&gt;
 | Audio or Video Data   |&lt;br /&gt;
 |  ..                   |&lt;br /&gt;
 |  ..                   |&lt;br /&gt;
 +-----------------------+&lt;br /&gt;
&lt;br /&gt;
A FILM file will usually consist of a header followed by interleaved audio and video chunks. The FILM header has the following structure:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-3    'FILM' signature&lt;br /&gt;
  bytes 4-7    length of FILM header (including signature and length&lt;br /&gt;
               fields)&lt;br /&gt;
  bytes 8-11   FILM format version in ASCII (ex: '1.01' or '1.07')&lt;br /&gt;
  bytes 12-15  unknown (may be reserved and set to 0)&lt;br /&gt;
  bytes 16-n   remainder of FILM header&lt;br /&gt;
&lt;br /&gt;
Different Sega Saturn games include FILM files with a variety of FILM version numbers. Sometimes, the same game will include FILM files with a variety of format versions. A version number implies that there has been some change to the file format, but I have yet to observe any differences between different FILM file versions (except possibly for version '1.09'; see STAB chunk for more details).&lt;br /&gt;
&lt;br /&gt;
The remainder of the FILM header contains a number of chunks describing the media data in the file. Usually, the number of chunks is 2: A FDSC chunk and a STAB chunk.&lt;br /&gt;
&lt;br /&gt;
A FDSC chunk contains file description information. The chunk format is as follows:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-3    'FDSC' chunk signature&lt;br /&gt;
  bytes 4-7    length of FDSC chunk (including signature and length&lt;br /&gt;
               fields); an FDSC chunk should be 32 (0x20) bytes long&lt;br /&gt;
  bytes 8-11   FOURCC of video codec (usually 'cvid' for Cinepak or null&lt;br /&gt;
               for no video)&lt;br /&gt;
  bytes 12-15  height of video frames&lt;br /&gt;
  bytes 16-19  width of video frames&lt;br /&gt;
  byte 20      unknown, but always seems to be 0x18 (24)&lt;br /&gt;
  byte 21      number of audio channels&lt;br /&gt;
  byte 22      audio sampling resolution in bits (either 8 or 16)&lt;br /&gt;
  byte 23      unknown&lt;br /&gt;
  bytes 24-25  audio sampling frequency in Hz&lt;br /&gt;
  bytes 26-31  unknown (may be reserved and set to 0)&lt;br /&gt;
&lt;br /&gt;
Note that the height field precedes the width field, which is unusual since width usually precedes height when expressing video resolution.&lt;br /&gt;
&lt;br /&gt;
The fields pertaining to audio (channels, bits, and sample rate) will all be 0 if there is no audio present in the file.&lt;br /&gt;
&lt;br /&gt;
A STAB chunk contains a table of media sample information. The chunk format is as follows:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-3    'STAB' chunk signature&lt;br /&gt;
  bytes 4-7    length of STAB chunk (including signature and length&lt;br /&gt;
               fields)&lt;br /&gt;
  bytes 8-11   framerate base frequency in Hz&lt;br /&gt;
  bytes 12-15  number of entries in the sample table&lt;br /&gt;
  bytes 16-n   sample table&lt;br /&gt;
&lt;br /&gt;
Note that the length field ought to take the first 16 chunk bytes into account. However, it has been observed from some games (notably [http://www.mobygames.com/game/saturn/burning-rangers Burning Rangers] using '1.09' version FILM files) that the length field sometimes does not account for these 16 bytes.&lt;br /&gt;
&lt;br /&gt;
The sample table consists of a series of 16-byte sample records. Each record is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-3    offset of sample chunk from beginning of sample data&lt;br /&gt;
  bytes 4-7    length of sample chunk&lt;br /&gt;
  bytes 8-11   sample info 1&lt;br /&gt;
  bytes 12-15  sample info 2&lt;br /&gt;
&lt;br /&gt;
The offset is the offset from the start of the sample data, not the absolute offset in the file. The length of the FILM header implicitly serves as a pointer to the beginning of the sample data in the file.&lt;br /&gt;
&lt;br /&gt;
If the sample info 1 field is set to all ones, the sample is an audio chunk. Otherwise, it is a video chunk. If it is a video chunk, the top bit of the 32-bit number specifies whether the chunk is an inter-coded or an intra-coded frame. 0=intra-coded (a.k.a. keyframe), 1=inter-coded. This is useful for seeking since it is a good idea to only jump to key frames when seeking through a file.&lt;br /&gt;
&lt;br /&gt;
The rest of the first sample info field and the second sample info field pertain to framerate calculation. Refer to the section on FILM framerate calculation for more information on proper FILM playback using these sample info fields.&lt;br /&gt;
&lt;br /&gt;
== FILM Framerate Calculation ==&lt;br /&gt;
&lt;br /&gt;
The STAB chunk contains a framerate base frequency in bytes 8-11. This frequency is expressed in ticks/second (Hz). Every video chunk has a frame tick count. For example, movie files in Panzer Dragoon I &amp;amp; II (FILM format versions 1.04 and 1.07, respectively) have a base frequency of 600 Hz. The frames have tick counts of 0, 20, 40, 60, 80, etc. Thus, there are 20 ticks between each successive frame.&lt;br /&gt;
&lt;br /&gt;
  (600 ticks/sec) / (20 ticks/frame) = 30 frames/second&lt;br /&gt;
&lt;br /&gt;
However, not all FILM files exhibit such a nice, even framerate. Myst, for example, contains FILM files (version 1.01) with a base frequency of 30 Hz. Some of the frames skip 2, then 3 ticks. Here's a sample tick count progression: 0, 2, 5, 7, 10, 12, 15, 17...&lt;br /&gt;
&lt;br /&gt;
Each STAB record has 2 32-bit sample info fields. For an audio chunk, sample info 1 is all ones and sample info 2 is always 1. For a video chunk, sample info 1 contains the keyframe bit (as described in the STAB section) and the absolute timestamp in clock ticks of the video frame with respect to the file's base frequency clock. The sample info 2 field contains the number of clock ticks until the next frame is rendered. This type of information would be particularly useful in an interrupt-driven, real-time multimedia system like, for instance, a video game console (such as the Sega Saturn).&lt;br /&gt;
&lt;br /&gt;
It is important to note that an application that knows how to play FILM files can not assume a constant framerate. The files will not play correctly with such a method. It is also important to note that&lt;br /&gt;
converting FILM files to file formats that only support constant framerates (such as AVI) is not a winning strategy. The converted file will not play correctly.&lt;br /&gt;
&lt;br /&gt;
== FILM Deviant Cinepak (CVID) Video Data ==&lt;br /&gt;
&lt;br /&gt;
The Cinepak data inside of a FILM file can not be decoded with a general purpose Cinepak decoding algorithm. It is reasonable to think that this was no accident. If FILM files contained standard CVID data, the files could be played on any computer that had some kind of Cinepak decoder implementation.&lt;br /&gt;
&lt;br /&gt;
This document assumes familiarity with the [[Cinepak]] algorithm.&lt;br /&gt;
&lt;br /&gt;
A CVID chunk is supposed to start with a 10-byte chunk header:&lt;br /&gt;
&lt;br /&gt;
  byte 0     flags&lt;br /&gt;
  bytes 1-3  length of CVID data&lt;br /&gt;
  bytes 4-5  width of coded frame&lt;br /&gt;
  bytes 6-7  height of coded frame&lt;br /&gt;
  bytes 8-9  number of coded strips&lt;br /&gt;
&lt;br /&gt;
Following the chunk header ought to be the first byte of the first strip header. In the deviant CVID data stored in a FILM file, there appear to be an extra 2 bytes at the end of the chunk header, bringing the total header size to 12 bytes.&lt;br /&gt;
&lt;br /&gt;
The length of the chunk as reported by the deviant CVID data chunk is also incorrect. The length field is supposed to report the length of the entire chunk including the header. The deviant CVID data reports a length that is 8 bytes too short. That is, the length reported in the CVID chunk is 8 bytes shorter than the length reported in the corresponding record of the FILM file's STAB chunk. The STAB chunk length takes into account the proper length, including the extra 2 bytes at the end of the chunk header.&lt;br /&gt;
&lt;br /&gt;
Finally, the deviant CVID data appears to throw a potential decoder one more curveball with what appears to be data chunks that don't have, for lack of a better term, properly divisible chunk lengths. For example, a 0x2000 chunk commonly has a length of 0x604 bytes, which provides 2 bytes for the chunk ID, 2 bytes for the chunk length, and 0x600 bytes for 256 6-byte vectors. However, the deviant CVID data might have a 0x2000 chunk with a length of 0x600 bytes, which provides for the 4 chunk preamble bytes and 0x5FC bytes for the 6-byte vectors which is not evenly divisible by 6. This apparently confuses Cinepak decoders. The solution in this case is to unpack 255 6-byte vectors and then skip 2 bytes before attempting to decode the next chunk in the strip.&lt;br /&gt;
&lt;br /&gt;
== FILM Audio Data ==&lt;br /&gt;
&lt;br /&gt;
Audio data in a FILM file can be stored in a variety of formats which are mostly linear [[PCM]] variants.&lt;br /&gt;
&lt;br /&gt;
CPK files from Sega Saturn games almost always contain linear PCM audio. The one known exception is Burning Rangers. This game apparently uses [[CRI ADX ADPCM]] audio coding.&lt;br /&gt;
&lt;br /&gt;
Saturn CPK audio data is always stored as signed data. This is important to remember when playing 8-bit CPK audio data on a PC which generally expects 8-bit data to be unsigned.&lt;br /&gt;
&lt;br /&gt;
When a CPK file contains 16-bit audio data, the individual PCM samples are stored in big endian format. Again, this is important to remember when playing on a PC since a PC will generally expect little endian&lt;br /&gt;
16-bit data.&lt;br /&gt;
&lt;br /&gt;
If the CPK audio data is stereo (8- or 16-bit), the channel data is non-interleaved. Usually, stereo data is stored interleaved as a left channel sample followed by a right channel sample as follows:&lt;br /&gt;
&lt;br /&gt;
  L R L R L R L R ...&lt;br /&gt;
&lt;br /&gt;
In a stereo CPK file, for each audio data chunk, the first half of the chunk contains left channel samples and the second half contains right channel samples. The likely reason for this scheme is that console audio hardware such as that found on the Sega Saturn usually features a number of audio channels which can each play a mono PCM stream at a particular pan position (e.g., from 0-15 where 0 is extreme left, 7 and 8 are center, and 15 is extreme right). In order to play a stereo PCM stream, one physical audio channel must be assigned to extreme left while a second channel is assigned to extreme right. Then the appropriate channel samples are sent to the correct channel. Since these files are optimized for playback on the Sega Saturn it makes sense to arrange the audio samples like this.&lt;br /&gt;
&lt;br /&gt;
The Sega CD audio playback hardware ostensibly supports native sign/magnitude audio samples. All Sega CD games studied use this format to store audio data. Sign/magnitude number coding for 8-bit numbers&lt;br /&gt;
means that for each 8-bit byte:&lt;br /&gt;
&lt;br /&gt;
  bit 7      sign&lt;br /&gt;
  bits 6-0   magnitude (value)&lt;br /&gt;
&lt;br /&gt;
This is slightly different from twos complement encoding which is how computers typically store signed numbers. For example, in the sign/magnitude scheme, 0x81 represents -1 and 0xFF represents -127. 0x01&lt;br /&gt;
and 0x7F still represent 1 and 127, respectively, just as in unsigned, and signed twos complement coding.&lt;br /&gt;
&lt;br /&gt;
== Early Sega CD FILM Files ==&lt;br /&gt;
&lt;br /&gt;
Some Sega CD games as well as at least one 3DO game (Lemmings) use an early version of the FILM format. Unfortunately, there are a lot of variations and a general-purpose player will probably require a lot of&lt;br /&gt;
special-case logic in order to deal with every known circumstance.&lt;br /&gt;
&lt;br /&gt;
The first difference in these early files is the version number. These early files do not have ASCII-readable version fields. Some have NULL or other non-ASCII versions. This helps automatic detection.&lt;br /&gt;
&lt;br /&gt;
The second major difference that all of these early files appear to exhibit is an abbreviated FDSC chunk which omits any audio information. Thus, the FDSC chunk is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-3    'FDSC' chunk signature&lt;br /&gt;
  bytes 4-7    length of FDSC chunk (including signature and length&lt;br /&gt;
               fields); this FDSC chunk is 20 (0x14) bytes long&lt;br /&gt;
  bytes 8-11   FOURCC of video codec&lt;br /&gt;
  bytes 12-15  height of video frames&lt;br /&gt;
  bytes 16-19  width of video frames&lt;br /&gt;
&lt;br /&gt;
The lack of audio information leaves room for experimentation. The following is a list of known games which have early FILM files along with any special quirks observed.&lt;br /&gt;
&lt;br /&gt;
On the Lemmings 3DO game, there are 2 files with the .film extension (the 3DO game console uses a custom filesystem which allows for file extensions longer than 3 characters). The files have a NULL version field. The files use CVID data which is deviant in the same manner as typical FILM CVID data with an added quirk: There appear to be 6 extra bytes between the end of the CVID chunk header and the start of the first strip header, rather than the usual 2 extra bytes. The Lemmings FILM files also contain 8-bit signed, monaural PCM data with a sampling frequency of 22050 Hz.&lt;br /&gt;
&lt;br /&gt;
The Batman and Robin Sega CD title has a series of files with the extension .s. They are early FILM files with a version field of 0x00020000. Further, bytes 12-15 of the main FILM header are not set to 0 as is usually seen in FILM files. The files have a video fourcc of 'Seg4' which is probably Cinepak for Sega or a variant thereof. The files have STAB chunks which are a constant 0x20 (32) bytes long. This consists of the 'STAB' signature, a 4-byte chunk length, the base playback frequency, a sample count, and one 16-byte sample record. These files do not store the sample table in one place. Instead, they store one sample record followed immediately by the data corresponding to that sample record. Repeat until the end of the file.&lt;br /&gt;
&lt;br /&gt;
The Dracula Unleashed Sega CD title contains a series of files beginning with video?? with no file extension. They are early FILM files with a NULL version field, abbreviated FDSC chunk, and 'sega' as a video codec (Cinepak for Sega). The audio is 8-bit sign/magnitude audio with a sampling frequency of 16000 Hz.&lt;br /&gt;
&lt;br /&gt;
Jurassic Park for the Sega CD has a large number of files with the file extension .MVD. They are early FILM files with the same characteristics as the FILM files in Dracula Unleashed.&lt;br /&gt;
&lt;br /&gt;
The Tomcat Alley title for the Sega CD has a massive data file called tca.bin. Inside this data file are a lot of FILM files. These files have NULL version fields. The files have abbreviated FDSC chunks and the&lt;br /&gt;
'sega' video fourcc. They also have short STAB chunks with an Apple Quicktime 'mdia' atom appended at the end.&lt;br /&gt;
&lt;br /&gt;
== Strategy For Detecting FILM File Types ==&lt;br /&gt;
&lt;br /&gt;
There are quite a few variations and deviations in the FILM file format. This section presents logic for detecting and dealing with the variations.&lt;br /&gt;
&lt;br /&gt;
File extension detection is not especially useful since many games will masquerade their files with another extension. The best method to determine whether a file is a FILM file is to read the first 4 bytes and check for the signature 'FILM'.&lt;br /&gt;
&lt;br /&gt;
Upon validating the signature:&lt;br /&gt;
&lt;br /&gt;
* read the file version in the FILM header&lt;br /&gt;
* if the file version consists of ASCII characters&lt;br /&gt;
** if the file version is '1.09', watch out for bad length of STAB chunk as well as ADPCM audio&lt;br /&gt;
** load as standard FILM file, be sure to feed CVID data through Cinepak decoder that can handle it&lt;br /&gt;
* if the file version is 0x00020000&lt;br /&gt;
** read the video fourcc&lt;br /&gt;
** if the video fourcc is 'Seg4'&lt;br /&gt;
*** assume the file comes from Batman and Robin&lt;br /&gt;
* if the file version is NULL&lt;br /&gt;
** read the video fourcc&lt;br /&gt;
** if the video fourcc is 'cvid'&lt;br /&gt;
*** assume the file comes from the Lemmings 3DO game&lt;br /&gt;
*** be prepared to decode special variant of modified CVID data&lt;br /&gt;
*** assume 8-bit, mono, 22050 Hz PCM audio&lt;br /&gt;
** if the video fourcc is 'sega'&lt;br /&gt;
*** assume the file comes from one of several Sega CD games that agreed on this format&lt;br /&gt;
*** assume 8-bit, mono, 16000 Hz sign/magnitude audio&lt;br /&gt;
&lt;br /&gt;
== Games That Use FILM Files ==&lt;br /&gt;
&lt;br /&gt;
These games are known to use some variation of FILM files. Observed file version numbers are noted where known.&lt;br /&gt;
&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/astal Astal (Sega Saturn)]: '0.91', '1.06'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/burning-rangers Burning Rangers (Sega Saturn)]: '1.09'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/clockwork-knight Clockwork Knight (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/criticom Criticom (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/d D (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/sega-saturn/dark-seed-ii Dark Seed II (Sega Saturn)]: '1.09'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/defcon-5 Defcon 5 (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/iron-storm_ Iron Storm (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/3do/lemmings Lemmings (3DO)]: unversioned&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/myst Myst (Sega Saturn)]: '1.01'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/nights-into-dreams Nights Into Dreams (Sega Saturn)]: '0.91', '1.01', '1.06', '1.07', '1.08'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/panzer-dragoon Panzer Dragoon (Sega Saturn)]: '1.04'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/panzer-dragoon-ii-zwei Panzer Dragoon II: Zwei (Sega Saturn)]: '1.07'&lt;br /&gt;
* [http://www.mobygames.com/game/sega-saturn/roberta-williams-phantasmagoria Phantasm (Sega Saturn)]: '1.06', '1.08', '1.09'&lt;br /&gt;
* Sega Saturn Bootleg Sampler (Sega Saturn): '1.04'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/shockwave-assault Shockwave Assault (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/skeleton-warriors Skeleton Warriors (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/space-jam Space Jam (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/street-fighter-the-movie Street Fighter: The Movie (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/virtua-squad-virtual-cop Virtua Cop (Sega Saturn)]: '1.08'&lt;br /&gt;
* World Series Baseball II (Sega Saturn)&lt;br /&gt;
&lt;br /&gt;
[[Category:Container Formats]]&lt;br /&gt;
[[Category:Game Formats]]&lt;/div&gt;</summary>
		<author><name>Clone2727</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Microsoft_Audio/Video_Interleaved&amp;diff=12239</id>
		<title>Microsoft Audio/Video Interleaved</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Microsoft_Audio/Video_Interleaved&amp;diff=12239"/>
		<updated>2010-02-05T05:06:07Z</updated>

		<summary type="html">&lt;p&gt;Clone2727: typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extensions: avi&lt;br /&gt;
* Company: [[Microsoft]]&lt;br /&gt;
* Technical Description From Microsoft: http://msdn.microsoft.com/en-us/library/ms779636(VS.85).aspx&lt;br /&gt;
* Another AVI format documentation: http://www.alexander-noe.com/video/documentation/avi.pdf&lt;br /&gt;
* John McGowan's AVI Overview: http://www.jmcgowan.com/avi.html&lt;br /&gt;
* MIME Types:&lt;br /&gt;
** video/msvideo&lt;br /&gt;
** video/x-msvideo&lt;br /&gt;
&lt;br /&gt;
'''Microsoft Audio/Video Interleaved''' ('''AVI''') is a multimedia format based on the [[RIFF]] container format. For a long time, AVI was the de facto standard for multimedia files on Windows (recently, [[ASF]] has supplanted AVI on the Windows platform). While there is some contention&lt;br /&gt;
regarding the originator of the format, the fact remains that there were, and still are, a wide variety of computer applications that create AVI files. This leads to a lot of fragmentation and application-specific nuances in a standard that was never particularly well-defined in the first place.&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
&lt;br /&gt;
An AVI has this [[RIFF]] structure:&lt;br /&gt;
&lt;br /&gt;
 RIFF &amp;quot;AVI &amp;quot; (space at end)&lt;br /&gt;
     LIST &amp;quot;hdrl&amp;quot;&lt;br /&gt;
     DATA &amp;quot;avih&amp;quot;, len: 56&lt;br /&gt;
         LIST &amp;quot;strl&amp;quot;&lt;br /&gt;
             DATA &amp;quot;strh&amp;quot;, len: 56&lt;br /&gt;
             DATA &amp;quot;strf&amp;quot;&lt;br /&gt;
         ''LIST &amp;quot;strl&amp;quot;''&lt;br /&gt;
             ...&lt;br /&gt;
     ''LIST: name: `INFO''' (optional)&lt;br /&gt;
         ...&lt;br /&gt;
     LIST &amp;quot;movi&amp;quot;&lt;br /&gt;
         DATA &amp;quot;00dc&amp;quot;&lt;br /&gt;
         DATA &amp;quot;01wb&amp;quot;&lt;br /&gt;
         ...&lt;br /&gt;
     DATA &amp;quot;idx1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Idiosyncracies ==&lt;br /&gt;
''This section comes from the document 'AVI Files: Tips &amp;amp; Quirks' by Arpad &amp;quot;A'rpi&amp;quot; Gereoffy found at http://multimedia.cx/avistuff.txt''&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
A'rpi is the originator of the [[MPlayer]] media application for Linux. It's an open source movie player that can decode AVI files, as well as a number of other file formats. He has encountered a lot of AVIs created by a lot of different programs and is qualified to write about some of the quirks and nuances a programmer might encounter when writing a general purpose AVI file decoder.&lt;br /&gt;
&lt;br /&gt;
=== Random Tips For Processing AVI File ===&lt;br /&gt;
In short, these are some things I discovered while writing/fixing my AVI demuxer:&lt;br /&gt;
&lt;br /&gt;
* AVI files are built from variable length chunks.&lt;br /&gt;
* Each chunk has a 4-byte fourcc and a 4-byte length (dword).&lt;br /&gt;
* If the chunk size is bad/broken, it will kill the whole demuxer process.&lt;br /&gt;
* Chunks are padded to 2*n offset.&lt;br /&gt;
&lt;br /&gt;
AVI files usually have:&lt;br /&gt;
* RIFF avi header, containing general parameters (used for file type detection)&lt;br /&gt;
* stream headers, containing common format stream descriptor, and type-specific audio/video/other header&lt;br /&gt;
* single 'movi' chunk contains the audio and video packets.&lt;br /&gt;
* index chunk contains index table (16 bytes for each chunk in 'movi')&lt;br /&gt;
&lt;br /&gt;
The AVI header has a dwFlags field. It contains useful information, like type of interleaving, &amp;quot;have index&amp;quot; chunk and so on. Ignore it. Really. It's broken in too many files. Windows players ignore it too.&lt;br /&gt;
&lt;br /&gt;
AVI docs say that 'XXdb' are uncompressed and 'XXdc' are compressed video chunk fourccs. (XX = stream id in HEX. Some specs says it's in DEC. Funny.) Ignore it. Just use the first 2 chars as a hex number, and get stream type from stream header for that stream id. I've seen even XXim FourCCs...&lt;br /&gt;
&lt;br /&gt;
Stream header has some interesting fields:&lt;br /&gt;
* dwRate, dwScale: These specify the playback samplerate of the stream.&lt;br /&gt;
* dwStart: Specifies delay of the stream; rarely used, but must be supported.&lt;br /&gt;
* dwSampleSize: This is the sample size (bytes / sample). It may be 0, which means variable sample sizes -&amp;gt; 1 chunk == 1 sample. For non-zero samplesize, chunks may contain more than one sample.&lt;br /&gt;
&lt;br /&gt;
Regarding VBR audio in AVI, see VirtualDub site mentioned in the references. The 3 AVI parsers in Windows behave differently with such streams. 1 normal (0=vbr), 1 tricky (rounds up zero to blockalign), 1 crashes.&lt;br /&gt;
&lt;br /&gt;
In AVI, audio specific header contains WAVEFORMATEX and video spec. hdr contains BITMAPINFOHEADER. Both can have optional codec-dependent extra data appended after the struct. Don't crop it, it will break decoding!&lt;br /&gt;
&lt;br /&gt;
About the movi chunk:&lt;br /&gt;
Recently I got some AVI files with bad movi chunk sizes. So, I have to say: Ignore it. Read chunks from the file while not EOF, and not while filepos &amp;lt; movi_end.&lt;br /&gt;
&lt;br /&gt;
About index:&lt;br /&gt;
* It contains chunk pos, chunk size, chunk fourcc and flags. Bit 4 of the flags field (flags &amp;amp; 0x10) means that chunk represents a keyframe.&lt;br /&gt;
* Offset is relative to `cat /dev/urandom`. Really. Or dunno.&lt;br /&gt;
* I calculate an offset_of_offset value from the movi_start and first chunk offset. It works in 99% of cases. I saw different methods in other players, handling some common cases (such as relative to avi chunk, relative to movie chunk, etc.) and fallback to absolute value.&lt;br /&gt;
* Chunk info in chunk header (first 4+4 bytes of chunks) and index table should be equal. They aren't. Sometimes the size values differ by +/-1. Strange. Sometimes fourccs 'type' part (last 2 char) differ. Even more strange. Sometimes they leave chunk header. I think Windows parsers don't use chunk headers at all, and use only the index. This may be why they are unable to play files without index.&lt;br /&gt;
&lt;br /&gt;
On the subject of interleaving, there are 3 categories of interleaving for AVI files (taken from DOCS/tech/formats.txt in the [[MPlayer]] distribution):&lt;br /&gt;
# Interleaved: Audio and video content is interleaved. It's faster and requires only 1 reading thread, so it's recommended (and most commonly used).&lt;br /&gt;
# Non-interleaved: Audio and video aren't interleaved. The file stores all of the video data followed by all the audio data. Such a file requires 2 reading processes or 1 reading with lots of seeking. This is very bad when playing the data from a network or CD-ROM.&lt;br /&gt;
# Badly-interleaved streams: Some AVI files claim to be interleaved but with bad sync. These files should be treated as non-interleaved.&lt;br /&gt;
&lt;br /&gt;
About A/V sync, you should rely on samplerate (dwRate/dwScale), samplesize and stream positions. Use an integer, not a floating-point number, for byte positions. When calculating time for each frame:&lt;br /&gt;
  time = ((dwSampleSize ? (bytepos / dwSampleSize) : chunkpos) * dwRate / dwScale&lt;br /&gt;
floats will gradually drift into error.&lt;br /&gt;
&lt;br /&gt;
== Quirks ==&lt;br /&gt;
* Some AVI files are seen in the wild with the signature 'AVI\x19'. There is a 0x19 number in the fourth byte rather than a 0x20.&lt;br /&gt;
&lt;br /&gt;
[[Category:Container Formats]]&lt;/div&gt;</summary>
		<author><name>Clone2727</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Mirrored_Files&amp;diff=12170</id>
		<title>Mirrored Files</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Mirrored_Files&amp;diff=12170"/>
		<updated>2010-01-23T15:09:15Z</updated>

		<summary type="html">&lt;p&gt;Clone2727: update QTFF link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a list of official technical documents that are mirrored at multimedia.cx for convenience or archival: http://multimedia.cx/mirror/&lt;br /&gt;
&lt;br /&gt;
Contact [[User:Multimedia Mike|Multimedia Mike]] in order to add documents to the mirror.&lt;br /&gt;
&lt;br /&gt;
* [[A52]]:&lt;br /&gt;
** mirror: http://multimedia.cx/mirror/a_52b.pdf&lt;br /&gt;
** original: http://www.atsc.org/standards/a_52b.pdf&lt;br /&gt;
&lt;br /&gt;
* [[Apple Core Audio Format]] specification, dated 2006-03-08:&lt;br /&gt;
** mirror: http://multimedia.cx/mirror/CAFSpec-2006-03-08.pdf&lt;br /&gt;
** original: http://developer.apple.com/documentation/MusicAudio/Reference/CAFSpec/index.html&lt;br /&gt;
&lt;br /&gt;
* Apple [[QuickTime container]] specification, dated 2007-09-04:&lt;br /&gt;
** mirror: http://multimedia.cx/mirror/qtff-2007-09-04.pdf&lt;br /&gt;
** original: http://developer.apple.com/mac/library/documentation/QuickTime/QTFF&lt;br /&gt;
&lt;br /&gt;
* [[Audio Interchange File Format]]:&lt;br /&gt;
** mirror: http://multimedia.cx/mirror/AudioIFF1_2_1.htm&lt;br /&gt;
&lt;br /&gt;
* [[Cinepak]]:&lt;br /&gt;
** mirror: http://multimedia.cx/mirror/cinepak.txt&lt;br /&gt;
** original: http://www.csse.monash.edu.au/%7etimf/videocodec/cinepak.txt&lt;br /&gt;
&lt;br /&gt;
* [[CYUV]]:&lt;br /&gt;
** mirror: http://multimedia.cx/mirror/cyuv.txt&lt;br /&gt;
** original: http://www.csse.monash.edu.au/~timf/videocodec/cyuv.txt&lt;br /&gt;
&lt;br /&gt;
* [[Dialogic IMA ADPCM]]:&lt;br /&gt;
** mirror: http://multimedia.cx/mirror/dialogic-adpcm.pdf&lt;br /&gt;
&lt;br /&gt;
* [[DTS]]:&lt;br /&gt;
** mirror (whitepaper): http://multimedia.cx/mirror/dts-whitepaper.pdf&lt;br /&gt;
** mirror (document 1): http://multimedia.cx/mirror/dts1.pdf&lt;br /&gt;
** mirror (document 2): http://multimedia.cx/mirror/dts2.pdf&lt;br /&gt;
** mirror (DTS patent application, scans, 550 pages, 54 MB PDF): http://multimedia.cx/mirror/EP864146-53.pdf&lt;br /&gt;
** mirror (DCA transform): http://multimedia.cx/mirror/dca-transform.pdf&lt;br /&gt;
&lt;br /&gt;
* [[H264]] draft specification, marked 2002 (E):&lt;br /&gt;
** mirror: http://multimedia.cx/mirror/JVT-G050.pdf&lt;br /&gt;
&lt;br /&gt;
* [[IBM UltiMotion]] specification:&lt;br /&gt;
** mirror: http://multimedia.cx/mirror/UMSPEC.ZIP&lt;br /&gt;
&lt;br /&gt;
* Id [[CIN]]:&lt;br /&gt;
** mirror: http://multimedia.cx/mirror/idcin.html&lt;br /&gt;
** original: http://www.csse.monash.edu.au/~timf/videocodec/idcin.html&lt;br /&gt;
&lt;br /&gt;
* Id [[RoQ]]:&lt;br /&gt;
** mirror: http://multimedia.cx/mirror/idroq.txt&lt;br /&gt;
** original: http://www.csse.monash.edu.au/~timf/videocodec/idroq.txt&lt;br /&gt;
&lt;br /&gt;
* [[Indeo 3]]:&lt;br /&gt;
** mirror (partial specification): http://multimedia.cx/mirror/5386232.pdf&lt;br /&gt;
** mirror (header explanation): http://multimedia.cx/mirror/indeo3.txt&lt;br /&gt;
** original (header explanation): http://www.csse.monash.edu.au/~timf/videocodec/indeo3.txt&lt;br /&gt;
&lt;br /&gt;
* [[Meridian Lossless Packing]] whitepaper:&lt;br /&gt;
** mirror: http://multimedia.cx/mirror/mlp_jap_new.PDF&lt;br /&gt;
** original: http://www.meridian-audio.com/w_paper/mlp_jap_new.PDF&lt;br /&gt;
&lt;br /&gt;
* [[Nokia MVC]]:&lt;br /&gt;
** documentation:&lt;br /&gt;
*** original: http://ftp3.itu.ch/av-arch/video-site/0005_Osa/q15j19.doc&lt;br /&gt;
*** mirror: http://multimedia.cx/mirror/q15j19.doc&lt;br /&gt;
** reference codec:&lt;br /&gt;
*** original: http://ftp3.itu.ch/av-arch/video-site/0005_Osa/q15j20.zip&lt;br /&gt;
*** mirror: http://multimedia.cx/mirror/q15j20.zip&lt;br /&gt;
&lt;br /&gt;
* [[On2 VP6]] whitepaper:&lt;br /&gt;
** mirror: http://multimedia.cx/mirror/vp6-white-paper.pdf&lt;br /&gt;
** original: http://www.on2.com/cms-data/pdf/1125607149174329.pdf&lt;br /&gt;
&lt;br /&gt;
* [[On2 VP7]] whitepaper:&lt;br /&gt;
** mirror: http://multimedia.cx/mirror/vp7-white-paper.pdf&lt;br /&gt;
** original: http://www.on2.com/cms-data/pdf/1123531744838491.pdf&lt;br /&gt;
&lt;br /&gt;
* [[PVA]] specification:&lt;br /&gt;
** mirror: http://multimedia.cx/mirror/av_format_v1.pdf&lt;br /&gt;
&lt;br /&gt;
* [[RealAudio 14.4]]:&lt;br /&gt;
** mirror: http://multimedia.cx/mirror/spra136.pdf&lt;br /&gt;
** original: http://focus.ti.com/lit/an/spra136/spra136.pdf&lt;br /&gt;
&lt;br /&gt;
* [[VC-1]] (a.k.a. VC-9) draft specification:&lt;br /&gt;
** mirror: draft dated 2005-08-23: http://multimedia.cx/mirror/s421m.pdf&lt;br /&gt;
** mirror: draft dated 2004-03-31: http://multimedia.cx/mirror/C24.008-VC9-Spec-CD1.pdf&lt;br /&gt;
** reference source code mirror: http://multimedia.cx/mirror/VC1_reference_decoder_release6.zip&lt;/div&gt;</summary>
		<author><name>Clone2727</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=QuickTime_container&amp;diff=12169</id>
		<title>QuickTime container</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=QuickTime_container&amp;diff=12169"/>
		<updated>2010-01-23T15:08:37Z</updated>

		<summary type="html">&lt;p&gt;Clone2727: update QTFF link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extensions: mov, qt, mp4, m4v, m4a, m4p, m4b, m4r, k3g, skm, 3gp, 3g2&lt;br /&gt;
* Company: [[Apple]]&lt;br /&gt;
* Official specification: http://developer.apple.com/mac/library/documentation/QuickTime/QTFF/index.html ([[Mirrored Files|mirrored PDF]])&lt;br /&gt;
** ISO base media file format: [http://standards.iso.org/ittf/PubliclyAvailableStandards/c051533_ISO_IEC_14496-12_2008.zip ISO/IEC 14496-12:2008]+[http://standards.iso.org/ittf/PubliclyAvailableStandards/c052970_ISO_IEC_14496-12_2008_Cor_1_2008.zip Cor.1]+[http://standards.iso.org/ittf/PubliclyAvailableStandards/c052971_ISO_IEC_14496-12_2008_Cor_2_2009.zip Cor.2]&lt;br /&gt;
* MIME Types:&lt;br /&gt;
** mov, qt: video/quicktime or video/x-quicktime&lt;br /&gt;
** m4a, m4b: audio/x-m4a&lt;br /&gt;
&lt;br /&gt;
== Known FOURCCs ==&lt;br /&gt;
&lt;br /&gt;
The following sections list FOURCCs known to appear in Apple QuickTime files. Note that sometimes the FOURCC is only 3 characters and there is a space (ASCII 0x20) to round out the full 4 characters.&lt;br /&gt;
&lt;br /&gt;
=== Video FOURCCs ===&lt;br /&gt;
&lt;br /&gt;
* [[Raw RGB|'raw ']]&lt;br /&gt;
* [[Apple QuickTime RLE|'rle ']]&lt;br /&gt;
* [[Apple SMC|'smc ']]&lt;br /&gt;
* [[Apple RPZA|'rpza']]&lt;br /&gt;
* [[8BPS|'8bps']]&lt;br /&gt;
* [[QDraw|'qdrw']]&lt;br /&gt;
* [[Cinepak|'cvid']]&lt;br /&gt;
* [[Sorenson Video 1|'svq1']]&lt;br /&gt;
* [[Sorenson Video 3|'svq3']]&lt;br /&gt;
* [[ISO MPEG-4|'DIVX']]&lt;br /&gt;
* [[H.263|'h263']]&lt;br /&gt;
* [[ISO MPEG-4|'mp4v']]&lt;br /&gt;
* [[mx5p|'mx5p']]: MPEG2 IMX 635/50 50mb/s produced by [[Final Cut Pro]]&lt;br /&gt;
* [[mx3n|'mx3n']]: MPEG2 IMX 635/50 30mb/s produced by [[Final Cut Pro]]&lt;br /&gt;
* [[dvpp|'dvpp']]: DVCPRO PAL produced by [[Final Cut Pro]]&lt;br /&gt;
* [[dv5p|'dv5p']]: DVCPRO50 produced by [[Final Cut Pro]]&lt;br /&gt;
* [[hdv3|'hdv3']]: HDV produced by [[Final Cut Pro]]&lt;br /&gt;
&lt;br /&gt;
*8BPS     &amp;quot;Apple Planar RGB&amp;quot;&lt;br /&gt;
*SVQ1     &amp;quot;Sorenson Video¬ Compressor&amp;quot;&lt;br /&gt;
*SVQ3     &amp;quot;Sorenson Video 3 Compressor&amp;quot;&lt;br /&gt;
*WRLE     &amp;quot;Apple BMP&amp;quot;&lt;br /&gt;
*avc1     &amp;quot;H.264 Encoder&amp;quot;&lt;br /&gt;
*cvid     &amp;quot;Apple Cinepak&amp;quot;&lt;br /&gt;
*dv5n     &amp;quot;Apple DVCPRO50 - NTSC&amp;quot;&lt;br /&gt;
*dv5p     &amp;quot;Apple DVCPRO50 - PAL&amp;quot;&lt;br /&gt;
*dvc      &amp;quot;Apple DV/DVCPRO - NTSC&amp;quot;&lt;br /&gt;
*dvcp     &amp;quot;Apple DV - PAL&amp;quot;&lt;br /&gt;
*dvpp     &amp;quot;Apple DVCPRO - PAL&amp;quot;&lt;br /&gt;
*h261     &amp;quot;Apple H.261&amp;quot;&lt;br /&gt;
*h263     &amp;quot;H.263&amp;quot;&lt;br /&gt;
*h263     &amp;quot;Apple VC H.263&amp;quot;&lt;br /&gt;
*[[Apple_Intermediate_Codec|icod]]     &amp;quot;Apple Intermediate Codec&amp;quot;&lt;br /&gt;
*jpeg     &amp;quot;Apple Photo - JPEG&amp;quot;&lt;br /&gt;
*mjp2     &amp;quot;JPEG 2000 Encoder&amp;quot;&lt;br /&gt;
*mjpa     &amp;quot;Apple Motion JPEG A&amp;quot;&lt;br /&gt;
*mjpb     &amp;quot;Apple Motion JPEG B&amp;quot;&lt;br /&gt;
*mp4v     &amp;quot;Apple MPEG4 Compressor&amp;quot;&lt;br /&gt;
*png      &amp;quot;Apple PNG&amp;quot;&lt;br /&gt;
*pxlt     &amp;quot;Apple Pixlet Video&amp;quot;&lt;br /&gt;
*raw      &amp;quot;Apple None&amp;quot;&lt;br /&gt;
*rle      &amp;quot;Apple Animation&amp;quot;&lt;br /&gt;
*rpza     &amp;quot;Apple Video&amp;quot;&lt;br /&gt;
*smc      &amp;quot;Apple Graphics&amp;quot;&lt;br /&gt;
*tga      &amp;quot;Apple TGA&amp;quot;&lt;br /&gt;
*tiff     &amp;quot;Apple TIFF&amp;quot;&lt;br /&gt;
*yuv2     &amp;quot;Apple Component Video - YUV422&amp;quot;&lt;br /&gt;
*....     &amp;quot;DivX 4 Decoder&amp;quot;&lt;br /&gt;
*.SGI     &amp;quot;Apple SGI&amp;quot;&lt;br /&gt;
*2vuy     &amp;quot;Apple YUV422 Codec (2vuy)&amp;quot;&lt;br /&gt;
*2vuy     &amp;quot;YUV 4:2:2 Hardware Acceleration Codec (yuvs)&amp;quot;&lt;br /&gt;
*3IV2     &amp;quot;3ivx Decoder&amp;quot;&lt;br /&gt;
*3IVD     &amp;quot;3ivx Decoder&amp;quot;&lt;br /&gt;
*3iv2     &amp;quot;3ivx Decoder&amp;quot;&lt;br /&gt;
*3ivd     &amp;quot;3ivx Decoder&amp;quot;&lt;br /&gt;
*8BPS     &amp;quot;Apple Planar RGB&amp;quot;&lt;br /&gt;
*AP41     &amp;quot;DivX 3 Decoder&amp;quot;&lt;br /&gt;
*BLZ0     &amp;quot;XVID Decoder&amp;quot;&lt;br /&gt;
*COL0     &amp;quot;DivX 3 Decoder&amp;quot;&lt;br /&gt;
*COL1     &amp;quot;DivX 3 Decoder&amp;quot;&lt;br /&gt;
*DAVC     &amp;quot;H264 Decoder&amp;quot;&lt;br /&gt;
*DIV1     &amp;quot;MS-MPEG4 v1 Decoder&amp;quot;&lt;br /&gt;
*DIV2     &amp;quot;MS-MPEG4 v2 Decoder&amp;quot;&lt;br /&gt;
*DIV3     &amp;quot;DivX 3 Decoder&amp;quot;&lt;br /&gt;
*DIV4     &amp;quot;DivX 3 Decoder&amp;quot;&lt;br /&gt;
*DIV5     &amp;quot;DivX 3 Decoder&amp;quot;&lt;br /&gt;
*DIV6     &amp;quot;DivX 3 Decoder&amp;quot;&lt;br /&gt;
*DIVX     &amp;quot;DivX 4 Decoder&amp;quot;&lt;br /&gt;
*DX50     &amp;quot;DivX 5 Decoder&amp;quot;&lt;br /&gt;
*FLV1     &amp;quot;Sorenson H.263 Decoder&amp;quot;&lt;br /&gt;
*FMP4     &amp;quot;MPEG-4 Decoder&amp;quot;&lt;br /&gt;
*FSV1     &amp;quot;Flash Screen Video Decoder&amp;quot;&lt;br /&gt;
*H264     &amp;quot;H264 Decoder&amp;quot;&lt;br /&gt;
*M4S2     &amp;quot;DivX 4 Decoder&amp;quot;&lt;br /&gt;
*M4s2     &amp;quot;WMV Image Codec&amp;quot;&lt;br /&gt;
*MP42     &amp;quot;MS-MPEG4 v2 Decoder&amp;quot;&lt;br /&gt;
*MP43     &amp;quot;DivX 3 Decoder&amp;quot;&lt;br /&gt;
*MP4S     &amp;quot;DivX 4 Decoder&amp;quot;&lt;br /&gt;
*MPG3     &amp;quot;DivX 3 Decoder&amp;quot;&lt;br /&gt;
*MPG4     &amp;quot;MS-MPEG4 v1 Decoder&amp;quot;&lt;br /&gt;
*Mjpg     &amp;quot;VCM Image Codec&amp;quot;&lt;br /&gt;
*Mp42     &amp;quot;WMV Image Codec&amp;quot;&lt;br /&gt;
*Mp43     &amp;quot;WMV Image Codec&amp;quot;&lt;br /&gt;
*Mp4S     &amp;quot;WMV Image Codec&amp;quot;&lt;br /&gt;
*PNTG     &amp;quot;Apple MacPaint&amp;quot;&lt;br /&gt;
*RMP4     &amp;quot;MPEG-4 Decoder&amp;quot;&lt;br /&gt;
*SEDG     &amp;quot;MPEG-4 Decoder&amp;quot;&lt;br /&gt;
*SMP4     &amp;quot;MPEG-4 Decoder&amp;quot;&lt;br /&gt;
*SVQ1     &amp;quot;Sorenson Video¬ Decompressor&amp;quot;&lt;br /&gt;
*SVQ3      &amp;quot;Sorenson Video 3 Decompressor&amp;quot;&lt;br /&gt;
*UMP4     &amp;quot;DivX 4 Decoder&amp;quot;&lt;br /&gt;
*VP62     &amp;quot;TrueMotion VP6 Decoder&amp;quot;&lt;br /&gt;
*VP6F     &amp;quot;TrueMotion VP6 Decoder&amp;quot;&lt;br /&gt;
*VSSH     &amp;quot;H264 Decoder&amp;quot;&lt;br /&gt;
*WMV1     &amp;quot;WMV Image Codec&amp;quot;&lt;br /&gt;
*WMV2     &amp;quot;WMV Image Codec&amp;quot;&lt;br /&gt;
*WMV3     &amp;quot;WMV Image Codec&amp;quot;&lt;br /&gt;
*WRLE     &amp;quot;Apple BMP&amp;quot;&lt;br /&gt;
*WV1F     &amp;quot;MPEG-4 Decoder&amp;quot;&lt;br /&gt;
*X264     &amp;quot;H264 Decoder&amp;quot;&lt;br /&gt;
*XVID     &amp;quot;XVID Decoder&amp;quot;&lt;br /&gt;
*XVIX     &amp;quot;XVID Decoder&amp;quot;&lt;br /&gt;
*XviD     &amp;quot;XVID Decoder&amp;quot;&lt;br /&gt;
*ac16     &amp;quot;YUV 4:2:2 Hardware Acceleration Codec (yuvs)&amp;quot;&lt;br /&gt;
*ac32     &amp;quot;YUV 4:2:2 Hardware Acceleration Codec (yuvs)&amp;quot;&lt;br /&gt;
*acBG     &amp;quot;YUV 4:2:2 Hardware Acceleration Codec (yuvs)&amp;quot;&lt;br /&gt;
*avc1     &amp;quot;H.264 Decoder&amp;quot;&lt;br /&gt;
*avr      &amp;quot;Apple AVR JPEG&amp;quot;&lt;br /&gt;
*b16g     &amp;quot;Apple 16-bit Gray&amp;quot;&lt;br /&gt;
*b32a     &amp;quot;Apple 32-bit Gray with Alpha&amp;quot;&lt;br /&gt;
*b48r     &amp;quot;Apple 48-bit RGB&amp;quot;&lt;br /&gt;
*b64a     &amp;quot;Apple 64-bit ARGB&amp;quot;&lt;br /&gt;
*base     &amp;quot;Apple 64-bit ARGB&amp;quot;&lt;br /&gt;
*blit     &amp;quot;Apple 64-bit ARGB&amp;quot;&lt;br /&gt;
*blnd     &amp;quot;Alpha Compositor&amp;quot;&lt;br /&gt;
*blur     &amp;quot;Blur&amp;quot;&lt;br /&gt;
*brco     &amp;quot;Brightness and Contrast&amp;quot;&lt;br /&gt;
*chan     &amp;quot;Channel Compositor&amp;quot;&lt;br /&gt;
*ckey     &amp;quot;Chroma Key&amp;quot;&lt;br /&gt;
*clou     &amp;quot;Cloud&amp;quot;&lt;br /&gt;
*cmyk     &amp;quot;Apple CMYK&amp;quot;&lt;br /&gt;
*col0     &amp;quot;DivX 3 Decoder&amp;quot;&lt;br /&gt;
*col1     &amp;quot;DivX 3 Decoder&amp;quot;&lt;br /&gt;
*cupa     &amp;quot;QTVR Cubic Codec&amp;quot;&lt;br /&gt;
*cvid     &amp;quot;Apple Cinepak&amp;quot;&lt;br /&gt;
*div1     &amp;quot;MS-MPEG4 v1 Decoder&amp;quot;&lt;br /&gt;
*div2     &amp;quot;MS-MPEG4 v2 Decoder&amp;quot;&lt;br /&gt;
*div3     &amp;quot;DivX 3 Decoder&amp;quot;&lt;br /&gt;
*div4     &amp;quot;DivX 3 Decoder&amp;quot;&lt;br /&gt;
*div5     &amp;quot;DivX 3 Decoder&amp;quot;&lt;br /&gt;
*div6     &amp;quot;DivX 3 Decoder&amp;quot;&lt;br /&gt;
*divx     &amp;quot;DivX 4 Decoder&amp;quot;&lt;br /&gt;
*dmb1     &amp;quot;Apple OpenDML JPEG&amp;quot;&lt;br /&gt;
*drmi     &amp;quot;AVC0 Media&amp;quot;&lt;br /&gt;
*dslv     &amp;quot;Cross Fade&amp;quot;&lt;br /&gt;
*dv5n     &amp;quot;Apple DVCPRO50&amp;quot;&lt;br /&gt;
*dv5n      &amp;quot;DVCPRO50&amp;quot;&lt;br /&gt;
*dv5p     &amp;quot;Apple DVCPRO50&amp;quot;&lt;br /&gt;
*dv5p      &amp;quot;DVCPRO50&amp;quot;&lt;br /&gt;
*dvc      &amp;quot;Apple DV&amp;quot;&lt;br /&gt;
*dvcp     &amp;quot;Apple DV&amp;quot;&lt;br /&gt;
*dvpp     &amp;quot;Apple DVCPRO&amp;quot;&lt;br /&gt;
*edge     &amp;quot;Edge Detection&amp;quot;&lt;br /&gt;
*embs     &amp;quot;Emboss&amp;quot;&lt;br /&gt;
*fire     &amp;quot;Fire&amp;quot;&lt;br /&gt;
*flic     &amp;quot;Apple FLC&amp;quot;&lt;br /&gt;
*fmns     &amp;quot;Film Noise&amp;quot;&lt;br /&gt;
*fpix     &amp;quot;FlashPix Image&amp;quot;&lt;br /&gt;
*gain     &amp;quot;Alpha Gain&amp;quot;&lt;br /&gt;
*geff     &amp;quot;Special Effects and Filters&amp;quot;&lt;br /&gt;
*genk     &amp;quot;General Convolution&amp;quot;&lt;br /&gt;
*gif      &amp;quot;Apple GIF&amp;quot;&lt;br /&gt;
*glas     &amp;quot;Glass&amp;quot;&lt;br /&gt;
*h261     &amp;quot;Apple H.261&amp;quot;&lt;br /&gt;
*h263     &amp;quot;H.263&amp;quot;&lt;br /&gt;
*h263     &amp;quot;Apple VC H.263&amp;quot;&lt;br /&gt;
*h264     &amp;quot;H264 Decoder&amp;quot;&lt;br /&gt;
*hslb     &amp;quot;HSL Balance&amp;quot;&lt;br /&gt;
*j420     &amp;quot;Apple YUV420 Codec&amp;quot;&lt;br /&gt;
*jpeg     &amp;quot;Apple Photo - JPEG&amp;quot;&lt;br /&gt;
*kpcd     &amp;quot;Apple Photo CD&amp;quot;&lt;br /&gt;
*lens     &amp;quot;Lens Flare&amp;quot;&lt;br /&gt;
*ltpa     &amp;quot;QTVR Cylindrical Codec&amp;quot;&lt;br /&gt;
*m4s2     &amp;quot;DivX 4 Decoder&amp;quot;&lt;br /&gt;
*matt     &amp;quot;Gradient Wipe&amp;quot;&lt;br /&gt;
*mjp2     &amp;quot;JPEG 2000 Decoder&amp;quot;&lt;br /&gt;
*mjpa     &amp;quot;Apple Motion JPEG A&amp;quot;&lt;br /&gt;
*mjpb     &amp;quot;Apple Motion JPEG B&amp;quot;&lt;br /&gt;
*mp42     &amp;quot;MS-MPEG4 v2 Decoder&amp;quot;&lt;br /&gt;
*mp43     &amp;quot;DivX 3 Decoder&amp;quot;&lt;br /&gt;
*mp4s     &amp;quot;DivX 4 Decoder&amp;quot;&lt;br /&gt;
*mp4v     &amp;quot;Apple MPEG4 Decompressor&amp;quot;&lt;br /&gt;
*mpg3     &amp;quot;DivX 3 Decoder&amp;quot;&lt;br /&gt;
*mpg4     &amp;quot;MS-MPEG4 v1 Decoder&amp;quot;&lt;br /&gt;
*mplo     &amp;quot;Implode&amp;quot;&lt;br /&gt;
*msvc     &amp;quot;Apple - Microsoft Video 1&amp;quot;&lt;br /&gt;
*myuv     &amp;quot;Apple YUV420 Codec&amp;quot;&lt;br /&gt;
*path     &amp;quot;Apple Curve&amp;quot;&lt;br /&gt;
*pdf      &amp;quot;PDF Image&amp;quot;&lt;br /&gt;
*png      &amp;quot;Apple PNG&amp;quot;&lt;br /&gt;
*push     &amp;quot;Push&amp;quot;&lt;br /&gt;
*pxlt     &amp;quot;Apple Pixlet Video&amp;quot;&lt;br /&gt;
*qdrw     &amp;quot;Apple QuickDraw&amp;quot;&lt;br /&gt;
*r408     &amp;quot;Apple r408&amp;quot;&lt;br /&gt;
*raw      &amp;quot;Apple None&amp;quot;&lt;br /&gt;
*raw       &amp;quot;DV&amp;quot;&lt;br /&gt;
*raw       &amp;quot;Apple RGB to YUV&amp;quot;&lt;br /&gt;
*rgbb     &amp;quot;RGB Balance&amp;quot;&lt;br /&gt;
*ripl     &amp;quot;Ripple&amp;quot;&lt;br /&gt;
*rle      &amp;quot;Apple Animation&amp;quot;&lt;br /&gt;
*rpza     &amp;quot;Apple Video&amp;quot;&lt;br /&gt;
*scal     &amp;quot;Apple Scaling Codec&amp;quot;&lt;br /&gt;
*shrp     &amp;quot;Sharpen&amp;quot;&lt;br /&gt;
*slid     &amp;quot;Slide&amp;quot;&lt;br /&gt;
*smc      &amp;quot;Apple Graphics&amp;quot;&lt;br /&gt;
*smp2     &amp;quot;Iris&amp;quot;&lt;br /&gt;
*smp3     &amp;quot;Radial&amp;quot;&lt;br /&gt;
*smp4     &amp;quot;Matrix Wipe&amp;quot;&lt;br /&gt;
*smpt     &amp;quot;Wipe&amp;quot;&lt;br /&gt;
*solr     &amp;quot;Color Style&amp;quot;&lt;br /&gt;
*sync     &amp;quot;ColorSync&amp;quot;&lt;br /&gt;
*syv9     &amp;quot;Apple Sorenson YUV9 Codec&amp;quot;&lt;br /&gt;
*text     &amp;quot;Apple Text ATSUI Codec&amp;quot;&lt;br /&gt;
*tga      &amp;quot;Apple TGA&amp;quot;&lt;br /&gt;
*tiff     &amp;quot;Apple TIFF&amp;quot;&lt;br /&gt;
*tint     &amp;quot;Color Tint&amp;quot;&lt;br /&gt;
*trav     &amp;quot;Traveling Matte&amp;quot;&lt;br /&gt;
*v408     &amp;quot;Apple v408&amp;quot;&lt;br /&gt;
*x264     &amp;quot;H264 Decoder&amp;quot;&lt;br /&gt;
*xplo     &amp;quot;Explode&amp;quot;&lt;br /&gt;
*xvid     &amp;quot;XVID Decoder&amp;quot;&lt;br /&gt;
*y420     &amp;quot;Apple YUV420 Codec&amp;quot;&lt;br /&gt;
*yuv2     &amp;quot;Apple Component Video - YUV422&amp;quot;&lt;br /&gt;
*yuvs     &amp;quot;Apple YUV422 Codec (yuvs)&amp;quot;&lt;br /&gt;
*yuvs     &amp;quot;YUV 4:2:2 Hardware Acceleration Codec (yuvs)&amp;quot;&lt;br /&gt;
*yuvu     &amp;quot;Apple YUV422 Codec (yuvu)&amp;quot;&lt;br /&gt;
*yuvx     &amp;quot;Apple YUV422 Codec&amp;quot;&lt;br /&gt;
*zoom     &amp;quot;Zoom&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
imdc:2Vuy:Ajav &amp;quot;AJA Kona 2Vuy Codec&amp;quot;&lt;br /&gt;
imdc:2vuy:AjaV &amp;quot;AJA Kona 2vuy VideoOut Codec&amp;quot;&lt;br /&gt;
imdc:2Vuy:AjaV &amp;quot;AJA Kona 2Vuy VideoOut Codec&amp;quot;&lt;br /&gt;
imdc:2vuy:appl &amp;quot;Digital Cinema Desktop Transfer Codec&amp;quot;&lt;br /&gt;
imdc:2vuy:AVSI &amp;quot;Aurora 8bit eXtreme? UC&amp;quot;&lt;br /&gt;
imdc:2Vuy:AVSS &amp;quot;Aurora 8bit Advanced UC&amp;quot;&lt;br /&gt;
imdc:2VUY:AVSS &amp;quot;Aurora 8bit UC Legacy&amp;quot;&lt;br /&gt;
imdc:2Vuy:BMAG &amp;quot;Blackmagic 2Vuy 8 Bit&amp;quot;&lt;br /&gt;
imdc:2vuy:BMAG &amp;quot;Blackmagic 8 Bit&amp;quot;&lt;br /&gt;
imdc:2vuy:DV64 &amp;quot;Digital Voodoo SD? 8 Bit&amp;quot;&lt;br /&gt;
imdc:2vuy:KeyG &amp;quot;Apple FCP Uncompressed 8-bit 4:2:2&amp;quot;&lt;br /&gt;
imdc:BGGR:ASC &amp;quot;ASC Bayer Decompressor&amp;quot;&lt;br /&gt;
imdc:C310:GL3N &amp;quot;10-bit Cineon Decompressor&amp;quot;&lt;br /&gt;
imdc:cini:bsmt &amp;quot;Cineon Codec&amp;quot;&lt;br /&gt;
imdc:D210:GL3N &amp;quot;DPX 10-bit Y'CbCr 4:2:2 Decompressor&amp;quot;&lt;br /&gt;
imdc:DV10:AVSS &amp;quot;Aurora DV 10 Bit UC&amp;quot;&lt;br /&gt;
imdc:DV10:BMAG &amp;quot;Blackmagic DV10 10 Bit&amp;quot;&lt;br /&gt;
imdc:DV10:DV64 &amp;quot;Digital Voodoo SD 10 Bit&amp;quot;&lt;br /&gt;
imdc:DV10:DVOO &amp;quot;Digital Voodoo SD 10 Bit&amp;quot;&lt;br /&gt;
imdc:DVOO:AVSS &amp;quot;Aurora DV 8 Bit UC&amp;quot;&lt;br /&gt;
imdc:DVOO:BMAG &amp;quot;Blackmagic DVOO 8 Bit&amp;quot;&lt;br /&gt;
imdc:DVOO:DV64 &amp;quot;Digital Voodoo SD? 8 Bit&amp;quot;&lt;br /&gt;
imdc:DVOO:DVOO &amp;quot;Digital Voodoo SD? 8 Bit&amp;quot;&lt;br /&gt;
imdc:dx45:DARC &amp;quot;DivX 6.0&amp;quot;&lt;br /&gt;
imdc:DX45:DARC &amp;quot;DivX 6.0&amp;quot;&lt;br /&gt;
imdc:Mczm:Thry &amp;quot;Microcosm Codec&amp;quot;&lt;br /&gt;
imdc:MIFF:Maya &amp;quot;Maya IFF Image Codec&amp;quot;&lt;br /&gt;
imdc:NO16:Thry &amp;quot;None16 Codec&amp;quot;&lt;br /&gt;
imdc:pRiz:appl &amp;quot;LiveType Codec Decompressor&amp;quot;&lt;br /&gt;
imdc:R10g:Ajav &amp;quot;AJA Kona 10-bit Log RGB Codec&amp;quot;&lt;br /&gt;
imdc:R10k:Ajav &amp;quot;AJA Kona 10-bit RGB Codec&amp;quot;&lt;br /&gt;
imdc:r408:AVSI &amp;quot;Aurora r408 Transfer Decompressor&amp;quot;&lt;br /&gt;
imdc:Shr0:BtJz &amp;quot;Sheer&amp;quot;&lt;br /&gt;
imdc:Shr1:BtJz &amp;quot;Sheer RGB[A] 8b&amp;quot;&lt;br /&gt;
imdc:Shr2:BtJz &amp;quot;Sheer Y'CbCr[A] 8bv 4:4:4[:4]&amp;quot;&lt;br /&gt;
imdc:Shr3:BtJz &amp;quot;Sheer Y'CbCr[A] 8bv 4:2:2[:4]&amp;quot;&lt;br /&gt;
imdc:Shr4:BtJz &amp;quot;Sheer Y'CbCr 8bw 4:2:2&amp;quot;&lt;br /&gt;
imdc:Shr5:BtJz &amp;quot;Sheer Y'CbCr[A] 10bv 4:4:4[:4]&amp;quot;&lt;br /&gt;
imdc:Shr6:BtJz &amp;quot;Sheer Y'CbCr[A] 10bv 4:2:2[:4]&amp;quot;&lt;br /&gt;
imdc:Shr7:BtJz &amp;quot;Sheer RGB[A] 10b&amp;quot;&lt;br /&gt;
imdc:v408:AVSI &amp;quot;Aurora v408 Transfer Decompressor&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Audio FOURCCs ===&lt;br /&gt;
&lt;br /&gt;
* [[PCM|'raw ']]&lt;br /&gt;
* [[PCM|'twos']]&lt;br /&gt;
* [[PCM|'sowt']]&lt;br /&gt;
* [[Apple MACE|'mac3']]&lt;br /&gt;
* [[Apple MACE|'mac6']]&lt;br /&gt;
* [[Apple QuickTime IMA ADPCM|'ima4']]&lt;br /&gt;
* [[PCM#Logarithmic PCM|'ulaw']]&lt;br /&gt;
* [[PCM#Logarithmic PCM|'alaw']]&lt;br /&gt;
* [[MP3|'.mp3']]&lt;br /&gt;
* [[Vorbis|'OggS']]&lt;br /&gt;
* [[QDesign Music Codec|'QDMC']]&lt;br /&gt;
* [[QDesign Music Codec|'QDM2']]&lt;br /&gt;
* [[MPEG-4 Audio|'mp4a']]&lt;br /&gt;
* [[MPEG-4 Audio|'drms']]&lt;br /&gt;
* [[PCM|'in24']]&lt;br /&gt;
* [[PCM|'in32']]&lt;br /&gt;
* [[PCM|'fl32']]&lt;br /&gt;
* [[PCM|'fl64']]&lt;br /&gt;
* [[Qualcomm Voice Codec|'Qclp']]&lt;br /&gt;
* [[GSM 06.10|'agsm']]&lt;br /&gt;
&lt;br /&gt;
*MAC3:appl     &amp;quot;MACE 3:1&amp;quot;&lt;br /&gt;
*MAC6:appl     &amp;quot;MACE 6:1&amp;quot;&lt;br /&gt;
*QDM2:QDes     &amp;quot;QDesign Music 2&amp;quot;&lt;br /&gt;
*Qclp:QCOM     &amp;quot;Qualcomm PureVoice¬&amp;quot;&lt;br /&gt;
*alac:appl     &amp;quot;Apple Lossless&amp;quot;&lt;br /&gt;
*alaw:appl     &amp;quot;ALaw 2:1&amp;quot;&lt;br /&gt;
*fl32:appl     &amp;quot;32-bit Floating Point&amp;quot;&lt;br /&gt;
*fl64:appl     &amp;quot;64-bit Floating Point&amp;quot;&lt;br /&gt;
*ima4:appl     &amp;quot;IMA 4:1&amp;quot;&lt;br /&gt;
*in24:appl     &amp;quot;24-bit Integer&amp;quot;&lt;br /&gt;
*in32:appl     &amp;quot;32-bit Integer&amp;quot;&lt;br /&gt;
*mp4a:appl     &amp;quot;MPEG-4 Audio&amp;quot;&lt;br /&gt;
*samr:appl     &amp;quot;AMR Narrowband&amp;quot;&lt;br /&gt;
*sowt:appl     &amp;quot;16-bit Little Endian&amp;quot;&lt;br /&gt;
*twos:appl     &amp;quot;16-bit Big Endian&amp;quot;&lt;br /&gt;
*ulaw:appl     &amp;quot;uLaw 2:1&amp;quot;&lt;br /&gt;
*.mp3:FhG      &amp;quot;MPEG Layer-3 Audio&amp;quot;&lt;br /&gt;
*MAC3:appl     &amp;quot;MACE 3:1&amp;quot;&lt;br /&gt;
*MAC6:appl     &amp;quot;MACE 6:1&amp;quot;&lt;br /&gt;
*QDM2:QDes     &amp;quot;QDesign Music 2&amp;quot;&lt;br /&gt;
*QDMC:QDes     &amp;quot;QDesign Music 1 Decoder&amp;quot;&lt;br /&gt;
*Qclp:QCOM     &amp;quot;Qualcomm PureVoice¬&amp;quot;&lt;br /&gt;
*Qclq:QCOM     &amp;quot;Qualcomm [[QCELP]]&amp;quot;&lt;br /&gt;
*TS..:TELE     &amp;quot;Microsoft ADPCM&amp;quot;&lt;br /&gt;
*TS..:TELE     &amp;quot;Microsoft G.711 aLaw&amp;quot;&lt;br /&gt;
*TS..:TELE     &amp;quot;Microsoft G.711 uLaw&amp;quot;&lt;br /&gt;
*TS..:TELE     &amp;quot;Microsoft IMA ADPCM&amp;quot;&lt;br /&gt;
*TS.E:TELE     &amp;quot;Microsoft G.726&amp;quot;&lt;br /&gt;
*TS.U:TELE     &amp;quot;Microsoft MPEG Layer-3&amp;quot;&lt;br /&gt;
*WMA1:TELE     &amp;quot;Windows Media Audio 7&amp;quot;&lt;br /&gt;
*WMA2:TELE     &amp;quot;Windows Media Audio 9 Standard&amp;quot;&lt;br /&gt;
*WMA3:TELE     &amp;quot;Windows Media Audio 9 Professional&amp;quot;&lt;br /&gt;
*agsm:appl     &amp;quot;Apple GSM 10:1&amp;quot;&lt;br /&gt;
*alac:appl     &amp;quot;Apple Lossless&amp;quot;&lt;br /&gt;
*alaw:appl     &amp;quot;ALaw 2:1&amp;quot;&lt;br /&gt;
*drms:appl     &amp;quot;DRM&amp;quot;&lt;br /&gt;
*dvca:appl     &amp;quot;DV&amp;quot;&lt;br /&gt;
*dvi :appl     &amp;quot;DVI 4:1&amp;quot;&lt;br /&gt;
*fl32:appl     &amp;quot;32-bit Floating Point&amp;quot;&lt;br /&gt;
*fl64:appl     &amp;quot;64-bit Floating Point&amp;quot;&lt;br /&gt;
*ima4:appl     &amp;quot;IMA 4:1&amp;quot;&lt;br /&gt;
*in24:appl     &amp;quot;24-bit Integer&amp;quot;&lt;br /&gt;
*in32:appl     &amp;quot;32-bit Integer&amp;quot;&lt;br /&gt;
*lpc :appl     &amp;quot;LPC 23:1&amp;quot;&lt;br /&gt;
*mp4a:appl     &amp;quot;MPEG-4 Audio&amp;quot;&lt;br /&gt;
*ms..:appl     &amp;quot;MS ADPCM&amp;quot;&lt;br /&gt;
*ms..:appl     &amp;quot;DVI IMA&amp;quot;&lt;br /&gt;
*ms.1:appl     &amp;quot;MS-GSM 6.10&amp;quot;&lt;br /&gt;
*ms.U:FhG      &amp;quot;MPEG Layer-3 Audio&amp;quot;&lt;br /&gt;
*samr:appl     &amp;quot;AMR Narrowband&amp;quot;&lt;br /&gt;
*sowt:appl     &amp;quot;16-bit Little Endian&amp;quot;&lt;br /&gt;
*twos:appl     &amp;quot;16-bit Big Endian&amp;quot;&lt;br /&gt;
*ulaw:appl     &amp;quot;?Law 2:1&amp;quot;&lt;br /&gt;
*vdva:appl     &amp;quot;DV&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Microsoft ID FOURCCs ===&lt;br /&gt;
&lt;br /&gt;
These FOURCCs indicate that the audio information stsd atom also transports a Microsoft-style [[WAVEFORMATEX]] header.&lt;br /&gt;
&lt;br /&gt;
* 'm', 's', 0x00, 0x02: [[Microsoft ADPCM]]&lt;br /&gt;
* 'm', 's', 0x00, 0x11: [[Microsoft IMA ADPCM]]&lt;br /&gt;
* 'm', 's', 0x00, 0x55: [[MP3]]&lt;br /&gt;
&lt;br /&gt;
== Technical Description ==&lt;br /&gt;
&lt;br /&gt;
The Apple Quicktime file format is an extremely well-defined file format. A little too well-defined, in fact. Some would even call it &amp;quot;over-engineered&amp;quot;. The official Quicktime documentation is a magnificently&lt;br /&gt;
detailed beast that gives equal time to explaining all parts of the spec, no matter how important or ignored a particular component may be in the actual implementation. The official spec can be a lot to digest at once and this document is intended to help interested programmers come up to&lt;br /&gt;
speed on the Quicktime internals much more quickly. &lt;br /&gt;
&lt;br /&gt;
This document emphasizes the components of the Quicktime file format that a programmer would need to know in order to write a general purpose Quicktime file decoder. This document also contains a discussion of&lt;br /&gt;
decoding strategies. &lt;br /&gt;
&lt;br /&gt;
Note that this document will probably never be complete since there is so much flexibility in the Quicktime format. But it is designed to cover the majority of QT files ever produced.&lt;br /&gt;
&lt;br /&gt;
=== Byte Ordering ===&lt;br /&gt;
&lt;br /&gt;
The first important fact to know about Quicktime files when writing a decoder is that all multi-byte numbers are big endian owing to Apple's Motorola heritage.&lt;br /&gt;
&lt;br /&gt;
=== Atoms: The Fundamental Quicktime Building Blocks ===&lt;br /&gt;
&lt;br /&gt;
Apple's Quicktime designers were thinking differently when they came up with the notion of an &amp;quot;atom&amp;quot; as &amp;quot;something that can contain other atoms&amp;quot;. Atoms are chunks of data in that comprise a Quicktime&lt;br /&gt;
file. Sometimes they contain data and sometimes they contain other atoms. &lt;br /&gt;
&lt;br /&gt;
An atom consists of a size, a type, and a data payload. An atom is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 bytes 0-3    atom size (including 8-byte size and type preamble)&lt;br /&gt;
 bytes 4-7    atom type&lt;br /&gt;
 bytes 8..n   data&lt;br /&gt;
&lt;br /&gt;
The 4 bytes allotted for the atom size field limit the maximum size of an atom to 4 GB. Quicktime also has a provision to allow atoms with 64-bit atom size fields by setting the size field 1 and adding the 8-byte size field after the atom type:&lt;br /&gt;
&lt;br /&gt;
 bytes 0-3    always 0x00000001&lt;br /&gt;
 bytes 4-7    atom type&lt;br /&gt;
 bytes 8-15   atom size (including 16-byte size and type preamble)&lt;br /&gt;
 bytes 16..n  data&lt;br /&gt;
&lt;br /&gt;
This is a logical exception since an atom always needs to be at least 8 bytes in length to account for the preamble. Therefore, if the size field is 1, load the 64-bit atom size from just after the atom type field.&lt;br /&gt;
&lt;br /&gt;
=== Known Top-Level Atoms ===&lt;br /&gt;
&lt;br /&gt;
These are all of the QuickTime atoms that are known to be legal top-level atoms.&lt;br /&gt;
&lt;br /&gt;
* 'moov'&lt;br /&gt;
* 'mdat'&lt;br /&gt;
* 'free'&lt;br /&gt;
* 'junk'&lt;br /&gt;
* 'pnot'&lt;br /&gt;
* 'skip'&lt;br /&gt;
* 'wide'&lt;br /&gt;
* 'pict'&lt;br /&gt;
* 'ftyp'&lt;br /&gt;
* 'uuid' : Used by Sony's MSNV brand of MP4&lt;br /&gt;
&lt;br /&gt;
=== QuickTime File Types ===&lt;br /&gt;
&lt;br /&gt;
Somewhere along the line the 'ftyp' atom was added as a possible top-level QuickTime atom. It is supposed to appear first in a QuickTime file. There are the known ftyp values:&lt;br /&gt;
&lt;br /&gt;
* 'qt  '&lt;br /&gt;
* 'isom'&lt;br /&gt;
* 'mp41'&lt;br /&gt;
* 'mp42'&lt;br /&gt;
* '3gp1'&lt;br /&gt;
* '3gp2'&lt;br /&gt;
* '3gp3'&lt;br /&gt;
* '3gp4'&lt;br /&gt;
* '3gp5'&lt;br /&gt;
* '3g2a'&lt;br /&gt;
* 'mmp4' : Mobile MPEG-4&lt;br /&gt;
* 'M4A '&lt;br /&gt;
* 'M4P '&lt;br /&gt;
* 'M4V '&lt;br /&gt;
* 'mjp2' : Motion JPEG 2000&lt;br /&gt;
* 'MSNV' : Sonys private brand; Used for example to encode MP4s for the PSP&lt;br /&gt;
&lt;br /&gt;
A more authoritative list can be found at http://ftyps.com/ .&lt;br /&gt;
&lt;br /&gt;
=== General File Organization ===&lt;br /&gt;
&lt;br /&gt;
In the abstract atom hierarchy, this is how a Quicktime file is laid out:&lt;br /&gt;
&lt;br /&gt;
 moov&lt;br /&gt;
   mvhd&lt;br /&gt;
   trak&lt;br /&gt;
     tkhd&lt;br /&gt;
     edts&lt;br /&gt;
       elst&lt;br /&gt;
     mdia&lt;br /&gt;
       mdhd&lt;br /&gt;
       minf&lt;br /&gt;
         stbl&lt;br /&gt;
           stsd&lt;br /&gt;
           stco&lt;br /&gt;
           co64&lt;br /&gt;
           stts&lt;br /&gt;
           stss&lt;br /&gt;
           stsc&lt;br /&gt;
           stsz&lt;br /&gt;
   trak&lt;br /&gt;
   trak&lt;br /&gt;
   ..&lt;br /&gt;
 mdat&lt;br /&gt;
   [data]&lt;br /&gt;
   [data]&lt;br /&gt;
   [...]&lt;br /&gt;
&lt;br /&gt;
Note that this is not an exhaustive tree of all possible or known atoms; these are only the atoms that have been empirically determined as &amp;quot;interesting&amp;quot; for the purposes of writing a general-purpose decoder that can handle most Quicktime files.&lt;br /&gt;
&lt;br /&gt;
All Quicktime files need to have a moov atom and a mdat atom at the top level. There are other top level atoms as well (e.g. the 'ftyp' atom), which generally are not interesting and can safely be skipped if encountered. The moov atom contains instructions for playing the data in the file. The mdat atom contains the data that will be played.&lt;br /&gt;
&lt;br /&gt;
=== Meta Data ===&lt;br /&gt;
&lt;br /&gt;
A 'meta' atom contains atoms containing human-readable textual data with meta information regarding the file. These atoms are marked with 4 bytes of course but the first byte is a value of 0xA9. The remaining 3 characters can be:&lt;br /&gt;
&lt;br /&gt;
* nam: Name of song or video&lt;br /&gt;
* cpy: Copyright information&lt;br /&gt;
* des: File description&lt;br /&gt;
* cmt: General comment&lt;br /&gt;
* alb: Album name&lt;br /&gt;
* gen: Custom Genre&lt;br /&gt;
* ART: Artist name&lt;br /&gt;
* too: Encoder&lt;br /&gt;
* wrt: Writer&lt;br /&gt;
* day: Content created year&lt;br /&gt;
&lt;br /&gt;
=== Decompressing Compressed moov Atoms With zlib ===&lt;br /&gt;
&lt;br /&gt;
The prospect of having to decode compressed moov atoms in Quicktime files seems to give many programmers pause. This need not be the case. When a compressed moov atom is detected, the free, open source [[zlib]] compression library can be called upon to do all the hard work.&lt;br /&gt;
&lt;br /&gt;
In the abstract atom hierarchy, a compressed moov atom is laid out like this:&lt;br /&gt;
&lt;br /&gt;
 moov&lt;br /&gt;
   cmov&lt;br /&gt;
     dcom&lt;br /&gt;
     cmvd&lt;br /&gt;
&lt;br /&gt;
On disk, a compressed moov atom will look this this:&lt;br /&gt;
&lt;br /&gt;
 bytes 0-3:   atom size (including 8-byte size and type preamble)&lt;br /&gt;
 bytes 4-7:   atom type ('moov', movie header)&lt;br /&gt;
 bytes 8-11:  atom size (including 8-byte size and type preamble)&lt;br /&gt;
 bytes 12-15: atom type ('cmov', compressed movie header)&lt;br /&gt;
 bytes 16-19: atom size (this should be 12 bytes)&lt;br /&gt;
 bytes 20-23: atom type ('dcom', decompressor)&lt;br /&gt;
 bytes 24-27: decompression library used (usually 'zlib')&lt;br /&gt;
 bytes 28-31: atom size (including 8-byte size and type preamble)&lt;br /&gt;
 bytes 32-35: atom type ('cmvd', compressed movie header data)&lt;br /&gt;
 bytes 36-39: size of decompressed data&lt;br /&gt;
 bytes 40-n:  compressed data&lt;br /&gt;
&lt;br /&gt;
Note that this structure makes it theoretically possible to use other libraries to compress moov atoms, but zlib is most commonly used.&lt;br /&gt;
&lt;br /&gt;
Here is a lazy algorithm for decompressing a compressed moov atom:&lt;br /&gt;
&lt;br /&gt;
# check if bytes 12-15 contain 'cmov'; if yes:&lt;br /&gt;
# allocate a buffer for the decompressed moov atom, the size of which is specified by bytes 36-39&lt;br /&gt;
# initialize the zlib library, initialize a z_stream structure with pointers to the compressed and decompressed buffers, and all the other necessary variables&lt;br /&gt;
# call zlib to decompress the atom&lt;br /&gt;
# free the compressed moov atom, process the newly-decompressed moov atom (which will begin with a proper size and 'moov' type)&lt;br /&gt;
&lt;br /&gt;
As an aside, one might wonder about the rationale behind compressing moov atoms. The data inside QT files can reach gargantuan sizes, and the moov atom will be rather tiny in comparison. Why bother saving a few tens of kilobytes on the moov atom? One suggestion I have received is data integrity: Compression with zlib offers CRC validation. If an error occurs in the data stream while transmitting the compressed moov atom, a problem will be detected during decompression.&lt;br /&gt;
&lt;br /&gt;
== Audio Handling ==&lt;br /&gt;
&lt;br /&gt;
=== Constant Bitrate Audio ===&lt;br /&gt;
&lt;br /&gt;
=== Constant Bitrate Audio Width Header ===&lt;br /&gt;
&lt;br /&gt;
=== Variable Bitrate Audio ===&lt;br /&gt;
&lt;br /&gt;
== Palette Handling ==&lt;br /&gt;
&lt;br /&gt;
== QuickTime Atom Reference ==&lt;br /&gt;
&lt;br /&gt;
=== cmov ===&lt;br /&gt;
{{QT_Atom|atomName=cmov|function=compressed moov atom|containedIn={{QT|moov}}|canContain={{QT|cmvd}}, {{QT|dcom}}}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== cmvd ===&lt;br /&gt;
{{QT_Atom|atomName=cmvd|function=compressed moov atom data|containedIn={{QT|cmov}}|canContain=''leaf atom''}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== co64 ===&lt;br /&gt;
{{QT_Atom|atomName=co64|function=64-bit chunk offsets|containedIn={{QT|stbl}}|canContain=''leaf atom''}}&lt;br /&gt;
The co64 atom for a track lists the offsets for the various chunks that comprise a media track. These offsets are absolute offsets within the file starting from offset 0. Note that this atom allows for 64-bit offsets which is necessary for QuickTime files exceeding 4 gigabytes. Smaller files can save space in this table by using the {{QT|stco}} atom which only allows for 32-bit offsets.&lt;br /&gt;
&lt;br /&gt;
  ''QT Atom Preamble''&lt;br /&gt;
  1 byte    version&lt;br /&gt;
  3 bytes   flags&lt;br /&gt;
  4 bytes   total entries in offset table (n)&lt;br /&gt;
  8 bytes   chunk offset 0&lt;br /&gt;
  8 bytes   chunk offset 1&lt;br /&gt;
   ..&lt;br /&gt;
   ..&lt;br /&gt;
  8 bytes   chunk offset n-1&lt;br /&gt;
&lt;br /&gt;
=== ctts ===&lt;br /&gt;
{{QT_Atom|atomName=ctts|containedIn={{QT|stbl}}}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== dcom ===&lt;br /&gt;
{{QT_Atom|atomName=dcom|function=compressed moov compression method|containedIn={{QT|cmov}}|canContain=''leaf atom''}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== edts ===&lt;br /&gt;
{{QT_Atom|atomName=edts|function=edit samples|containedIn={{QT|trak}}|canContain={{QT|elst}}}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== elst ===&lt;br /&gt;
{{QT_Atom|atomName=elst|function=edit list|containedIn={{QT|edts}}|canContain=''leaf atom''}}&lt;br /&gt;
The elst atom contains the edit list. The edit list contains information about the times and durations that pieces of a media track are to be presented during playback. There are many Quicktime file decoders that choose to ignore this atom. This is not a good idea. The edit list atom must be taken into account to guarantee proper A/V sync on certain files.&lt;br /&gt;
&lt;br /&gt;
An edit list atom has the following structure:&lt;br /&gt;
&lt;br /&gt;
  ''QuickTime Atom Preamble''&lt;br /&gt;
  1 byte    version&lt;br /&gt;
  3 bytes   flags&lt;br /&gt;
  4 bytes   number of edit list entries&lt;br /&gt;
   &amp;lt;edit list entries&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An individual edit list entry is 12 bytes in size and has the following structure:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-3   edit duration (in global timescale units)&lt;br /&gt;
  bytes 4-7   edit media time (in trak timescale units)&lt;br /&gt;
  bytes 8-11  playback speed&lt;br /&gt;
&lt;br /&gt;
=== esds ===&lt;br /&gt;
{{QT_Atom|atomName=esds|function=Elementary Stream Descriptors|containedIn=''tbd''|canContain=''tbd''}}&lt;br /&gt;
&lt;br /&gt;
=== free ===&lt;br /&gt;
{{QT_Atom|atomName=free|function=free space|containedIn=''top level''|canContain=''tbd''}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ftyp ===&lt;br /&gt;
{{QT_Atom|atomName=ftyp|function=file type|containedIn=''top level''|canContain=''tbd''}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== gmhd ===&lt;br /&gt;
{{QT_Atom|atomName=gmhd|function=generic media header|containedIn={{QT|minf}}|canContain=''leaf atom''}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== iods ===&lt;br /&gt;
{{QT_Atom|atomName=iods}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== junk ===&lt;br /&gt;
{{QT_Atom|atomName=junk|function=junk space|containedIn=''top level''|canContain=''tbd''}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== mdat ===&lt;br /&gt;
{{QT_Atom|atomName=mdat|function=media data|containedIn=''top level''|canContain=''media data''}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== mdhd ===&lt;br /&gt;
{{QT_Atom|atomName=mdhd|function=media header|containedIn={{QT|mdia}}|canContain=''leaf atom''}}&lt;br /&gt;
&lt;br /&gt;
The mdhd atom is the media header atom, containing some parameters for the current stream. There are at least two versions available of the mdhd atom (which can be found in the first byte after the preamble).&lt;br /&gt;
&lt;br /&gt;
An mdhd version 0 atom has the following structure:&lt;br /&gt;
&lt;br /&gt;
  ''QuickTime Atom Preamble''&lt;br /&gt;
  1 byte    version&lt;br /&gt;
  3 bytes   flags&lt;br /&gt;
  4 bytes   creation time&lt;br /&gt;
  4 bytes   modification time&lt;br /&gt;
  4 bytes   time scale&lt;br /&gt;
  4 bytes   duration&lt;br /&gt;
  2 bytes   language&lt;br /&gt;
  2 bytes   quality&lt;br /&gt;
&lt;br /&gt;
For version 1 instead a few entries have changed sizes from 4 to 8 bytes:&lt;br /&gt;
&lt;br /&gt;
  ''QuickTime Atom Preamble''&lt;br /&gt;
  1 byte    version&lt;br /&gt;
  3 bytes   flags&lt;br /&gt;
  8 bytes   creation time&lt;br /&gt;
  8 bytes   modification time&lt;br /&gt;
  4 bytes   time scale&lt;br /&gt;
  8 bytes   duration&lt;br /&gt;
  2 bytes   language&lt;br /&gt;
  2 bytes   quality&lt;br /&gt;
&lt;br /&gt;
The language value is a three letters ISO 639 language code represented with three 5-bit values (each of which is the ASCII value of the letter minus 0x60).&lt;br /&gt;
&lt;br /&gt;
=== mdia ===&lt;br /&gt;
{{QT_Atom|atomName=mdia|function=media|containedIn={{QT|trak}}|canContain={{QT|mdhd}}, {{QT|minf}}}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== minf ===&lt;br /&gt;
{{QT_Atom|atomName=minf|function=media information|containedIn={{QT|mdia}}|canContain={{QT|gmhd}}, {{QT|smhd}}, {{QT|stbl}}, {{QT|vmhd}}}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== moov ===&lt;br /&gt;
{{QT_Atom|atomName=moov|function=movie header|containedIn=''top level''|canContain={{QT|mvhd}}}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== mvhd ===&lt;br /&gt;
{{QT_Atom|atomName=mvhd|function=movie header|containedIn={{QT|moov}}|canContain=''tbd''}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== pict ===&lt;br /&gt;
{{QT_Atom|atomName=pict|containedIn=''top level''|canContain=''tbd''}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== pnot ===&lt;br /&gt;
{{QT_Atom|atomName=pnot|containedIn=''top level''|canContain=''tbd''}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== rdrf ===&lt;br /&gt;
{{QT_Atom|atomName=rdrf|function=data reference|containedIn={{QT|rmda}}|canContain=none allowed}}&lt;br /&gt;
This atom defines where the reference movie can be found. The location can be given as an alias or as a URL.&lt;br /&gt;
&lt;br /&gt;
Only one allowed data reference atom per movie reference descriptor atom.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== rmcd ===&lt;br /&gt;
{{QT_Atom|atomName=rmcd|function=component detect|containedIn={{QT|rmda}}|canContain=none allowed}}&lt;br /&gt;
This atom specifies required Quicktime components, such as codecs, needed and can also specify the minimum version of the component.&lt;br /&gt;
&lt;br /&gt;
Multiple component detect atoms are allowed in a reference movie descriptor atom and all minimum versions of all the components must be met.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== rmcs ===&lt;br /&gt;
{{QT_Atom|atomName=rmcs|function=CPU speed atom|containedIn={{QT|rmda}}|canContain=none allowed}}&lt;br /&gt;
&lt;br /&gt;
This atom describes the minimum amount of computer power required to play this reference movie. The computer power is given as a relative number on an unknown, from the documentation, scale. Examples from Apple's documentation include 100 being equivalent to a 166MHz Pentium and 500 for a 400MHz G4 PowerPC. The Apple documentation estimates that a gigahertz computer with a graphics accelerator might give a power number as high as 1000 and that future computers will allow even higher numbers. It seems that maybe this number isn't very useful since there doesn't seem to be anything to help determine what kind of computing power multi-gigahertz machines, that provide more computing power per Hz than previous generations did provides on this ill-defined scale.&lt;br /&gt;
&lt;br /&gt;
If the CPU speed atom is given then a computer that does not meet the specifications will play the reference movie with the next lower power requirement that it meets.&lt;br /&gt;
&lt;br /&gt;
An application should assume that the reference movie with the highest valued CPU speed will have the highest quality.&lt;br /&gt;
&lt;br /&gt;
Only one allowed CPU speed atom per movie reference descriptor atom.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== rmda ===&lt;br /&gt;
{{QT_Atom|atomName=rmda|function=reference movie descriptor atom|containedIn={{QT|rmra}}|canContain={{QT|rdrf}}, {{QT|rmdr}}, {{QT|rmcs}}, {{QT|rmvc}}, {{QT|rmcd}}, {{QT|rmqu}}}}&lt;br /&gt;
&lt;br /&gt;
The reference movie descriptor contains atoms that describe where to find an alternate movie. It also may contain atoms for items such as system requirements and movie quality.&lt;br /&gt;
&lt;br /&gt;
Multiple reference movie descriptors are usually found in a reference movie atom.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== rmdr ===&lt;br /&gt;
{{QT_Atom|atomName=rmdr|function=minimum data rate|containedIn={{QT|rmda}}|canContain=none allowed}}&lt;br /&gt;
The data rate atom indicates the minimum connection speed needed to display this reference movie. The data rate is given in bits per second.&lt;br /&gt;
&lt;br /&gt;
Only one data rate atom is allowed per container reference movie descriptor atom.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== rmqu ===&lt;br /&gt;
{{QT_Atom|atomName=rmqu|function=quality atom|containedIn={{QT|rmda}}|canContain=none allowed}}&lt;br /&gt;
The quality atom acts as a tie breaker. It gives a relative quality number that helps the application decide which reference movie to play if all other  quality-defining atoms are equal. A higher value indicates a higher quality.&lt;br /&gt;
&lt;br /&gt;
Only one quality atom is allowed per container reference movie descriptor atom.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== rmra ===&lt;br /&gt;
{{QT_Atom|atomName=rmra|function=reference movie|containedIn={{QT|moov}}|canContain={{QT|rmda}}}}&lt;br /&gt;
&lt;br /&gt;
The reference movie atom typically contains data about alternate movies. Which alternate movie plays depends upon conditions such as the system requirements listed in the contained atoms. There can be only one reference movie atom per movie.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== rmvc ===&lt;br /&gt;
{{QT_Atom|atomName=rmvc|function=version check|containedIn={{QT|rmda}}|canContain=none allowed}}&lt;br /&gt;
This atom indicates the minimum version of the software package, such as Quicktime or Quicktime VR, that is needed to play the reference movie. The application to match against is given as a Macintosh Gestalt type (e.g. 'qtim').&lt;br /&gt;
&lt;br /&gt;
Multiple version check atom are allowed per reference movie descriptor atom. The application must meet all minimum version check requirements to play the reference movie.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== skip ===&lt;br /&gt;
{{QT_Atom|atomName=skip|function=skipped space|containedIn=''top level''|canContain=''tbd''}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== smhd ===&lt;br /&gt;
{{QT_Atom|atomName=smhd|function=sound media header|containedIn={{QT|minf}}|canContain=''leaf atom''}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== stbl ===&lt;br /&gt;
{{QT_Atom|atomName=stbl|function=sample table|containedIn={{QT|minf}}|canContain={{QT|co64}}, {{QT|ctts}}, {{QT|stco}}, {{QT|stsc}}, {{QT|stsd}}, {{QT|stss}}, {{QT|stsz}}, {{QT|stts}}}}&lt;br /&gt;
&lt;br /&gt;
=== stco ===&lt;br /&gt;
{{QT_Atom|atomName=stco|function=sample table chunk offset|containedIn={{QT|stbl}}|canContain=''leaf atom''}}&lt;br /&gt;
The stco atom for a track lists the offsets for the various chunks that comprise a media track. These offsets are absolute offsets within the file starting from offset 0. Note that this atom only allows for 32-bit offsets. Files requiring 64-bit offsets must use the {{QT|co64}} atom.&lt;br /&gt;
&lt;br /&gt;
  ''QT Atom Preamble''&lt;br /&gt;
  1 byte    version&lt;br /&gt;
  3 bytes   flags&lt;br /&gt;
  4 bytes   total entries in offset table (n)&lt;br /&gt;
  4 bytes   chunk offset 0&lt;br /&gt;
  4 bytes   chunk offset 1&lt;br /&gt;
   ..&lt;br /&gt;
   ..&lt;br /&gt;
  4 bytes   chunk offset n-1&lt;br /&gt;
&lt;br /&gt;
=== stsc ===&lt;br /&gt;
{{QT_Atom|atomName=stsc|function=sample table sample to chunk map|containedIn={{QT|stbl}}|canContain=''leaf atom''}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== stsd ===&lt;br /&gt;
{{QT_Atom|atomName=stsd|function=sample table sample description|containedIn={{QT|stbl}}|canContain=''leaf atom''}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== stss ===&lt;br /&gt;
{{QT_Atom|atomName=stss|function=sample table sync samples|containedIn={{QT|stbl}}|canContain=''leaf atom''}}&lt;br /&gt;
&lt;br /&gt;
The stss atom is the sample table sync sample atom. This atom contains a list of all samples in the track that are marked as sync samples. Sync samples are also known as keyframes or intra-coded frames. These samples indicate which video frames can be completely decoded on their own, without any information from other video frames, thus making the frames safe to jump to randomly.&lt;br /&gt;
&lt;br /&gt;
An stss atom has the following structure:&lt;br /&gt;
&lt;br /&gt;
  ''QuickTime Atom Preamble''&lt;br /&gt;
  1 byte    version&lt;br /&gt;
  3 bytes   flags&lt;br /&gt;
  4 bytes   number of sync samples (n)&lt;br /&gt;
  4 bytes   sync sample 1&lt;br /&gt;
  4 bytes   sync sample 2&lt;br /&gt;
   ..&lt;br /&gt;
   ..&lt;br /&gt;
  4 bytes   sync sample n&lt;br /&gt;
&lt;br /&gt;
Each entry in the sync sample table indicates the ID of a sample that is a sync sample. Note that this table begins numbering from 1 rather than 0.&lt;br /&gt;
&lt;br /&gt;
As an example, if the stss atom of a video trak has 4 entries and those entries are 1, 9, 19, and 34, that means that video frames 1, 9, 19, and 34 (or 0, 8, 18, and 33 if your frames are numbered beginning at 0) are sync samples.&lt;br /&gt;
&lt;br /&gt;
If a trak has no stss atom then all of the samples in the track are implicitly sync samples.&lt;br /&gt;
&lt;br /&gt;
=== stsz ===&lt;br /&gt;
{{QT_Atom|atomName=stsz|function=sample table sizes|containedIn={{QT|stbl}}|canContain=''leaf atom''}}&lt;br /&gt;
&lt;br /&gt;
The stsz atom is the sample table size size atom. This atom contains the sizes of all of the samples in a trak.&lt;br /&gt;
&lt;br /&gt;
  ''QuickTime Atom Preamble''&lt;br /&gt;
  1 byte     version&lt;br /&gt;
  3 bytes    flags&lt;br /&gt;
  4 bytes    uniform size of each sample&lt;br /&gt;
  4 bytes    number of sample sizes (n)&lt;br /&gt;
  4 bytes    sample 0 size&lt;br /&gt;
  4 bytes    sample 1 size&lt;br /&gt;
   ..&lt;br /&gt;
   ..&lt;br /&gt;
  4 bytes    sample (n-1) size&lt;br /&gt;
&lt;br /&gt;
The stsz atom can operate in one of two modes. First, it is possible that all of the samples in a trak have the same size. In this case, the uniform size fieldis set to the constant size. The number of sample sizes field is set to the total number samples in the trak, and there is no sample size table following. This mode is commonly used in the stsz atom of audio traks. For example, in an audio file with length of 2 seconds that has a sample rate of 22050 Hz, the uniform size field will be set to 1, indicating that the the size of each sample is 1. The number of sample sizes field will be set to 44100 (22050 samples/sec * 2 sec = 44100 samples).&lt;br /&gt;
&lt;br /&gt;
In the second mode, all of the samples are a different size (logically, this mode would have to be used even if all of the samples were the same size except for one). In this case, the uniform size field is set to 0. The number of sample sizes field contains the number of entries in the sample size table. Each entry in the sample size table contains the size of a sample in the trak.&lt;br /&gt;
&lt;br /&gt;
=== stts ===&lt;br /&gt;
{{QT_Atom|atomName=stts|function=sample table time to sample map|containedIn={{QT|stbl}}|canContain=''leaf atom''}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== tkhd ===&lt;br /&gt;
{{QT_Atom|atomName=tkhd|function=track header|containedIn={{QT|trak}}|canContain=''leaf atom''}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== trak ===&lt;br /&gt;
{{QT_Atom|atomName=trak|function=track header|containedIn={{QT|moov}}|canContain={{QT|tkhd}}}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== uuid ===&lt;br /&gt;
{{QT_Atom|atomName=uuid|function=Used by the PSP MSNV brand of MP4|containedIn=''tbd''|canContain=''tbd''}}&lt;br /&gt;
&lt;br /&gt;
=== vmhd ===&lt;br /&gt;
{{QT_Atom|atomName=vmhd|function=video media header|containedIn={{QT|minf}}|canContain=''leaf atom''}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== wide ===&lt;br /&gt;
{{QT_Atom|atomName=wide|function=skipped data|containedIn=''top level''|canContain=''tbd''}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [http://developer.apple.com/documentation/QuickTime/QTFF/index.html Quicktime File Format Specification]&lt;br /&gt;
* [http://www.zlib.org zlib compression/decompression library]&lt;br /&gt;
* [http://www.itscj.ipsj.or.jp/sc29/open/29view/29n5245t.doc Advanced Video Coding (AVC) file format]&lt;br /&gt;
* [http://standards.iso.org/ittf/PubliclyAvailableStandards/c051533_ISO_IEC_14496-12_2008.zip ISO 14496 specifications]&lt;br /&gt;
* [http://le-hacker.org/hacks/mpeg-drafts/is144961cd.pdf ISO 14496 draft specifications]&lt;br /&gt;
* [http://www.mp4ra.org/atoms.html List of mp4/mov atoms]&lt;br /&gt;
* [http://www.geocities.com/xhelmboyx/quicktime/formats/mp4-layout.txt MP4 layout]&lt;br /&gt;
* [http://docs.info.apple.com/article.html?artnum=75424 Some different Quicktime codec samples.]&lt;br /&gt;
* [http://www.medialooks.com/products/directshow_filters/quicktime_filter.html QuickTime for DirectShow]&lt;br /&gt;
* [http://ftyps.com Complete List of all known MP4 / QuickTime 'ftyp' designations]&lt;br /&gt;
[[Category:Container Formats]]&lt;br /&gt;
* [http://wiki.awkwardtv.org/wiki/QT_Codec_Information QT Codec list]&lt;/div&gt;</summary>
		<author><name>Clone2727</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=SANM&amp;diff=12000</id>
		<title>SANM</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=SANM&amp;diff=12000"/>
		<updated>2009-10-15T19:05:40Z</updated>

		<summary type="html">&lt;p&gt;Clone2727: update Residual link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page attempts to document the [[LucasArts]] [[Smush]] v2 codec, FOURCC &amp;quot;SANM&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
A GPL'd decoder for the SNM format and relevant codecs can be found in the [http://residual.svn.sourceforge.net/viewvc/residual/residual/trunk/engines/grim/smush/ Residual] reimplementation of the Grim Fandango Engine (GrimE), although it is largely unreadable because it was converted from the original assembler code to C.&lt;br /&gt;
&lt;br /&gt;
= Samples =&lt;br /&gt;
* Grim Fandango: http://samples.mplayerhq.hu/game-formats/la-snm/grimfandango/&lt;br /&gt;
* Grim Fandango Demo uses older style videos (SAN, same codecs as Monkey Island 3) and 3D Models (text not binary format).&lt;br /&gt;
* X-Wing Alliance&lt;br /&gt;
* Find more games that use SNM.&lt;br /&gt;
== Unique Samples ==&lt;br /&gt;
The following Grim Fandango movies are unique in that they (used to) make the Residual smush implementation segfault, and the issue was (never) resolved by adding 5700 bytes of padding to some buffers. When writing a decoder, they may serve as helpful potential stress tests.&lt;br /&gt;
 lol.snm, byeruba.snm, crushed.snm, eldepot.snm, heltrain.snm, hostage.snm, tb_kitty.snm&lt;br /&gt;
&lt;br /&gt;
'''Note''' - The Residual implementation's segfaulting results in from improper breakdown of the destination image into 8x8 blocks, whereby the calculation will claim that an image with N height blocks has (N+1) height blocks (or similar), at which point the segfault is imminent. This can be solved by either trimming the remaining pixels that don't fit into the last 8x8 blocks (undesirable), or set the image buffer width/height to the image size in ''blocks * 8'', not ''pixels'', to account for said remaining pixels (desirable). We'll dismiss this as a Residual implementation issue.&lt;br /&gt;
&lt;br /&gt;
== Use in Grim Fandango ==&lt;br /&gt;
SANM is used in Grim Fandango for cut-scenes and in-game animations. The actual SNM movie files are gzipped and stored inside LAB archive files (which are quite easy to extract, there are many tools). You must use a tool like *nix's &amp;quot;gunzip&amp;quot; to decompress the SNM files after extracting the SNM files out of the LAB files. A decompressed Smush file has the &amp;quot;SANM&amp;quot; FOURCC as the first four bytes.&lt;br /&gt;
&lt;br /&gt;
= Organization =&lt;br /&gt;
This section deals with the structural properties of Smush movies. In other words, we describe the various headers used.&lt;br /&gt;
&lt;br /&gt;
'''Note''': each &amp;quot;chunk size&amp;quot; entry in a particular chunk header indicates the size of the chunk's contents ''without'' the chunk's FOURCC and size.&lt;br /&gt;
&lt;br /&gt;
== Preamble ==&lt;br /&gt;
The movie begins with a basic 8-byte section that looks like this:&lt;br /&gt;
&lt;br /&gt;
 0x00|&amp;quot;SANM&amp;quot; FOURCC        |4 bytes big endian&lt;br /&gt;
 0x04|Movie size (in bytes)|4 bytes big endian&lt;br /&gt;
&lt;br /&gt;
== Video Header ==&lt;br /&gt;
This header immediately follows the preamble. It describes the movie's video properties.&lt;br /&gt;
&lt;br /&gt;
 0x000|&amp;quot;SHDR&amp;quot; FOURCC             |4 bytes big endian&lt;br /&gt;
 0x004|Header size (in bytes)    |4 bytes big endian&lt;br /&gt;
 0x008|Version value 1           |1 byte&lt;br /&gt;
 0x009|Version value 2           |1 byte&lt;br /&gt;
 0x00A|# of frames               |2 bytes little endian&lt;br /&gt;
 0x00C|Video's x-coordinate      |2 bytes little endian&lt;br /&gt;
 0x00E|Video's y-coordinate      |2 bytes little endian&lt;br /&gt;
 0x010|Width                     |2 bytes little endian&lt;br /&gt;
 0x012|Height                    |2 bytes little endian&lt;br /&gt;
 0x014|Image type (see notes)    |2 bytes little endian&lt;br /&gt;
 0x016|Frame delay (microseconds)|4 bytes little endian&lt;br /&gt;
 0x01A|Maximal frame buffer size |4 bytes little endian&lt;br /&gt;
 0x01E|Color Palette             |256 colors, 4-bytes little endian each&lt;br /&gt;
 0x41E|Unused (see notes)        |16 bytes&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
* It appears as though the original decoder ignores the Frame delay field completely. Instead, all movies are played with a frame delay of 66667 microseconds. For now we ignore it and force the 66667 usec value, until we find a sample that breaks with this.&lt;br /&gt;
* Image type is &amp;quot;3&amp;quot; for all encountered samples so far. It might be helpful to assert() on this to easily single out samples that deviate from this.&lt;br /&gt;
* Looks like the original decoder ignores the last 16 bytes of the header.&lt;br /&gt;
&lt;br /&gt;
== Audio/Keyframe Header ==&lt;br /&gt;
Smush supports variable-size keyframes. An example of this usage can be seen in the Full Throttle highway chase scenes, where different images are composited into the streaming video depending on the player's actions.&lt;br /&gt;
&lt;br /&gt;
Curiously enough, this header includes both audio and keyframe information.&lt;br /&gt;
&lt;br /&gt;
 0x00|&amp;quot;FLHD&amp;quot; FOURCC         |4 bytes big endian&lt;br /&gt;
 0x04|Header size (in bytes)|4 bytes big endian&lt;br /&gt;
&lt;br /&gt;
Followed by any number of keyframe dimension chunks, which should match the number of keyframes in the movie. Dimension chunks in this header specify the dimensions of corresponding keyframes in the stream, in the order they're encountered. This information has not been rigorously verified, though.&lt;br /&gt;
 0x00|&amp;quot;Bl16&amp;quot; FOURCC         |4 bytes big endian&lt;br /&gt;
 0x04|Header size (in bytes)|4 bytes big endian&lt;br /&gt;
 0x08|Padding?              |2 bytes&lt;br /&gt;
 0x0A|Width                 |2 bytes little endian&lt;br /&gt;
 0x0C|Height                |2 bytes little endian&lt;br /&gt;
 0x0E|Padding?              |2 bytes&lt;br /&gt;
&lt;br /&gt;
Followed by exactly one audio info chunk.&lt;br /&gt;
 0x00|&amp;quot;Wave&amp;quot; FOURCC         |4 bytes big endian&lt;br /&gt;
 0x04|Header size (in bytes)|4 bytes big endian&lt;br /&gt;
 0x08|Frequency (Hz)        |4 bytes little endian&lt;br /&gt;
 0x0C|# of channels         |4 bytes little endian&lt;br /&gt;
 0x10|See notes             |4 bytes&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
* For some movies, the &amp;quot;Wave&amp;quot; chunk contains an extra 4-byte field at its end, the purpose of which is unknown.&lt;br /&gt;
* Movies without audio do not contain an audio info chunk.&lt;br /&gt;
* The order in which Wave/Bl16 chunks are organized in the FLHD header is unspecified and is known to vary between movies.&lt;br /&gt;
&lt;br /&gt;
== Annotation ==&lt;br /&gt;
Movies may contain an optional plaintext annotation. In Grim Fandango, the only such movies are in-game animations. Keep in mind that the string itself may not always be as large as the advertised annotation size. In that case, the remaining space is padded with zeros until the advertised length is reached.&lt;br /&gt;
&lt;br /&gt;
 0x00|&amp;quot;ANNO&amp;quot; FOURCC             |4 bytes big endian&lt;br /&gt;
 0x04|Annotation size (in bytes)|4 bytes big endian&lt;br /&gt;
 0x08|Null-terminated string    |(Annotation size) bytes&lt;br /&gt;
&lt;br /&gt;
== Frame ==&lt;br /&gt;
This header is used as a container for a video frame and/or an audio frame, stored in an arbitrary order. In itself, it's just a FOURCC and a size.&lt;br /&gt;
 0x00|&amp;quot;FRME&amp;quot; FOURCC        |4 bytes big endian&lt;br /&gt;
 0x04|Chunk size (in bytes)|4 bytes big endian&lt;br /&gt;
&lt;br /&gt;
=== Audio ===&lt;br /&gt;
Please see the appropriate section in [[VIMA]] for an audio frame's header/codec details. Note that as far as we know right now, this codec is specific to Grim Fandango Smush files.&lt;br /&gt;
&lt;br /&gt;
=== Video ===&lt;br /&gt;
This chunk stores a potentially encoded video frame, as well as various opcodes and other stuff that's used to decode it. More details downstairs.&lt;br /&gt;
 0x000|&amp;quot;Bl16&amp;quot; FOURCC            |4 bytes big endian&lt;br /&gt;
 0x004|Chunk size (in bytes)    |4 bytes big endian&lt;br /&gt;
 0x008|Unknown                  |8 bytes&lt;br /&gt;
 0x010|Width                    |4 bytes little endian&lt;br /&gt;
 0x014|Height                   |4 bytes little endian&lt;br /&gt;
 0x018|Sequence #               |2 bytes little endian&lt;br /&gt;
 0x01A|Subcodec ID              |1 byte&lt;br /&gt;
 0x01B|Diff buffer rotate code  |1 byte&lt;br /&gt;
 0x01C|Unknown                  |4 bytes&lt;br /&gt;
 0x020|Small codebook           |8 bytes, 4 color values 2 bytes little endian each&lt;br /&gt;
 0x028|Background colour        |2 bytes little endian&lt;br /&gt;
 0x02A|Unknown                  |2 bytes&lt;br /&gt;
 0x02C|RLE output size (bytes)  |4 bytes little endian&lt;br /&gt;
 0x030|Codebook                 |512 bytes, 256 color values each 2 bytes little endian&lt;br /&gt;
 0x230|Unknown                  |8 bytes&lt;br /&gt;
 0x238|Video stream             |...&lt;br /&gt;
&lt;br /&gt;
= Codec =&lt;br /&gt;
The codec is actually a combination of several subcodecs. The subcodec that's used for a particular frame is indicated by the appropriate field in the &amp;quot;Bl16&amp;quot; chunk of the frame.&lt;br /&gt;
&lt;br /&gt;
Decompressed pixels come in 16-bit little endian, using the &amp;quot;565&amp;quot; bit arrangmenet.&lt;br /&gt;
&lt;br /&gt;
== Triple Diff Buffering ==&lt;br /&gt;
Smush uses a triple diff buffer mechanism to decode image data. A decoder's state includes three buffers, which are occasionally referenced by various subcodecs to decode individual frames. We will hereafter refer to said buffers as &amp;quot;db0&amp;quot;, &amp;quot;db1&amp;quot;, and &amp;quot;db2&amp;quot;, where &amp;quot;db0&amp;quot; is the logical &amp;quot;current&amp;quot; diff buffer. It is crucial to note that &amp;quot;dbX&amp;quot; is only an ''alias'' to a particular diff buffer and does not stand for the ''contents'' of the buffer itself. In other words, it's a pointer. &lt;br /&gt;
&lt;br /&gt;
Each frame contains an opcode that specifies how said buffers are rotated. Only two opcodes are used. Any other opcodes are ignored as &amp;quot;no-ops.&amp;quot;&lt;br /&gt;
 Opcode 1:&lt;br /&gt;
    swap(db0, db2)&lt;br /&gt;
 Opcode 2:&lt;br /&gt;
    swap(db1, db2)&lt;br /&gt;
    swap(db2, db0) &lt;br /&gt;
&lt;br /&gt;
== Initial Setup ==&lt;br /&gt;
We need to initialize two codebooks of 4x4 and 8x8 glyphs. The glyphs themselves are monochrome and thus consist of a foreground and background. We hereafter refer to said codebooks as glyph4_cb and glyph8_cb.&lt;br /&gt;
&lt;br /&gt;
The construction algorithm iterates through two coordinate vectors, and interpolates an NxN glyph using every position in the x-vector with every position in the y-vector. Each vector contains 16 coordinates for a grand total of 256 glyphs per glyph size.&lt;br /&gt;
&lt;br /&gt;
The vectors are defined for 4x4 and 8x8 glyphs as follows.&lt;br /&gt;
 const int xvector4[] = { 0, 1, 2, 3, 3, 3, 3, 2, 1, 0, 0, 0, 1, 2, 2, 1 };&lt;br /&gt;
 const int yvector4[] = { 0, 0, 0, 0, 1, 2, 3, 3, 3, 3, 2, 1, 1, 1, 2, 2 };&lt;br /&gt;
&lt;br /&gt;
 const int xvector8[] = { 0, 2, 5, 7, 7, 7, 7, 7, 7, 5, 2, 0, 0, 0, 0, 0 };&lt;br /&gt;
 const int yvector8[] = { 0, 0, 0, 0, 1, 3, 4, 6, 7, 7, 7, 7, 6, 4, 3, 1 };&lt;br /&gt;
&lt;br /&gt;
Here's how we make 4x4 glyphs. The algorithm for 8x8 glyphs is intuitively analogous.&lt;br /&gt;
&lt;br /&gt;
 for i = 0..16&lt;br /&gt;
 {&lt;br /&gt;
    for j = 0..16&lt;br /&gt;
    {&lt;br /&gt;
       glyph[4][4] = all zeros&lt;br /&gt;
 &lt;br /&gt;
       vert1.x = xvector4[i]&lt;br /&gt;
       vert1.y = yvector4[i]&lt;br /&gt;
       vert2.x = xvector4[j]&lt;br /&gt;
       vert2.y = yvector4[j]&lt;br /&gt;
       &lt;br /&gt;
       edge1 = get_edge(vert1.x, vert1.y)&lt;br /&gt;
       edge2 = get_edge(vert2.x, vert2.y)&lt;br /&gt;
       direction = get_direction(edge1, edge2)&lt;br /&gt;
 &lt;br /&gt;
       width = largest side of line's bounding rectangle&lt;br /&gt;
       for each discrete point in _width_ points of our line (including the tips)&lt;br /&gt;
       {&lt;br /&gt;
          if direction is up, while row = point.y is &amp;gt;= 0, glyph[row--][point.x] = 1;&lt;br /&gt;
          if direction is down, while row = point.y is &amp;lt; 4, glyph[row++][point.x] = 1;&lt;br /&gt;
          if direction is left, while col = point.x is &amp;gt;= 0, glyph[point.y][col--] = 1;&lt;br /&gt;
          if direction is right, while col = point.x is &amp;lt; 4, glyph[point.y][col++] = 1;&lt;br /&gt;
       }&lt;br /&gt;
    &lt;br /&gt;
       codebook4.push_back(glyph) // order is important here, so yes, it's a push_back or equivalent&lt;br /&gt;
    }&lt;br /&gt;
 }  &lt;br /&gt;
&lt;br /&gt;
And here are the supplementary functions:&lt;br /&gt;
 get_edge(x, y)&lt;br /&gt;
 {&lt;br /&gt;
    if y == 0, return bottom_edge&lt;br /&gt;
    else if y == 3, return top_edge&lt;br /&gt;
    else if x == 0, return left_edge&lt;br /&gt;
    else if x == 3, return right_edge&lt;br /&gt;
    else, return no_edge&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 get_direction(2 edges)&lt;br /&gt;
 {&lt;br /&gt;
    if (edges are left/right or right/left) or (edges are bottom/!top or !top/bottom), return up&lt;br /&gt;
    else if (edges are !bottom/top or top/!bottom), return down&lt;br /&gt;
    else if (edges are left/!right or !right/left), return left,&lt;br /&gt;
    else if (edges are bottom/top or top/bottom) or (edges are right/!left or !left/right), return right&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== Main Algorithm ==&lt;br /&gt;
 if 0 == sequence number:&lt;br /&gt;
 {&lt;br /&gt;
    // this is a keyframe&lt;br /&gt;
    fill db1 and db2 with background color.&lt;br /&gt;
 }&lt;br /&gt;
 handle subcodec according to ID.&lt;br /&gt;
 copy contents of db0 into output image.&lt;br /&gt;
 rotate buffers according to opcode.&lt;br /&gt;
&lt;br /&gt;
== Subcodecs ==&lt;br /&gt;
This section explains what the individual subcodecs mean, and how to suck out image data in each case. Note that ImageSize, in bytes, is defined as (Width * Height * 2)&lt;br /&gt;
&lt;br /&gt;
 ID|What&lt;br /&gt;
  0|Keyframe. Copy ImageSize bytes from video stream into db0, loop by 16-bit values and reinterpret each one as little endian.&lt;br /&gt;
  1|Never encountered so far.&lt;br /&gt;
  2|Hierarchical VQ and motion compensation.&lt;br /&gt;
  3|Copy ImageSize bytes from db2 into db0.&lt;br /&gt;
  4|Copy ImageSize bytes from db1 into db0.&lt;br /&gt;
  5|RLE decode. See below.&lt;br /&gt;
  6|Simple lookup/write. See below.&lt;br /&gt;
  7|Never encountered so far.&lt;br /&gt;
  8|RLE-encoded codebook indices. See below.&lt;br /&gt;
&lt;br /&gt;
=== Subcodec 2 ===&lt;br /&gt;
This codec is broken up into a three-level hierarchy, where each level decodes differently sized image blocks. The decoding algorithms are chosen based on opcodes provided by the video stream. Block sizes are 8x8, 4x4, and 2x2. Even though different block sizes exist, one pass through the decoding algorithm will always(!) decode an 8x8 block by either decoding an entire 8x8 block, by breaking the 8x8 block into four 4x4 blocks (and decoding each one), or by breaking a 4x4 block into four 2x2 blocks (and decoding each one). Any combination of said breakdown is possible and is up to the video stream.&lt;br /&gt;
 &lt;br /&gt;
* We indicate the current x/y coordinates in db0 by &amp;quot;cx&amp;quot; and &amp;quot;cy&amp;quot;, respectively. &lt;br /&gt;
* We assume that two-dimensional arrays are row-major. That is, to access pixel(s) (x, y) at array, we write array[y][x]. &lt;br /&gt;
&lt;br /&gt;
Decoding is done by breaking the image into 8x8 blocks (rounding up where appropriate), and starting at the top, decoding each row from left to right with Level1. (Level1 will invoke any required levels, as described below.) For example:&lt;br /&gt;
 int hblocks = round Height to next multiple of 8&lt;br /&gt;
 int wblocks = round Width to next multiple of 8&lt;br /&gt;
 &lt;br /&gt;
 cy = 0&lt;br /&gt;
 for hblock in range(0, hblocks)&lt;br /&gt;
 {&lt;br /&gt;
    cx = 0 // beginning of row&lt;br /&gt;
    for wblock in range(0, wblocks)&lt;br /&gt;
    {&lt;br /&gt;
       level1(cx, cy)&lt;br /&gt;
       cx += 8 // 8 pixels right&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    cy += 8 // 8 pixels down&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now describe the decoding algorithm for each opcode, per level. The general decoding algorithm of a level looks like this:&lt;br /&gt;
 opcode = next byte in stream&lt;br /&gt;
 handle opcode (see below)&lt;br /&gt;
&lt;br /&gt;
==== Level 1 (8x8 blocks) ====&lt;br /&gt;
===== 0x00 ... 0xF4 =====&lt;br /&gt;
 x, y = motion_vectors[opcode]&lt;br /&gt;
 copy 8x8 block from db2[y + cy][x + cx] to db0[cy][cx]&lt;br /&gt;
&lt;br /&gt;
===== 0xF5 =====&lt;br /&gt;
 motion_vector = next 2 bytes of stream, little endian&lt;br /&gt;
 x = motion_vector % image_width&lt;br /&gt;
 y = motion_vector / image_width&lt;br /&gt;
 copy 8x8 block from (db2[y + cy][x + cx]) to db0[cy][cx]&lt;br /&gt;
&lt;br /&gt;
===== 0xF6 =====&lt;br /&gt;
 copy 8x8 block from db1[cy][cx] to db0[cy][cx]&lt;br /&gt;
&lt;br /&gt;
===== 0xF7 =====&lt;br /&gt;
 glyph8_index = next byte of stream&lt;br /&gt;
 indices = next 2 bytes of stream, little endian&lt;br /&gt;
 fg_index = hi8bits(indices)&lt;br /&gt;
 bg_index = lo8bits(indices)&lt;br /&gt;
 fgcolor = codebook[fg_index]&lt;br /&gt;
 bgcolor = codebook[bg_index]    &lt;br /&gt;
 draw 8x8 glyph from glyph8_cb[glyph8_index] into db0[cy][cx] using fgcolor and bgcolor&lt;br /&gt;
&lt;br /&gt;
===== 0xF8 =====&lt;br /&gt;
 glyph8_index = next byte of stream&lt;br /&gt;
 colors = next 4 bytes of stream, little endian&lt;br /&gt;
 fgcolor = hi16bits(colors)&lt;br /&gt;
 bgcolor = lo16bits(colors)   &lt;br /&gt;
 draw 8x8 glyph from glyph8_cb[glyph8_index] into db0[cy][cx] using fgcolor and bgcolor&lt;br /&gt;
&lt;br /&gt;
===== 0xF9, 0xFA, 0xFB, 0xFC =====&lt;br /&gt;
 color = value from small_codebook[opcode - 0xf9], little endian&lt;br /&gt;
 fill 8x8 block in db0[cy][cx] with color&lt;br /&gt;
&lt;br /&gt;
===== 0xFD =====&lt;br /&gt;
 index = value of next byte in stream&lt;br /&gt;
 color = value from codebook[index], little endian&lt;br /&gt;
 fill 8x8 block in db0[cy][cx] with color&lt;br /&gt;
&lt;br /&gt;
===== 0xFE =====&lt;br /&gt;
 color = next 2 bytes in stream, little endian&lt;br /&gt;
 fill 8x8 block in db0[cy][cx] with color&lt;br /&gt;
&lt;br /&gt;
===== 0xFF =====&lt;br /&gt;
This effectively breaks this block up into four 4x4 blocks and invokes the next level to decode them.&lt;br /&gt;
 next_level(cx    , cy)&lt;br /&gt;
 next_level(cx + 4, cy)&lt;br /&gt;
 next_level(cx    , cy + 4)&lt;br /&gt;
 next_level(cx + 4, cy + 4)&lt;br /&gt;
&lt;br /&gt;
==== Level 2 (4x4 blocks) ====&lt;br /&gt;
Exactly the same as Level 1, except with 4x4 blocks.&lt;br /&gt;
&lt;br /&gt;
==== Level 3 (2x2 blocks) ====&lt;br /&gt;
Same as the other levels except with 2x2 blocks, and with the following differences.&lt;br /&gt;
&lt;br /&gt;
===== 0xF7 =====&lt;br /&gt;
 indices[2][2] = next 4 bytes of stream, little endian&lt;br /&gt;
 write a 2x2 block into db0[cy][cx] using codebook[indices[][]] for colors&lt;br /&gt;
&lt;br /&gt;
===== 0xF8, 0xFF =====&lt;br /&gt;
 db0[cy][cx] = next 2 bytes of stream, little endian&lt;br /&gt;
 db0[cy][cx + 1] = next 2 bytes of stream, little endian&lt;br /&gt;
 db0[cy + 1][cx] = next 2 bytes of stream, little endian&lt;br /&gt;
 db0[cy + 1][cx + 1] = next 2 bytes of stream, little endian&lt;br /&gt;
&lt;br /&gt;
=== Subcodec 5 ===&lt;br /&gt;
This is an RLE scheme.&lt;br /&gt;
 size = RLE output size field from Bl16 header&lt;br /&gt;
 rle_decode(db0, video stream, size)&lt;br /&gt;
 for each 16-bit value of (size / 2) values starting at db0&lt;br /&gt;
 {&lt;br /&gt;
    little_endian(value)&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
And here's the routine itself:&lt;br /&gt;
 rle_decode(dst, src, const size)&lt;br /&gt;
 {&lt;br /&gt;
    remaining = size&lt;br /&gt;
    while (remaining)&lt;br /&gt;
    {&lt;br /&gt;
       code = next byte of stream&lt;br /&gt;
       line_length = (code &amp;gt;&amp;gt; 1) + 1&lt;br /&gt;
  &lt;br /&gt;
       if (code &amp;amp; 1) // RLE run&lt;br /&gt;
       {&lt;br /&gt;
          color = next byte of input stream&lt;br /&gt;
          fill line_length bytes in dst with color&lt;br /&gt;
       }&lt;br /&gt;
       else // raw image data&lt;br /&gt;
       {&lt;br /&gt;
          copy line_length bytes from src into dst&lt;br /&gt;
       }&lt;br /&gt;
    &lt;br /&gt;
       remaining -= line_length&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Subcodec 6 ===&lt;br /&gt;
This is a straightforward codebook lookup/write routine.&lt;br /&gt;
 for each pixel in db0:&lt;br /&gt;
 {&lt;br /&gt;
    index = value of next byte in video stream;&lt;br /&gt;
    pixel = (2 bytes little endian) codebook[index];&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Subcodec 8 ===&lt;br /&gt;
Used by loladies.snm, and repmec3c.snm.&lt;br /&gt;
&lt;br /&gt;
Another RLE scheme, where the actual indices into the codebook are RLE-compressed. The decompression algorithm uses the same RLE decoding as in Subcodec 5.&lt;br /&gt;
 indices = []&lt;br /&gt;
 rle_decode(indices, video stream, width * height)&lt;br /&gt;
 for each pixel in db0, i in range(0, indices.size())&lt;br /&gt;
 {&lt;br /&gt;
    pixel = codebook[indices[i]], as little endian&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
= Appendix A: Motion Vectors =&lt;br /&gt;
This is the static motion vector table used in Subcodec 2. Each element is an (x, y) pair.&lt;br /&gt;
 int motion_vectors[256][2] =&lt;br /&gt;
 {&lt;br /&gt;
    {0,   0}, {-1, -43}, {6, -43},  {-9, -42},  {13, -41},&lt;br /&gt;
    {-16, -40},  {19, -39}, {-23, -36},  {26, -34},  {-2, -33},&lt;br /&gt;
    {4, -33}, {-29, -32},  {-9, -32},  {11, -31}, {-16, -29},&lt;br /&gt;
    {32, -29},  {18, -28}, {-34, -26}, {-22, -25},  {-1, -25},&lt;br /&gt;
    {3, -25},  {-7, -24},   {8, -24},  {24, -23},  {36, -23},&lt;br /&gt;
    {-12, -22},  {13, -21}, {-38, -20},   {0, -20}, {-27, -19},&lt;br /&gt;
    {-4, -19},   {4, -19}, {-17, -18},  {-8, -17},   {8, -17},&lt;br /&gt;
    {18, -17},  {28, -17},  {39, -17}, {-12, -15},  {12, -15},&lt;br /&gt;
    {-21, -14},  {-1, -14},   {1, -14}, {-41, -13},  {-5, -13},&lt;br /&gt;
    {5, -13},  {21, -13}, {-31, -12}, {-15, -11},  {-8, -11},&lt;br /&gt;
    {8, -11},  {15, -11},  {-2, -10},   {1, -10},  {31, -10},&lt;br /&gt;
    {-23,  -9}, {-11,  -9},  {-5,  -9},   {4,  -9},  {11,  -9},&lt;br /&gt;
    {42,  -9},   {6,  -8},  {24,  -8}, {-18,  -7},  {-7,  -7},&lt;br /&gt;
    {-3,  -7},  {-1,  -7},   {2,  -7},  {18,  -7}, {-43,  -6},&lt;br /&gt;
    {-13,  -6},  {-4,  -6},   {4,  -6},   {8,  -6}, {-33,  -5},&lt;br /&gt;
    {-9,  -5},  {-2,  -5},   {0,  -5},   {2,  -5},   {5,  -5},&lt;br /&gt;
    {13,  -5}, {-25,  -4},  {-6,  -4},  {-3,  -4},   {3,  -4},&lt;br /&gt;
    {9,  -4}, {-19,  -3},  {-7,  -3},  {-4,  -3},  {-2,  -3},&lt;br /&gt;
    {-1,  -3},   {0,  -3},   {1,  -3},   {2,  -3},   {4,  -3},&lt;br /&gt;
    {6,  -3},  {33,  -3}, {-14,  -2}, {-10,  -2},  {-5,  -2},&lt;br /&gt;
    {-3,  -2},  {-2,  -2},  {-1,  -2},   {0,  -2},   {1,  -2},&lt;br /&gt;
    {2,  -2},   {3,  -2},   {5,  -2},   {7,  -2},  {14,  -2},&lt;br /&gt;
    {19,  -2},  {25,  -2},  {43,  -2},  {-7,  -1},  {-3,  -1},&lt;br /&gt;
    {-2,  -1},  {-1,  -1},   {0,  -1},   {1,  -1},   {2,  -1},&lt;br /&gt;
    {3,  -1},  {10,  -1},  {-5,   0},  {-3,   0},  {-2,   0},&lt;br /&gt;
    {-1,   0},   {1,   0},   {2,   0},   {3,   0},   {5,   0},&lt;br /&gt;
    {7,   0}, {-10,   1},  {-7,   1},  {-3,   1},  {-2,   1},&lt;br /&gt;
    {-1,   1},   {0,   1},   {1,   1},   {2,   1},   {3,   1},&lt;br /&gt;
    {-43,   2}, {-25,   2}, {-19,   2}, {-14,   2},  {-5,   2},&lt;br /&gt;
    {-3,   2},  {-2,   2},  {-1,   2},   {0,   2},   {1,   2},&lt;br /&gt;
    {2,   2},   {3,   2},   {5,   2},   {7,   2},  {10,   2},&lt;br /&gt;
    {14,   2}, {-33,   3},  {-6,   3},  {-4,   3},  {-2,   3},&lt;br /&gt;
    {-1,   3},   {0,   3},   {1,   3},   {2,   3},   {4,   3},&lt;br /&gt;
    {19,   3},  {-9,   4},  {-3,   4},   {3,   4},   {7,   4},&lt;br /&gt;
    {25,   4}, {-13,   5},  {-5,   5},  {-2,   5},   {0,   5},&lt;br /&gt;
    {2,   5},   {5,   5},   {9,   5},  {33,   5},  {-8,   6},&lt;br /&gt;
    {-4,   6},   {4,   6},  {13,   6},  {43,   6}, {-18,   7},&lt;br /&gt;
    {-2,   7},   {0,   7},   {2,   7},   {7,   7},  {18,   7},&lt;br /&gt;
    {-24,   8},  {-6,   8}, {-42,   9}, {-11,   9},  {-4,   9},&lt;br /&gt;
    {5,   9},  {11,   9},  {23,   9}, {-31,  10},  {-1,  10},&lt;br /&gt;
    {2,  10}, {-15,  11},  {-8,  11},   {8,  11},  {15,  11},&lt;br /&gt;
    {31,  12}, {-21,  13},  {-5,  13},   {5,  13},  {41,  13},&lt;br /&gt;
    {-1,  14},   {1,  14},  {21,  14}, {-12,  15},  {12,  15},&lt;br /&gt;
    {-39,  17}, {-28,  17}, {-18,  17},  {-8,  17},   {8,  17},&lt;br /&gt;
    {17,  18},  {-4,  19},   {0,  19},   {4,  19},  {27,  19},&lt;br /&gt;
    {38,  20}, {-13,  21},  {12,  22}, {-36,  23}, {-24,  23},&lt;br /&gt;
    {-8,  24},   {7,  24},  {-3,  25},   {1,  25},  {22,  25},&lt;br /&gt;
    {34,  26}, {-18,  28}, {-32,  29},  {16,  29}, {-11,  31},&lt;br /&gt;
    {9,  32},  {29,  32},  {-4,  33},   {2,  33}, {-26,  34},&lt;br /&gt;
    {23,  36}, {-19,  39},  {16,  40}, {-13,  41},   {9,  42},&lt;br /&gt;
    {-6,  43},   {1,  43},   {0,   0},   {0,   0},   {0,   0}&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
[[Category:Game Formats]]&lt;br /&gt;
[[Category:Video Codecs]]&lt;br /&gt;
[[Category: Video FourCCs]]&lt;br /&gt;
[[Category:Formats missing in FFmpeg]]&lt;/div&gt;</summary>
		<author><name>Clone2727</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Sega_FILM&amp;diff=11907</id>
		<title>Sega FILM</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Sega_FILM&amp;diff=11907"/>
		<updated>2009-08-22T19:01:11Z</updated>

		<summary type="html">&lt;p&gt;Clone2727: /* Games That Use FILM Files */ Phantasm uses three different versions of Sega FILM&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''This page is based on the document 'Description of the Sega FILM/CPK File Format' by Mike Melanson found at [http://multimedia.cx/film-format.txt http://multimedia.cx/film-format.txt].''&lt;br /&gt;
&lt;br /&gt;
* Extensions: cpk, cak, film&lt;br /&gt;
* Company: [[Sega (Company)|Sega]]&lt;br /&gt;
* Samples:&lt;br /&gt;
** [http://samples.mplayerhq.hu/game-formats/film-cpk/ http://samples.mplayerhq.hu/game-formats/film-cpk/]&lt;br /&gt;
** Batman and Robin Sega CD with 'Seg4' data: [http://samples.mplayerhq.hu/game-formats/segacd/batmanandrobin-film-seg4/ http://samples.mplayerhq.hu/game-formats/segacd/batmanandrobin-film-seg4/]&lt;br /&gt;
** Dracula Unleashed/Sega CD: [http://samples.mplayerhq.hu/game-formats/segacd/dracula-unleashed-film/ http://samples.mplayerhq.hu/game-formats/segacd/dracula-unleashed-film/]&lt;br /&gt;
** Jurassic Park/Sega CD: [http://samples.mplayerhq.hu/game-formats/segacd/jurassicpark-film/ http://samples.mplayerhq.hu/game-formats/segacd/jurassicpark-film/]&lt;br /&gt;
&lt;br /&gt;
FILM is a multimedia container file format developed by Sega for use on its early CD-ROM home video game consoles. Based on analysis of a number of Sega CD and Saturn games, it appears that the format was first developed sometime during the era of the Sega CD, Sega's first CD-based video game console. There are many early variations of the FILM format observed on a number of Sega CD titles. Further, early FILM files have been observed on at least one 3DO game ([http://www.mobygames.com/game/3do/lemmings Lemmings]).&lt;br /&gt;
&lt;br /&gt;
The Sega Saturn video game console, released in 1994, was also CD-ROM-based and apparently offered developers a standardized SDK for full motion video (FMV) playback using a modified variant of the well-known [[Cinepak]] video codec.&lt;br /&gt;
&lt;br /&gt;
It is possible to store both audio and video in a FILM file. Alternatively, the format is able to handle either video without audio, or vice versa.&lt;br /&gt;
 &lt;br /&gt;
== Sega Saturn CPK File Format ==&lt;br /&gt;
&lt;br /&gt;
All multi-byte numbers are stored in big endian format.&lt;br /&gt;
&lt;br /&gt;
Many Sega Saturn CD-ROM games use this file format to store frames of a Cinepak-compressed video interleaved with uncompressed [[PCM]] audio. When this is the case, the files will typically have the extension .CPK (which is why FILM files are usually known as CPK files). Sometimes, audio-only FILM files will have a .SND extension.&lt;br /&gt;
&lt;br /&gt;
The general format is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 +-----------------------+&lt;br /&gt;
 | +-------------------+ |&lt;br /&gt;
 | | FILM header       | |&lt;br /&gt;
 | |                   | |&lt;br /&gt;
 | | +---------------+ | |&lt;br /&gt;
 | | | FDSC chunk    | | |&lt;br /&gt;
 | | +---------------+ | |&lt;br /&gt;
 | |                   | |&lt;br /&gt;
 | | +---------------+ | |&lt;br /&gt;
 | | | STAB chunk    | | |&lt;br /&gt;
 | | +---------------+ | |&lt;br /&gt;
 | |                   | |&lt;br /&gt;
 | +-------------------+ |&lt;br /&gt;
 |                       |&lt;br /&gt;
 | Audio or Video Data   |&lt;br /&gt;
 |  ..                   |&lt;br /&gt;
 |  ..                   |&lt;br /&gt;
 +-----------------------+&lt;br /&gt;
&lt;br /&gt;
A FILM file will usually consist of a header followed by interleaved audio and video chunks. The FILM header has the following structure:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-3    'FILM' signature&lt;br /&gt;
  bytes 4-7    length of FILM header (including signature and length&lt;br /&gt;
               fields)&lt;br /&gt;
  bytes 8-11   FILM format version in ASCII (ex: '1.01' or '1.07')&lt;br /&gt;
  bytes 12-15  unknown (may be reserved and set to 0)&lt;br /&gt;
  bytes 16-n   remainder of FILM header&lt;br /&gt;
&lt;br /&gt;
Different Sega Saturn games include FILM files with a variety of FILM version numbers. Sometimes, the same game will include FILM files with a variety of format versions. A version number implies that there has been some change to the file format, but I have yet to observe any differences between different FILM file versions (except possibly for version '1.09'; see STAB chunk for more details).&lt;br /&gt;
&lt;br /&gt;
The remainder of the FILM header contains a number of chunks describing the media data in the file. Usually, the number of chunks is 2: A FDSC chunk and a STAB chunk.&lt;br /&gt;
&lt;br /&gt;
A FDSC chunk contains file description information. The chunk format is as follows:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-3    'FDSC' chunk signature&lt;br /&gt;
  bytes 4-7    length of FDSC chunk (including signature and length&lt;br /&gt;
               fields); an FDSC chunk should be 32 (0x20) bytes long&lt;br /&gt;
  bytes 8-11   FOURCC of video codec (usually 'cvid' for Cinepak or null&lt;br /&gt;
               for no video)&lt;br /&gt;
  bytes 12-15  height of video frames&lt;br /&gt;
  bytes 16-19  width of video frames&lt;br /&gt;
  byte 20      unknown, but always seems to be 0x18 (24)&lt;br /&gt;
  byte 21      number of audio channels&lt;br /&gt;
  byte 22      audio sampling resolution in bits (either 8 or 16)&lt;br /&gt;
  byte 23      unknown&lt;br /&gt;
  bytes 24-25  audio sampling frequency in Hz&lt;br /&gt;
  bytes 26-31  unknown (may be reserved and set to 0)&lt;br /&gt;
&lt;br /&gt;
Note that the height field precedes the width field, which is unusual since width usually precedes height when expressing video resolution.&lt;br /&gt;
&lt;br /&gt;
The fields pertaining to audio (channels, bits, and sample rate) will all be 0 if there is no audio present in the file.&lt;br /&gt;
&lt;br /&gt;
A STAB chunk contains a table of media sample information. The chunk format is as follows:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-3    'STAB' chunk signature&lt;br /&gt;
  bytes 4-7    length of STAB chunk (including signature and length&lt;br /&gt;
               fields)&lt;br /&gt;
  bytes 8-11   framerate base frequency in Hz&lt;br /&gt;
  bytes 12-15  number of entries in the sample table&lt;br /&gt;
  bytes 16-n   sample table&lt;br /&gt;
&lt;br /&gt;
Note that the length field ought to take the first 16 chunk bytes into account. However, it has been observed from some games (notably [http://www.mobygames.com/game/saturn/burning-rangers Burning Rangers] using '1.09' version FILM files) that the length field sometimes does not account for these 16 bytes.&lt;br /&gt;
&lt;br /&gt;
The sample table consists of a series of 16-byte sample records. Each record is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-3    offset of sample chunk from beginning of sample data&lt;br /&gt;
  bytes 4-7    length of sample chunk&lt;br /&gt;
  bytes 8-11   sample info 1&lt;br /&gt;
  bytes 12-15  sample info 2&lt;br /&gt;
&lt;br /&gt;
The offset is the offset from the start of the sample data, not the absolute offset in the file. The length of the FILM header implicitly serves as a pointer to the beginning of the sample data in the file.&lt;br /&gt;
&lt;br /&gt;
If the sample info 1 field is set to all ones, the sample is an audio chunk. Otherwise, it is a video chunk. If it is a video chunk, the top bit of the 32-bit number specifies whether the chunk is an inter-coded or an intra-coded frame. 0=intra-coded (a.k.a. keyframe), 1=inter-coded. This is useful for seeking since it is a good idea to only jump to key frames when seeking through a file.&lt;br /&gt;
&lt;br /&gt;
The rest of the first sample info field and the second sample info field pertain to framerate calculation. Refer to the section on FILM framerate calculation for more information on proper FILM playback using these sample info fields.&lt;br /&gt;
&lt;br /&gt;
== FILM Framerate Calculation ==&lt;br /&gt;
&lt;br /&gt;
The STAB chunk contains a framerate base frequency in bytes 8-11. This frequency is expressed in ticks/second (Hz). Every video chunk has a frame tick count. For example, movie files in Panzer Dragoon I &amp;amp; II (FILM format versions 1.04 and 1.07, respectively) have a base frequency of 600 Hz. The frames have tick counts of 0, 20, 40, 60, 80, etc. Thus, there are 20 ticks between each successive frame.&lt;br /&gt;
&lt;br /&gt;
  (600 ticks/sec) / (20 ticks/frame) = 30 frames/second&lt;br /&gt;
&lt;br /&gt;
However, not all FILM files exhibit such a nice, even framerate. Myst, for example, contains FILM files (version 1.01) with a base frequency of 30 Hz. Some of the frames skip 2, then 3 ticks. Here's a sample tick count progression: 0, 2, 5, 7, 10, 12, 15, 17...&lt;br /&gt;
&lt;br /&gt;
Each STAB record has 2 32-bit sample info fields. For an audio chunk, sample info 1 is all ones and sample info 2 is always 1. For a video chunk, sample info 1 contains the keyframe bit (as described in the STAB section) and the absolute timestamp in clock ticks of the video frame with respect to the file's base frequency clock. The sample info 2 field contains the number of clock ticks until the next frame is rendered. This type of information would be particularly useful in an interrupt-driven, real-time multimedia system like, for instance, a video game console (such as the Sega Saturn).&lt;br /&gt;
&lt;br /&gt;
It is important to note that an application that knows how to play FILM files can not assume a constant framerate. The files will not play correctly with such a method. It is also important to note that&lt;br /&gt;
converting FILM files to file formats that only support constant framerates (such as AVI) is not a winning strategy. The converted file will not play correctly.&lt;br /&gt;
&lt;br /&gt;
== FILM Deviant Cinepak (CVID) Video Data ==&lt;br /&gt;
&lt;br /&gt;
The Cinepak data inside of a FILM file can not be decoded with a general purpose Cinepak decoding algorithm. It is reasonable to think that this was no accident. If FILM files contained standard CVID data, the files could be played on any computer that had some kind of Cinepak decoder implementation.&lt;br /&gt;
&lt;br /&gt;
This document assumes familiarity with the [[Cinepak]] algorithm.&lt;br /&gt;
&lt;br /&gt;
A CVID chunk is supposed to start with a 10-byte chunk header:&lt;br /&gt;
&lt;br /&gt;
  byte 0     flags&lt;br /&gt;
  bytes 1-3  length of CVID data&lt;br /&gt;
  bytes 4-5  width of coded frame&lt;br /&gt;
  bytes 6-7  height of coded frame&lt;br /&gt;
  bytes 8-9  number of coded strips&lt;br /&gt;
&lt;br /&gt;
Following the chunk header ought to be the first byte of the first strip header. In the deviant CVID data stored in a FILM file, there appear to be an extra 2 bytes at the end of the chunk header, bringing the total header size to 12 bytes.&lt;br /&gt;
&lt;br /&gt;
The length of the chunk as reported by the deviant CVID data chunk is also incorrect. The length field is supposed to report the length of the entire chunk including the header. The deviant CVID data reports a length that is 8 bytes too short. That is, the length reported in the CVID chunk is 8 bytes shorter than the length reported in the corresponding record of the FILM file's STAB chunk. The STAB chunk length takes into account the proper length, including the extra 2 bytes at the end of the chunk header.&lt;br /&gt;
&lt;br /&gt;
Finally, the deviant CVID data appears to throw a potential decoder one more curveball with what appears to be data chunks that don't have, for lack of a better term, properly divisible chunk lengths. For example, a 0x2000 chunk commonly has a length of 0x604 bytes, which provides 2 bytes for the chunk ID, 2 bytes for the chunk length, and 0x600 bytes for 256 6-byte vectors. However, the deviant CVID data might have a 0x2000 chunk with a length of 0x600 bytes, which provides for the 4 chunk preamble bytes and 0x5FC bytes for the 6-byte vectors which is not evenly divisible by 6. This apparently confuses Cinepak decoders. The solution in this case is to unpack 255 6-byte vectors and then skip 2 bytes before attempting to decode the next chunk in the strip.&lt;br /&gt;
&lt;br /&gt;
== FILM Audio Data ==&lt;br /&gt;
&lt;br /&gt;
Audio data in a FILM file can be stored in a variety of formats which are mostly linear [[PCM]] variants.&lt;br /&gt;
&lt;br /&gt;
CPK files from Sega Saturn games almost always contain linear PCM audio. The one known exception is Burning Rangers. This game apparently uses [[CRI ADX ADPCM]] audio coding.&lt;br /&gt;
&lt;br /&gt;
Saturn CPK audio data is always stored as signed data. This is important to remember when playing 8-bit CPK audio data on a PC which generally expects 8-bit data to be unsigned.&lt;br /&gt;
&lt;br /&gt;
When a CPK file contains 16-bit audio data, the individual PCM samples are stored in big endian format. Again, this is important to remember when playing on a PC since a PC will generally expect little endian&lt;br /&gt;
16-bit data.&lt;br /&gt;
&lt;br /&gt;
If the CPK audio data is stereo (8- or 16-bit), the channel data is non-interleaved. Usually, stereo data is stored interleaved as a left channel sample followed by a right channel sample as follows:&lt;br /&gt;
&lt;br /&gt;
  L R L R L R L R ...&lt;br /&gt;
&lt;br /&gt;
In a stereo CPK file, for each audio data chunk, the first half of the chunk contains left channel samples and the second half contains right channel samples. The likely reason for this scheme is that console audio hardware such as that found on the Sega Saturn usually features a number of audio channels which can each play a mono PCM stream at a particular pan position (e.g., from 0-15 where 0 is extreme left, 7 and 8 are center, and 15 is extreme right). In order to play a stereo PCM stream, one physical audio channel must be assigned to extreme left while a second channel is assigned to extreme right. Then the appropriate channel samples are sent to the correct channel. Since these files are optimized for playback on the Sega Saturn it makes sense to arrange the audio samples like this.&lt;br /&gt;
&lt;br /&gt;
The Sega CD audio playback hardware ostensibly supports native sign/magnitude audio samples. All Sega CD games studied use this format to store audio data. Sign/magnitude number coding for 8-bit numbers&lt;br /&gt;
means that for each 8-bit byte:&lt;br /&gt;
&lt;br /&gt;
  bit 7      sign&lt;br /&gt;
  bits 6-0   magnitude (value)&lt;br /&gt;
&lt;br /&gt;
This is slightly different from twos complement encoding which is how computers typically store signed numbers. For example, in the sign/magnitude scheme, 0x81 represents -1 and 0xFF represents -127. 0x01&lt;br /&gt;
and 0x7F still represent 1 and 127, respectively, just as in unsigned, and signed twos complement coding.&lt;br /&gt;
&lt;br /&gt;
== Early Sega CD FILM Files ==&lt;br /&gt;
&lt;br /&gt;
Some Sega CD games as well as at least one 3DO game (Lemmings) use an early version of the FILM format. Unfortunately, there are a lot of variations and a general-purpose player will probably require a lot of&lt;br /&gt;
special-case logic in order to deal with every known circumstance.&lt;br /&gt;
&lt;br /&gt;
The first difference in these early files is the version number. These early files do not have ASCII-readable version fields. Some have NULL or other non-ASCII versions. This helps automatic detection.&lt;br /&gt;
&lt;br /&gt;
The second major difference that all of these early files appear to exhibit is an abbreviated FDSC chunk which omits any audio information. Thus, the FDSC chunk is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
  bytes 0-3    'FDSC' chunk signature&lt;br /&gt;
  bytes 4-7    length of FDSC chunk (including signature and length&lt;br /&gt;
               fields); this FDSC chunk is 20 (0x14) bytes long&lt;br /&gt;
  bytes 8-11   FOURCC of video codec&lt;br /&gt;
  bytes 12-15  height of video frames&lt;br /&gt;
  bytes 16-19  width of video frames&lt;br /&gt;
&lt;br /&gt;
The lack of audio information leaves room for experimentation. The following is a list of known games which have early FILM files along with any special quirks observed.&lt;br /&gt;
&lt;br /&gt;
On the Lemmings 3DO game, there are 2 files with the .film extension (the 3DO game console uses a custom filesystem which allows for file extensions longer than 3 characters). The files have a NULL version field. The files use CVID data which is deviant in the same manner as typical FILM CVID data with an added quirk: There appear to be 6 extra bytes between the end of the CVID chunk header and the start of the first strip header, rather than the usual 2 extra bytes. The Lemmings FILM files also contain 8-bit signed, monaural PCM data with a sampling frequency of 22050 Hz.&lt;br /&gt;
&lt;br /&gt;
The Batman and Robin Sega CD title has a series of files with the extension .s. They are early FILM files with a version field of 0x00020000. Further, bytes 12-15 of the main FILM header are not set to 0 as is usually seen in FILM files. The files have a video fourcc of 'Seg4' which is probably Cinepak for Sega or a variant thereof. The files have STAB chunks which are a constant 0x20 (32) bytes long. This consists of the 'STAB' signature, a 4-byte chunk length, the base playback frequency, a sample count, and one 16-byte sample record. These files do not store the sample table in one place. Instead, they store one sample record followed immediately by the data corresponding to that sample record. Repeat until the end of the file.&lt;br /&gt;
&lt;br /&gt;
The Dracula Unleashed Sega CD title contains a series of files beginning with video?? with no file extension. They are early FILM files with a NULL version field, abbreviated FDSC chunk, and 'sega' as a video codec (Cinepak for Sega). The audio is 8-bit sign/magnitude audio with a sampling frequency of 16000 Hz.&lt;br /&gt;
&lt;br /&gt;
Jurassic Park for the Sega CD has a large number of files with the file extension .MVD. They are early FILM files with the same characteristics as the FILM files in Dracula Unleashed.&lt;br /&gt;
&lt;br /&gt;
The Tomcat Alley title for the Sega CD has a massive data file called tca.bin. Inside this data file are a lot of FILM files. These files have NULL version fields. The files have abbreviated FDSC chunks and the&lt;br /&gt;
'sega' video fourcc. They also have short STAB chunks with an Apple Quicktime 'mdia' atom appended at the end.&lt;br /&gt;
&lt;br /&gt;
== Strategy For Detecting FILM File Types ==&lt;br /&gt;
&lt;br /&gt;
There are quite a few variations and deviations in the FILM file format. This section presents logic for detecting and dealing with the variations.&lt;br /&gt;
&lt;br /&gt;
File extension detection is not especially useful since many games will masquerade their files with another extension. The best method to determine whether a file is a FILM file is to read the first 4 bytes and check for the signature 'FILM'.&lt;br /&gt;
&lt;br /&gt;
Upon validating the signature:&lt;br /&gt;
&lt;br /&gt;
* read the file version in the FILM header&lt;br /&gt;
* if the file version consists of ASCII characters&lt;br /&gt;
** if the file version is '1.09', watch out for bad length of STAB chunk as well as ADPCM audio&lt;br /&gt;
** load as standard FILM file, be sure to feed CVID data through Cinepak decoder that can handle it&lt;br /&gt;
* if the file version is 0x00020000&lt;br /&gt;
** read the video fourcc&lt;br /&gt;
** if the video fourcc is 'Seg4'&lt;br /&gt;
*** assume the file comes from Batman and Robin&lt;br /&gt;
* if the file version is NULL&lt;br /&gt;
** read the video fourcc&lt;br /&gt;
** if the video fourcc is 'cvid'&lt;br /&gt;
*** assume the file comes from the Lemmings 3DO game&lt;br /&gt;
*** be prepared to decode special variant of modified CVID data&lt;br /&gt;
*** assume 8-bit, mono, 22050 Hz PCM audio&lt;br /&gt;
** if the video fourcc is 'sega'&lt;br /&gt;
*** assume the file comes from one of several Sega CD games that agreed on this format&lt;br /&gt;
*** assume 8-bit, mono, 16000 Hz sign/magnitude audio&lt;br /&gt;
&lt;br /&gt;
== Games That Use FILM Files ==&lt;br /&gt;
&lt;br /&gt;
These games are known to use some variation of FILM files. Observed file version numbers are noted where known.&lt;br /&gt;
&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/astal Astal (Sega Saturn)]: '0.91', '1.06'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/burning-rangers Burning Rangers (Sega Saturn)]: '1.09'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/clockwork-knight Clockwork Knight (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/criticom Criticom (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/d D (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/defcon-5 Defcon 5 (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/iron-storm_ Iron Storm (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/3do/lemmings Lemmings (3DO)]: unversioned&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/myst Myst (Sega Saturn)]: '1.01'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/nights-into-dreams Nights Into Dreams (Sega Saturn)]: '0.91', '1.01', '1.06', '1.07', '1.08'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/panzer-dragoon Panzer Dragoon (Sega Saturn)]: '1.04'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/panzer-dragoon-ii-zwei Panzer Dragoon II: Zwei (Sega Saturn)]: '1.07'&lt;br /&gt;
* [http://www.mobygames.com/game/sega-saturn/roberta-williams-phantasmagoria Phantasm (Sega Saturn)]: '1.06', '1.08', '1.09'&lt;br /&gt;
* Sega Saturn Bootleg Sampler (Sega Saturn): '1.04'&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/shockwave-assault Shockwave Assault (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/skeleton-warriors Skeleton Warriors (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/space-jam Space Jam (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/street-fighter-the-movie Street Fighter: The Movie (Sega Saturn)]&lt;br /&gt;
* [http://www.mobygames.com/game/saturn/virtua-squad-virtual-cop Virtua Cop (Sega Saturn)]: '1.08'&lt;br /&gt;
* World Series Baseball II (Sega Saturn)&lt;br /&gt;
&lt;br /&gt;
[[Category:Container Formats]]&lt;br /&gt;
[[Category:Game Formats]]&lt;/div&gt;</summary>
		<author><name>Clone2727</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Smush&amp;diff=7076</id>
		<title>Smush</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Smush&amp;diff=7076"/>
		<updated>2007-02-26T21:38:43Z</updated>

		<summary type="html">&lt;p&gt;Clone2727: oops... confused XvT:BOP with XWA&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page attempts to document the [[LucasArts]] Smush codec. Note that at this stage the document is quite incomplete as the codec is still being reverse engineered.&lt;br /&gt;
&lt;br /&gt;
Samples from various games are located at http://samples.mplayerhq.hu/game-formats/la-san/ and http://samples.mplayerhq.hu/game-formats/la-snm/.&lt;br /&gt;
&lt;br /&gt;
== Usage Matrix ==&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Name !! Variant !! Video Codec || Audio Codec&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/dos/star-wars-rebel-assault Rebel Assault]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/dos/star-wars-rebel-assault-ii-the-hidden-empire Rebel Assault II]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Rebel Assault II demo&lt;br /&gt;
| &amp;amp;nbsp; || FOBJ Codec 37 || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Rebel Assault II trailer&lt;br /&gt;
| SAN || &amp;amp;nbsp; || PSAD&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/dos/full-throttle Full Throttle]&lt;br /&gt;
| SAN/NUT || FOBJ Codec 37 || PSAD&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/dos/dig The Dig]&lt;br /&gt;
| SAN || FOBJ Codec 37 || IACT&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/curse-of-monkey-island The Curse Of Monkey Island]&lt;br /&gt;
| SAN || FOBJ Codec 47 || IACT&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/outlaws Outlaws]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Outlaws demo&lt;br /&gt;
| &amp;amp;nbsp; || FOBJ Codec 47 || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Grim Fandango demo&lt;br /&gt;
| &amp;amp;nbsp; || FOBJ Codec 47 || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Grim Fandango trailer&lt;br /&gt;
| SAN || &amp;amp;nbsp; || IACT&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/grim-fandango Grim Fandango]&lt;br /&gt;
| SNM || Bl16 (blocky16) || [[VIMA]]&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/star-wars-shadows-of-the-empire Shadows of the Empire (PC)]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-	 &lt;br /&gt;
| [http://www.mobygames.com/game/windows/star-wars-x-wing-alliance X-Wing Alliance]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/star-wars-episode-i-racer Star Wars Racer]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/star-wars-droidworks Star Wars DroidWorks]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/indiana-jones-and-the-infernal-machine Indiana Jones and the Infernal Machine]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/star-wars-jedi-knight-mysteries-of-the-sith Jedi Knight: Mysteries of the Sith]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/mortimer-and-the-riddles-of-the-medallion Mortimer and the Riddles of the Medallion]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Making Magic CDROM (not a game but still uses smush)&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/escape-from-monkey-island Escape From Monkey Island] &lt;br /&gt;
| &amp;amp;nbsp; || apparently has Smush headers but uses [[Bink Container|Bink]] || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Star Wars Episode 1: Insider's Guide&lt;br /&gt;
| SNM || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Jar Jar's Journey Storybook&lt;br /&gt;
| SNM || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Variants ==&lt;br /&gt;
Smush comes in two variants. [[SAN|Version 1]], FOURCC &amp;quot;ANIM&amp;quot; was used up until Grim Fandango. [[SNM|Version 2]], FOURCC &amp;quot;SANM&amp;quot; was used from Grim Fandango up until its replacement by [[Bink Container|Bink]], possibly in Escape From Monkey Island.&lt;br /&gt;
&lt;br /&gt;
[[Category:Game Formats]]&lt;/div&gt;</summary>
		<author><name>Clone2727</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Smush&amp;diff=7075</id>
		<title>Smush</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Smush&amp;diff=7075"/>
		<updated>2007-02-26T21:33:46Z</updated>

		<summary type="html">&lt;p&gt;Clone2727: typos&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page attempts to document the [[LucasArts]] Smush codec. Note that at this stage the document is quite incomplete as the codec is still being reverse engineered.&lt;br /&gt;
&lt;br /&gt;
Samples from various games are located at http://samples.mplayerhq.hu/game-formats/la-san/ and http://samples.mplayerhq.hu/game-formats/la-snm/.&lt;br /&gt;
&lt;br /&gt;
== Usage Matrix ==&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Name !! Variant !! Video Codec || Audio Codec&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/dos/star-wars-rebel-assault Rebel Assault]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/dos/star-wars-rebel-assault-ii-the-hidden-empire Rebel Assault II]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Rebel Assault II demo&lt;br /&gt;
| &amp;amp;nbsp; || FOBJ Codec 37 || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Rebel Assault II trailer&lt;br /&gt;
| SAN || &amp;amp;nbsp; || PSAD&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/dos/full-throttle Full Throttle]&lt;br /&gt;
| SAN/NUT || FOBJ Codec 37 || PSAD&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/dos/dig The Dig]&lt;br /&gt;
| SAN || FOBJ Codec 37 || IACT&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/curse-of-monkey-island The Curse Of Monkey Island]&lt;br /&gt;
| SAN || FOBJ Codec 47 || IACT&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/outlaws Outlaws]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Outlaws demo&lt;br /&gt;
| &amp;amp;nbsp; || FOBJ Codec 47 || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Grim Fandango demo&lt;br /&gt;
| &amp;amp;nbsp; || FOBJ Codec 47 || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Grim Fandango trailer&lt;br /&gt;
| SAN || &amp;amp;nbsp; || IACT&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/grim-fandango Grim Fandango]&lt;br /&gt;
| SNM || Bl16 (blocky16) || [[VIMA]]&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/star-wars-shadows-of-the-empire Shadows of the Empire (PC)]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/star-wars-episode-i-racer Star Wars Racer]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/star-wars-droidworks Star Wars DroidWorks]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/indiana-jones-and-the-infernal-machine Indiana Jones and the Infernal Machine]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/star-wars-jedi-knight-mysteries-of-the-sith Jedi Knight: Mysteries of the Sith]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/mortimer-and-the-riddles-of-the-medallion Mortimer and the Riddles of the Medallion]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Making Magic CDROM (not a game but still uses smush)&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/escape-from-monkey-island Escape From Monkey Island] &lt;br /&gt;
| &amp;amp;nbsp; || apparently has Smush headers but uses [[Bink Container|Bink]] || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Star Wars Episode 1: Insider's Guide&lt;br /&gt;
| SNM || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Jar Jar's Journey Storybook&lt;br /&gt;
| SNM || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Variants ==&lt;br /&gt;
Smush comes in two variants. [[SAN|Version 1]], FOURCC &amp;quot;ANIM&amp;quot; was used up until Grim Fandango. [[SNM|Version 2]], FOURCC &amp;quot;SANM&amp;quot; was used from Grim Fandango up until its replacement by [[Bink Container|Bink]], possibly in Escape From Monkey Island.&lt;br /&gt;
&lt;br /&gt;
[[Category:Game Formats]]&lt;/div&gt;</summary>
		<author><name>Clone2727</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Smush&amp;diff=7074</id>
		<title>Smush</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Smush&amp;diff=7074"/>
		<updated>2007-02-26T21:32:41Z</updated>

		<summary type="html">&lt;p&gt;Clone2727: X-Wing Alliance uses Smacker&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page attempts to document the [[LucasArts]] Smush codec. Note that at this stage the document is quite incomplete as the codec is still being reverse engineered.&lt;br /&gt;
&lt;br /&gt;
Samples from various games are located at http://samples.mplayerhq.hu/game-formats/la-san/ and http://samples.mplayerhq.hu/game-formats/la-snm/.&lt;br /&gt;
&lt;br /&gt;
== Usage Matrix ==&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Name !! Variant !! Video Codec || Audio Codec&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/dos/star-wars-rebel-assault Rebel Assault]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/dos/star-wars-rebel-assault-ii-the-hidden-empire Rebel Assualt II]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Rebel Assault II demo&lt;br /&gt;
| &amp;amp;nbsp; || FOBJ Codec 37 || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Rebel Assault II trailer&lt;br /&gt;
| SAN || &amp;amp;nbsp; || PSAD&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/dos/full-throttle Full Throttle]&lt;br /&gt;
| SAN/NUT || FOBJ Codec 37 || PSAD&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/dos/dig The Dig]&lt;br /&gt;
| SAN || FOBJ Codec 37 || IACT&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/curse-of-monkey-island The Curse Of Monkey Island]&lt;br /&gt;
| SAN || FOBJ Codec 47 || IACT&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/outlaws Outlaws]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Outlaws demo&lt;br /&gt;
| &amp;amp;nbsp; || FOBJ Codec 47 || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Grim Fandango demo&lt;br /&gt;
| &amp;amp;nbsp; || FOBJ Codec 47 || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Grim Fandango trailer&lt;br /&gt;
| SAN || &amp;amp;nbsp; || IACT&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/grim-fandango Grim Fandango]&lt;br /&gt;
| SNM || Bl16 (blocky16) || [[VIMA]]&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/star-wars-shadows-of-the-empire Shadows of the Empire (PC)]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/star-wars-episode-i-racer Star Wars Racer]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/star-wars-droidworks Star Wars DroidWorks]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/indiana-jones-and-the-infernal-machine Indiana Jones and the Infernal Machine]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/star-wars-jedi-knight-mysteries-of-the-sith Jedi Knight: Mysteries of the Sith]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/windows/mortimer-and-the-riddles-of-the-medallion Mortimer and the Riddles of the Medallion]&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Making Magic CDROM (not a game but still uses smush)&lt;br /&gt;
| &amp;amp;nbsp; || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mobygames.com/game/escape-from-monkey-island Escape From Monkey Island] &lt;br /&gt;
| &amp;amp;nbsp; || apparently has Smush headers but uses [[Bink Container|Bink]] || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| StarWars Episode 1: Insider's Guide&lt;br /&gt;
| SNM || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| Jar Jar's Journey Storybook&lt;br /&gt;
| SNM || &amp;amp;nbsp; || &amp;amp;nbsp;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Variants ==&lt;br /&gt;
Smush comes in two variants. [[SAN|Version 1]], FOURCC &amp;quot;ANIM&amp;quot; was used up until Grim Fandango. [[SNM|Version 2]], FOURCC &amp;quot;SANM&amp;quot; was used from Grim Fandango up until its replacement by [[Bink Container|Bink]], possibly in Escape From Monkey Island.&lt;br /&gt;
&lt;br /&gt;
[[Category:Game Formats]]&lt;/div&gt;</summary>
		<author><name>Clone2727</name></author>
	</entry>
</feed>