Looking for formats to look at

As I mentioned in one of the previous posts, I’ve achieved all the goals for NihAV that I initially set except for trying to write a proper encoder (and no, world domination has never been on my list). Unfortunately this will be not so easy thing to do and I’d like to have a distraction time from time.

Usually I distracted myself with reverse-engineering some format and maybe implementing decoding support for it in NihAV but recently I realized that I ran out of low-hanging fruit. There should be interesting codecs and game containers out there still waiting for their chance but I could not remember anything. I even went through ScummVM code and documented video formats from there in The Wiki, that’s how bored I was.

So I’d be grateful if somebody can point me out to a thing to RE. Last time when Peter drew my attention to VGM/XVD it turned out to be a very fulfilling experience.

20 Responses to “Looking for formats to look at”

  1. skyward says:

    what kinds of formats are you looking for in particular?

    i could “hook you up” with Iron Storm’s peculiar 4XM formats but i don’t know how much of that format NihAV has it covered, if at all…

  2. Kostya says:

    Anything beside speech codecs should be fine. And I don’t always implement a decoder for a format, sometimes looking at it and documenting is enough (or just looking at it).

    And isn’t 4XM fully understood by now? It’s been supported by FFmpeg since ages.

  3. Yeah, I’m surprised to hear about 4XM problems. But it the format isn’t supported by the open source software available, I’d be curious.

    I can’t believe you’re putting out a call for weird game formats and I’m drawing a blank.

    Maybe H4M?


    The added challenge would be that it would likely involve reverse engineering PowerPC code from the Nintendo GameCube.

  4. e71 says:

    there’s wtv videoflash as we discussed but i want to have that one for myself 😉 You would probably do that in one day, while i would still like to learn.

    Maybe look at the audio format used in “Old Time Baseball”? The audio files claim to be “raw” but ffmpeg, gstreamer, Apple Quicktime, or even audacity couldn’t recognize them. I will email you the link to the files.

  5. Peter says:

    I am also drawing a blank.

    Out of boredom recently, I installed Mean Streets to explore the RealSound(tm) audio format, only to find it was just zipped up mulaw files. Oh well.

  6. Kostya says:

    Yeah, I remember it from Legend Entertainment games (back when the sound was played on real PC speaker as it was intended).

    Those raw files turned out to be raw audio indeed. You can’t reliably detect its parameters but Audacity does sometimes. I simply looked at the contents, saw it’s most likely 16-bit PCM, tried 22kHz stereo first, then mono – and it worked.

    You can convert it either with sox or like I did avconv -f s16le -ar 22050 -ac 1 -i theme.raw theme.wav or by writing WAV/AU/whatever header yourself.

  7. Paul says:

    You can convert it with ffmpeg too.

  8. Kostya says:

    Yes, the command line beside the tool name will be the same. I just still use avconv though.

  9. SupSuper says:

    Interested in Amiga games? Haven’t been able to figure out the video format used in the port of Nightlong for the Amiga: http://clickboom.com/cgi-bin/index-games.cgi?part=nightlong

    The PC version just uses standard Smacker.

  10. Kostya says:

    If I’m be able to locate samples and binary – why not.

  11. e71 says:

    Maybe I create custom codec just for you to reverse 😉

  12. Kostya says:

    There’s no need to do that, there are many undiscovered codecs around here already. It’s just people can’t remember them.

    You should create codecs either to solve a specific problem (improve compression for some cases or improve compression speed for some other kind of content) or to learn coding principles.

    I can always switch to some other stuff (like game engines) if the codec theme is exhausted.

  13. DefinitelyNotKostya says:

    Hello Kostya, you were referred to be by someone in IRC. He or she told me you may be interested in adding a feature to FFmpeg. It’s quite a niche format, so I’m hoping you will be interested, for the GTA fans-sake.

    Here’s the deal, me and a friend of mine are in the process of creating our own unofficial soundtrack of the PlayStation 2 Grand Theft Auto game files for personal use. The reason why we’re using PS2 files is because the audio quality is higher than the PC version. The Xbox versions are even lower than the PC version, bitrate-wise.

    The audio files in Grand Theft Auto 3, Vice City, Liberty City Stories and Vice City stories are of the *.VB format. There are two converters out there, that I know of, that are able to convert said files to WAV, Decode (hard to find, found it by chance) and MFAudio. However, to my knowledge, both convert to the wrong amount of bits (16 instead 4), so the resulting output files are much larger than necessary, compared to the PCs 4 bit files and .VBs original file sizes.

    Now, as I mentioned earlier, I was on IRC. The people there told me that 4 bit is too low for an audio file to sound any good, and I agree, someone linked me a 4 bit audio file, and it sounded atrocious. They told me it has to do with compression differences, something called RLE? Apparently, the PC files are stored as 4 bit, but are uncompressed by the player, whereas the PS2 are already fully decompressed, hence their size.

    So, the request, it would be nice to be able to convert VB to WAV, or some other losslees codec, based on Decode or MFAudio, with FFmpeg, with ability to choose the bit depth, to experiment between various qualities, regardless.

    Would you be interested in making this possible?

  14. […] a recent post I asked for some stuff to RE and I got some (but more pointers are […]

  15. Kostya says:

    Hi, stranger!

    I’m not working with FFmpeg since decades and I prefer to keep it this way. I’m pretty sure that Paul Mahol would have no problems adding such decoder though, especially if there is any specification of the format (or a binary decoder to write text specification from).

    People telling you about 4-bit sound being too low are both right and wrong. It is definitely not enough for any quality of raw PCM but very common IMA ADPCM compression compresses 16-bit audio to 4-bit deltas while sounding good. And from a quick search it looks like it can be one used here indeed.

  16. Eugene Sandulenko says:

    Kostya, there is 0xf0 codec in the SMC decoder which is not yet implemented and we have a video with it: https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/refs/heads/master:/libavcodec/smc.c#l410

  17. Kostya says:

    Can you tell which game it is or share the sample somehow? I’ll try to look in the binary specification regardless but it’ll help testing process.

  18. Eugene Sandulenko says:

    The Journeyman Project (not Turbo), Windows version, files mmm/popclose.qt and mmm/popopen.qt or drop me an e-mail with your contacts

  19. Iso says:

    An LDAC decoder would be great.

    Open-source encoder which comes from Android is available here:

    The encoder was used by PulseAudio and now by PipeWire. So that’s a codec that is actually used in the open-source stack with no software decoder available, to the best of my knowledge.

    Would be cool if one could verify (or debunk) Sony’s quality claims.


    A non-Sony Bluetooth headset which was gifted to me gained LDAC support on a firmware upgrade (only had AAC before). So the codec seems to be gaining ground in the (near-lossless) Bluetooth codec war.

  20. Kostya says:

    Well, what they claim is a bullshit. I’ll make a post about it a bit later.

Leave a Reply