Category Archives: Game Hacking

Sofdec Support

FFmpeg now includes support for the Sofdec middleware format thanks to Aurel Jacobs and Mans Rullgard, as well as everyone who has made FFmpeg’s MPEG video decoding what it is today. Sonic the Hedgehog salutes you:



Sonic Adventure 2: Battle
Sonic Adventure 2: Battle

Sofdec is a multimedia middleware format that was used heavily on the Sega Dreamcast. Indeed, if you booted a DC game, there might have been a 50/50 chance that you would see Sofdec’s technology insignias among the many obligatory corporate logos. Sofdec still survives to this day and is seen on various GameCube games (often developed by Sega’s subsidiary houses). It probably runs on all the other consoles as well. In fact, I see that MobyGames maintains a game group for CRI-using games.

The thing about Sofdec files is that they are fundamentally MPEG files with MPEG-1 video. The only thing special about them is that they are packaged with a custom ADPCM format called CRI ADX. I checked out the new FFmpeg support with files from a variety of games. One of the biggest problems is blocky output. On files from certain games (for example, F-Zero GX, Resident Evil 4, and Starfox Assault), it almost appears that only DC data is being decoded. FFmpeg does not report any decoding problems. The result is something like this:


Blocky GameCube logo

I am pretty sure that the above is supposed to be the official GameCube logo, which looks like this:


Nintendo GameCube Logo

There are also a few videos from Resident Evil: Code Veronica X on the GameCube that display as a square 320×320 frame, which is not correct:


Resident Evil: Code Veronica X-- Claire Redfield, square aspect ratio

I wonder if aspect ratio information is stored inside this file format, or if perhaps the data is in some other place in the game’s data. Not all of the videos in the game are like this, though.

Many new samples are available in the usual place.

Sega CD FMV VQ Analysis

I have amassed quite a collection of Sega CD titles over my years of multimedia hacking. Since it was an early CD-based console, I reasoned that at least some of the games would contain full motion video (FMV). In fact, essentially all Sega CD games fall into one of the following 2 categories:

  1. Standard 16-bit Sega Genesis-type games that were enhanced by a Red Book CD audio soundtrack
  2. Games that were driven entirely by very low-quality FMV


Mad Dog McCree (Sega CD version) -- Mayor's daughter
Screenshot of Mad Dog McCree for the Sega CD, an FMV-driven FPS

Many Sega CD games, particularly those published by Sega itself, contain many large files with the extension .sga. I have never made much headway on understanding any of these files, save for the fact that many of them use sign/magnitude 8-bit PCM audio. As for the video codec, “Cinepak” or “Cinepak for Sega” is often thrown around. I can certify that it is not the stock Cinepak data commonly seen in the early FMV era. Though perhaps the Sega CD console was the proving ground for later Cinepak technologies. A lot of Sega CD FAQs around the internet were apparently plagiarized from each other, which must have originally been plagiarized from Sega marketing material because they all shallowly list one of the system’s graphical capabilities as “Advanced compression scheme.”

Continue reading

GSoC Evaluation Tasks

If a student wanted to make the FFmpeg cut for the 2007 Google Summer of Code, they were required to complete a qualification task. They could select these tasks from a preset list on our GSoC Wiki page, or they could submit their own idea for approval. In completing a task, the student demonstrated that they:

  • were willing to commit some time over the 3-week app review period to prove themselves
  • could code C satisfactorily and with the same general style expected of the FFmpeg codebase
  • could wrap their head around the code base
  • could interact with the FFmpeg development mailing list
  • could accept feedback and revise the code until it was suitable for inclusion in the main code base

We got some good labor out of the qualifying students. Here are some of the things that FFmpeg can now do, thanks to the GSoC qualification tasks:

  • THP playback subsystem
  • Bethsoft VID playback subsystem
  • C93 playback subsystem
  • TIFF encoder, with LZW support
  • support for Theora in Matroska
  • SGI image subsystem ported to latest API
  • Targa encoder (thanks to Ben for the reminder)

ROM-Based FMV

I found out that the Nintendo 64 version of Capcom’s timeless Resident Evil 2 features FMV. This is amazing given that that the game is cartridge-based and only has 64 megabytes of data. According to some reports I have read, the N64 version had essentially the same FMV content as the the original PlayStation version had (which came on 2 CDs and had dedicated FMV decoding hardware at it disposal).

I’m sure I’m not the only person to wonder how this N64 FMV works.

Further, I read that the Neo Geo version of the 1994 remake of Double Dragon featured a FMV clip from the hilariously absurd 1994 movie. Naturally, I’m curious how that video was stored. I believe the Neo Geo was another strictly tile-based console which would have required vector quantization.