Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:STR (PlayStation video)

From ReverseEngineering.wiki
Format
Platforms Platform:PlayStation
Extensions .STR, .XA, .MOV, .FMV
Endianness little
On this wiki Facts · Code · Notes · Topics

The PlayStation movie stream: Form 2 sectors of a CD-ROM XA file with a 0x20-byte header (0x0160 status, type 0x8001 for MDEC, sector index and count in the frame, frame number and size, width and height) whose payload is a BS bitstream of Huffman-coded MDEC data; frames of 4-5 sectors, interleaved with XA-ADPCM audio.

Overview

A .STR file is a sequence of sectors (see Format:CD-ROM XA) that each start with a 0x20-byte header, followed by 0x7E0 bytes of data in Form 1-sized chunks. The frames are compressed with the MDEC's input format: a "BS" bitstream, Huffman-coded in software and expanded to MDEC run-length codes before being fed to the decoder chip. Audio comes as XA-ADPCM sectors interleaved between the video sectors, and games often use a different extension or wrap the stream in their own container.

Sector header

Offset Size Meaning
0x00 2 StStatus 0x0160 (version 1, ID 6)
0x02 2 StType: 0x0000-0x7FFF user defined, 0x8001 = MDEC (the only system type)
0x04 2 sector number inside the frame, 0 = first
0x06 2 sector count of the frame (4 or 5 typical)
0x08 4 frame number, 1 = first
0x0C 4 frame size in bytes (without headers and padding)
0x10 2 movie width (e.g. 0x0140)
0x12 2 movie height (e.g. 0x00F0)
0x14 8 StHeadM/StHeadV, a copy of bytes 0x20-0x27 of the first sector
0x1C 4 unspecified
0x20 0x7E0 BS data (or padding in the last sector)

For StType below 0x8000 bytes 0x10-0x1F are user-defined and the data is user data. Width and height are nearly always multiples of 16; if not, the MDEC output buffer must be rounded up to 16 pixels and the picture cropped.

BS header (first sector, offset 0x20)

For BS versions 1, 2 and 3: u16 MDEC size/4 after Huffman decoding (rounded to 0x80/4), u16 ID 0x3800, u16 quantisation scale (0-0x3F), u16 version (1, 2 or 3; 2 is the most common), then the Huffman-coded blocks (Cr, Cb, Y1-Y4 per macroblock). Version 3 differs in DC coding (v3 DC uses a different scheme, see psx-spx). Rough popularity in .STR movies according to psx-spx: v2 60%, v3 20%, v1 15%; rare variants are Electronic Arts, "iki" (Gran Turismo, StType 0x5349), "fraquant", v0 (Serial Experiments Lain), encrypted v2/v3 (Star Wars games) and Wacwac.

Identification of non-standard streams

First bytes other than 60 01: "SMJ"/"SMN"/"SMR" + 01 (Final Fantasy VIII video, audio left and right), "VLC0" (newer EA), "VMNK" (Policenauts), 01 "XSP" (Sentient), DD CC BB AA (older EA, some dance games). Metal Gear Solid's ZMOVIE.STR uses StType 0x0001 sectors for subtitle text and 0x8001 for pictures.

Tools

  • jPSXdec (Java; non-commercial licence, so use it as a tool or documentation lead; its PlayStation1_STR_format.txt describes the format) identifies and extracts these streams. Unverified: its feature list was not read in full.

Evidence & references

  • psx-spx, "CDROM File Video Streaming STR (Sony)", "STR Variants", "BS Compression Versions/Headers" (docs/cdromfileformats.md in the psx-spx mirror).