Breaking Eggs And Making Omelettes

Topics On Multimedia Technology and Reverse Engineering


Archives:

Bink Video in FFmpeg

February 21st, 2010 by Multimedia Mike

Today was the day: Kostya committed his Bink video decoder to FFmpeg. Here’s just one little screenshot:


Screenshot of the attract mode Bink video from Indiana Jones and the Emperor's Tomb

Of course, this is just one Bink file out of the literal thousands of software titles that have incorporated Bink video (the above comes from Indiana Jones and the Emperor’s Tomb for Windows). For this reason, it’s entirely possible that the Bink video decoder (not to mention the Bink audio decoder and the Bink file format demuxer) might not cover all the cases out there. This is especially relevant considering intel I have received from a guy who has talked to the guy who invented Bink and described the development process. The upshot is that there could conceivably be a lot of custom Bink versions out there. That’s why Kostya hopes for a lot of testing with as many different Bink files that people can throw at this system. To that end, I started with my old Multimedia Exploration Journal and did a text search for every game that I recorded as using Bink.

Just think: The next time that YouTube and assorted other video uploading services update their video conversion backends, they can finally be flooded with Bink videos. (I know it seems silly, but I sometimes feel like my biggest contribution to open source multimedia has been to allow people to upload to YouTube video files that they found on their old Sega Saturn CD-ROMs).

As for FATE, is it plausible to get a basic decoding test staged at this point? I ran a simple sample through my RPC testing tool and learned that the video output is bit exact across platforms. Test staged.

(Aside: Thanks to Vitor Sessak, Valgrinder extraordinaire, for locating a memory bug in the Musepack v7 demuxer. Since I created and staged a v7 sample at the same time I staged a sample for the Musepack v8 demuxer, I have already activated a Musepack v7 demuxing test.)

Here’s a project for someone that likes text processing and searching puzzles: Find a simple, efficient method for comparing my list of DOS/Windows games (here’s the HTML list and here it is in CSV) against the big list of known Bink titles and find all the Bink games in my PC game collection. I have already harvested samples from: Alien vs. Predator Gold Edition, Disney’s Atlantis, Gabriel Knight 3, Gods & Generals, Halo 3 (Xbox 360), In Cold Blood, Indiana Jones and the Emperor’s Tomb, Monsters Inc. Wreck Room Arcade, Starlancer, Tony Hawk Pro Skater 2, Uru: Ages Beyond Myst.

Posted in FATE Server, Game Hacking, Open Source Multimedia | 15 Comments »

15 Responses

  1. Kostya Says:

    IIRC, that big list contains games for each company, so theoretically you can extract games titles from it (right column), split them from comma-separated into newline-separated. After that you can sort both lists of games and use diff or unique to output only matching titles.

    BTW, I’d like to point out that Vitor committed AMR-NB decoder short after Bink video decoder had been.

  2. Multimedia Mike Says:

    Thanks, Kostya. I just noticed the AMR-NB decoder as I was preparing to update the FATE test coverage page.

    As for the text matching exercise, I’m also curious about the fuzzy matching aspect. I suspect there are a number of titles that don’t match up exactly.

  3. Diego E. “Flameeyes” Pettenò Says:

    Uhm the link to the big list is broken, otherwise I would have tried. A few quick pointers if somebody feels like doing it with bash:

    cut -d , -f 1

    will get you the list of games

    cat <(cut -d , -f 1) <(whatever-gets-the-titles-from-big-list) sort | uniq -d

    will get you a list of entries that are in both lists.

    The problem here is that you'll most likely have different spellings in the two lists and will thus fail :P

  4. clone2727 Says:

    Mike, the “big list of known Bink titles” link is broken.

  5. Multimedia Mike Says:

    Fixed the link; thanks.

  6. Peter Says:

    Awesome work. All this ‘new’ content to watch. Its like I have a new TV channel.

  7. Mans Says:

    If the lists are sorted by title, this POSIX command will do the trick:

    cut -d, -f1 $small_list | comm -3 – $big_list

  8. James Says:

    Does this decoder support Bink Video with multiple audio tracks? I can provide examples of those if need be.

  9. Multimedia Mike Says:

    @James: I suspect it does. I have played some Bink files already that report multiple audio tracks. I haven’t tried selecting the other tracks yet, but FFmpeg/FFplay says that they’re there.

  10. Andrew Says:

    Youtube, meh, the Internet Archive if they update their backend will be able to read it! I can finally get around to uploading the dozens of random bink-encoded promotion videos and introduction cutscenes (and perhaps other cutscenes, useful stuff) to the archive’s game videos collection directly, rather then additionally encoding them to some lossy H264.

    That and everything can play them. I remember one version of something used to (a directshow codec for MPC I think) but it got removed.

    Awesome news. I wonder if it does Smacker files too, those were ultra-old.

  11. Multimedia Mike Says:

    @Andrew: Yes, FFmpeg has had Smacker support for quite awhile now (nearly 4 years according to SVN records).

    If you can, compile FFmpeg now and run those Bink promo videos through it to see if they all look and sound right. I’m already seeing some problems and I hope they get worked out before this decoder starts doing heavy duty of transcoding the existing corpus of Bink files for posterity.

  12. zeus Says:

    @Andrew old versions of Media Player Classic contained a snacker and bink directshow decoder. Which was later removed after legal threats.
    Not sure of the last revision to include the decoder but its defiantly included in mpc2kxp6475.zip md5=4908D69467177F0A6BBB71B66F6B73C0 (v6.4.7.5) and not included in v6.4.8.2

  13. avenger Says:

    diablo II, star wars galaxies, tomb raider chronicles, carmageddon, command and conquer (partial matches)

  14. Jonathan Wilson Says:

    AFAIK the Bink and Smacker decoder in Media Player Classic was calling into (and presumably distributing) the Bink and Smacker DLL files rather than using 100% reverse engineered codecs like FFMPEG is now using.

  15. Multimedia Mike Says:

    Rad Game Tools claimed that the MPC interface to the DLLs was based on leaked/proprietary information which is why they compelled MPC to remove support. But not before I reverse engineered and documented the DLL interfaces: see http://wiki.multimedia.cx/index.php?title=RAD_Game_Tools_Bink_API and http://wiki.multimedia.cx/index.php?title=RAD_Game_Tools_Smacker_API . RGT once contacted me and requested that I remove those descriptions from the wiki based on the fact that the code I RE’d to obtain the descriptions was itself written based on proprietary information. That argument didn’t wash with me and I didn’t dignify the request.