Yearly Archives: 2008

Solid Snake Oggs

I was studying a file called vox.dat scavenged from the GameCube version of Metal Gear Solid: The Twin Snakes, the seminal, tactical, tip-toeing game starring Solid Snake. The file contains a lot of multi-lingual subtitle strings as well as the actual English speech recited along with the subtitle presentation. What format does this commercial game use? Would you believe Ogg Vorbis? The constituent audio streams are all tagged with the string “Xiph.Org libVorbis I 20020717”, which is quite old. The current version of the Xiph’s ogg123 playback tool does not decode a stream properly. Some of the data is audible, but a lot of audio chunks are skipped. FFmpeg fares a little bit better but still scrambles some audio.


Metal Gear Solid logo

Is this a case of poor backwards compatibility? Or perhaps the creators — Silicon Knights — deliberately monkeyed with the bitstream? I found that last situation a bit implausible as I assumed developers would treat this third party codec stuff as a black box. But as an experiment, let’s go back in time, courtesy of Xiph’s source control:

svn co -r {20020717} http://svn.xiph.org/trunk/ogg ogg-svn
svn co -r {20020717} http://svn.xiph.org/trunk/vorbis vorbis-svn
svn co -r {20020717} http://svn.xiph.org/trunk/vorbis-tools vorbis-tools-svn

I removed all of the related components on my system for good measure. With a little persistence and a lot of disabled options while building the tool set, I was finally able to get the components to build. Those old tools still have the same trouble with these Ogg Vorbis files:

$ oggdec mgs1-sample1.ogg
OggDec 1.0
Decoding "mgs1-sample1.ogg" to "mgs1-sample1.wav"
        [  1.5%]Warning: hole in data
        [  4.5%]Warning: hole in data
        [  6.5%]Warning: hole in data
[...]
        [127.5%]Warning: hole in data
        [130.5%]Warning: hole in data
        [132.5%]Warning: hole in data
        [134.5%]

Or maybe the tool is just extremely capable if it can decode more than 130% of the file.

I have placed three manually ripped samples in the archive; each is 512 KB. I would start ripping at offsets where I saw an ‘OggS’ marker that was followed soon after by the libVorbis ID string. If you care enough, have a look. And to what end? Isn’t it obvious? To create a “Learn English With Solid Snake And Friends” application.


Solid Snake and Liquid Snake

Learn handy, everyday phrases like, “I’m no rookie!” and “Don’t think! Shoot!” English speakers will be able to learn the same phrases in other languages, though they won’t have the benefit of pronunciation.

I’m still working out the details of the vox.dat file format. I have some things sorted out. Perhaps readers who know German, French, Italian, or Spanish, and who understand non-ASCII character encodings can answer whether these schemes fit any well-known encodings (I know that the 0x0A is a line break in the subtitle):

             53 70 72 69  63 68 20 6E  69 63 68 74      Sprich nicht
20 7A 75 20  6D 69 72 20  77 69 65 20  7A 75 0A 65   zu mir wie zu.e
69 6E 65 6D  20 41 6E 66  1F 0B 6E 67  65 72 21     inem Anf..nger!

             4C 61 20 66  65 72 6D 65  2C 20 6C 1F      La ferme, l.
09 2D 64 65  64 61 6E 73  20 21                     .-dedans !

             5A 69 74 74  6F 20 6C 1F  09 20 64 65      Zitto l.. de
6E 74 72 6F  21                                     ntro!

             1F 42 1F 42  41 20 71 75  1F 0F 20 65       .B.BA qu.. e
73 74 1F 08  73 20 65 73  70 65 72 61  6E 64 6F 21  st..s esperando!
21 0A 1F 42  1F 42 44 69  73 70 61 72  61 21 21     !..B.BDispara!!

Empirical analysis simply implies that a character 0x1F is followed immediately by a character not in the standard ASCII set.

Novice Relations Department

The qualification tasks required of students in order to participate in FFmpeg’s Summer of Code program has finally afforded me the opportunity to create a “Small FFmpeg Tasks” page on the MultimediaWiki. Of course, the small tasks list was originally chartered to qualify students, but it need not be limited to that purpose. As I wrote on the page, it can be used for anyone who needs a good starting point for FFmpeg hacking. Further, it could be used for someone who has been away from the codebase and needs an exercise to motivate re-familiarization.

I have this — perhaps unfounded — vision that there are many lurkers out there, watching the FFmpeg project from a distance, on or off the notoriously abrasive mailing lists, hoping one day to get involved somehow, but not knowing exactly how to break in. The small tasks list is a great place to start. Maybe you don’t feel all that comfortable with what you have seen during your lurkings, perhaps because you can’t figure out what is meant with this whole “top-posting” thing for which n00bs are routinely savaged. If that’s you, you can always email me privately about getting started. I will (probably, depending on the day) be happy to tutor you on the basics for contributing some code. Email address is on the side bar.

Violated

FFmpeg is open source, licensed largely under the Lesser General Public License (LGPL), though certain parts, for various reasons, are General Public License (GPL), version 2. There are certain provisions about when you must provide source code if you use the program. Some programs do not follow these rules.

We have started tracking these violators in the FFmpeg Hall of Shame. Each violator is listed with a link to its case in the FFmpeg issue tracker. We’re actively trying to work with all violators to resolve these issues. The Hall of Shame seems to be reserved for particularly unresponsive violators.

Deadline Extension; GSoC Qualification Showcase #2

Today was supposed to be the the last day that students could apply to participate in Google’s 2008 Summer of Code. That deadline, however, along with all of the program’s deadlines, have been pushed back by a week. The new submission deadline is next Monday, April 7. The new deadline for the FFmpeg mentoring crew to pick students in April 18, so be sure to have your qualification code in SVN well before then in order to be considered for a project slot.

Regarding qualification tasks, 2 more students have qualified. First, the more graphically interesting: Eli Friedman completed an RPL/ARMovie demuxer and Escape-124 video decoder:


ffplay playing RPL/Escape-124 data

This is the container/codec combo that was seen in the first Tomb Raider PC game. ARMovie is a format that was apparently used on Acorn RISC PCs. If anyone happens to have any ARMovie files that don’t come from Eidos games, I would be interested it seeing them.

Next is a demuxer/decoder pair for the Amiga IFF format that supports the PCM and Fibonacci encodings, prepared by Jai Menon. No real graphics of course, so here’s ffplay’s graphical interpretation of the PCM amplitude:


ffplay playing an IFF/8svx file

There is still time to both apply for GSoC 2008 and work on a qualification task. I have been scavenging the MultimediaWiki for game-related formats that have long been documented but not re-implemented in FFmpeg. Hopefully, the supply will hold up for all the students who want to try their hand at FFmpeg.