Author Topic: Various PSX formats...  (Read 5095 times)

halkun

  • Global moderator
  • *
  • Posts: 2097
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
Various PSX formats...
« on: 2006-10-11 08:43:46 »
Using Google's new code search thingy, I see that ffmpeg has a .STR file reader. It's GPL too so we can rip directly from this to play the movies directly from the disk.

Code segment is Here

ffmpeg also has the ability to read PSX ADPCM data too, so that solves some video/audio issues....


Micky

  • *
  • Posts: 300
    • View Profile
Re: Various PSX formats...
« Reply #1 on: 2006-10-11 18:21:56 »
Using Google's new code search thingy, I see that ffmpeg has a .STR file reader. It's GPL too so we can rip directly from this to play the movies directly from the disk.

Code segment is Here

ffmpeg also has the ability to read PSX ADPCM data too, so that solves some video/audio issues....

I'm sure at one point I was able to play FF7 movies, but when I tried it recently it didn't work. STR and DAT are not standardised in any way, so I assume they just work together with the SDK version used to build the game - earlier or later SDKs have small tweaks or fixes and may not be compatible.
So far I was too lazy to go through the archives to find a version that works, or hack the STR reader until it works with the data files used in FF7.
Luckily the actual M-JPEG decompression is fixed, as they used the MDEC hardware. And some bits of the STR format are limited by the CD frame format used. But they seem to use a Huffman compression scheme in-between which has changed in the latest version of ffmpeg, probably to support newer games.
« Last Edit: 2006-10-11 18:24:28 by Micky »

halkun

  • Global moderator
  • *
  • Posts: 2097
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
Re: Various PSX formats...
« Reply #2 on: 2006-10-11 22:23:51 »
From what I understand, the STR in the FF7 disk is just catonated MDEC data in XA format. (It uses larger sectors in the disk) MDECs are hufman compressed in the first place.

Micky

  • *
  • Posts: 300
    • View Profile
Re: Various PSX formats...
« Reply #3 on: 2006-10-12 11:43:24 »
From what I understand, the STR in the FF7 disk is just catonated MDEC data in XA format. (It uses larger sectors in the disk) MDECs are hufman compressed in the first place.
Have a look at your PSX doc: the MDEC packages that the hardware decodes are RLE compressed and not huffman compressed. I had a look at a raw file dump (with XA-headers) from the FF7 movies and the data doesn't match what is required for the MDEC.

P.S.: catonated?

halkun

  • Global moderator
  • *
  • Posts: 2097
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
Re: Various PSX formats...
« Reply #4 on: 2006-10-12 17:29:49 »
P.S.: catonated?

concatenated

Cyberman

  • *
  • Posts: 1572
    • View Profile
Re: Various PSX formats...
« Reply #5 on: 2006-10-12 19:01:04 »
All right.. seems I have to help you folks.

You MUST read the XA headers firstly
If you do not you WILL be VERY confused about the format.

The format is INTERLEAVED, reading the raw file will make ZILCH sense unless you read the XA HEADERS.
Each SECTOR has SPECIFIC information in it, think of it more like an AVI file and then you will notice the AUDIO and VIDEO are interleaved.
This is to prevent the PS1 from choking on too much video or audio data.  First a Video chunk is dumped to the MDEC (handled in software mostly)
Next the audio data is dumped (ADPCM) to the SPU then repeat.  If there is no audio for the Video file, PADDING SECTORS are added. Otherwise too much data will be stuffed into the video decoding system and the PS1 WILL CRASH (period there is no but or exception too much data makes it crash).

The PS1 will lock up if you do not do this because the video hardware will choke. (It's extremely touchy about this)

So Read the XA headers and you will find the Video and Audio Streams then you will need to contemplate the remaining contents.
Also remember the VIDEO sections are just 2K and the audio fills the entire sector.

Cyb

Micky

  • *
  • Posts: 300
    • View Profile
Re: Various PSX formats...
« Reply #6 on: 2006-10-12 20:15:46 »
The ffmpeg codec works on a raw dump of the file, that is the full 2352 byte of each CD-ROM sector required for the movie concatenated and stored in a normal PC file. The STR reader reads the header of each sector and hands the data to the MDEC code or the audio code.

P.S.: Sorry Halkun, English isn't my first language so I have to ask sometimes. :)