TechSmith Screen Capture Codec

From MultimediaWiki
Jump to navigation Jump to search

This page is based on the document 'Description of the TechSmith Screen Capture Codec (TSCC)' by Mike Melanson and Konstantin Shishkov found at http://multimedia.cx/tscc-format.txt.

This codec was developed by TechSmith and used in their screen capturing products.

The TechSmith Screen Capture Codec (henceforth TSCC) is designed primarily for video sequences that have a lot of constant pixel runs and do not change much from frame to frame. AVI files using TSCC often depict tutorials for using computer desktop applications where the only interframe change is a mouse cursor moving around the screen.

This codec is also known as Ensharpen.

Decoding Algorithm

TSCC combines run length encoding (RLE) with standard zlib compression. The algorithm can operate in 24-bit RGB, 16-bit RGB, and palettized 8-bit RGB modes. In the 8-bit mode, the RGB palette information should be transported by the container format (typically AVI).

To decode a chunk of TSCC data first run it through the standard, free zlib decompression library functions.

After decompressing the chunk using zlib, the data is sent through a run length decoding algorithm. Run length encoding/decoding operates by shortening runs of the same number. For example, the sequence:

 8 8 8 8 8 4 4 4

is conceptually encoded as:

 (5, 8), (3, 4)

This indicates that a run of 5 '8' numbers is followed by a run of 3 '4' numbers.

A TSCC frame is decoded from bottom -> top. The algorithm for TSCC RLE decoding is essentially identical to Microsoft's RLE algorithm, thoughit is slightly modified for higher bit depths. The full decoding algorithm operates as follows:

 get next byte in stream (b0)
 if b0 is 0
   get next byte in stream (b1)
   if b1 is 0
     this line is finished, move to decoding the next line
   else if b1 is 1
     frame decode is finished
   else if b1 is 2
     position change
     get next byte in stream (p1)
     get next byte in stream (p2)
     skip (p2) lines from current line
     skip (p1) pixels from current pixel
   else
     copy (b1) 1-, 2-, or 3-byte pixels from stream to output
     if the data is 8-bit and the copy length (b1) is odd, advance the 
       stream pointer by 1 as it is padded (just like MS RLE)
 else (b0 is not 0)
   emit a run of pixels into the output by getting the next 1-, 2-, or 
     3-byte pixel from the stream and placing the same pixel into the 
     output (b0) times