CHAPTER 21
Bink

Bink, from RAD Game Tools, is the most popular video format used in PC and console games. And RAD has been in that business for years; Bink launched back in 1999, itself a follow-up to the company’s successful Smacker codec, which was already version 2.0 in 1995. Thus the codec, tools, and SDK are tightly focused on satisfying the professional game market. Bink does a fine, if unspectacular, job playing cut scenes, but its real strength is its extremely flexible SDK for incorporating video and audio into games as sprites, textures, or anything else for which a series of bitmaps can be used. The decoder itself is quite lightweight as well, leaving CPU power and memory to prepare for the next level while the video is playing. The encoder is Windows-only, but decoders are available for Win32, Mac OS, Linux, Xbox 360, Sony’s PlayStation 2 and 3 and PSP, Nintendo’s Wii and DS, plus older consoles.

If all this has left you drooling, you might be the right target audience for Bink. If not (and that will be most of you), Bink isn’t something you’ll need to worry about.

Why Bink?

You’re making a computer or console game, and you need an API that offers fine control over the playback experience. Bink gets bonus points if you need a similar experience over a wide range of hardware.

Why Not Bink?

You’re Not Making a Game

If you’re not making a game, Bink doesn’t have much to offer.

You Need High-Compression Efficiency

Bink is a MPEG-4 part 2 Simple Profile caliber codec in terms of efficiency. VC-1 or H.264 have much better efficiency, and hence would allow more video or better looking video on a disc.

File Format and Codecs

The Bink file format includes both a video and an audio codec, wrapped in a format with the .bik extension.

The Bink video codec is tuned for lightweight decode as a primary goal. It can use a variety of techniques to encode, selected adaptively, including wavelet and DCT. It can get quite blocky under bandwidth stress.

The audio codec is a fixed-quality VBR of roughly AAC-LC efficiency. The default of 4 sounds quite good; lower (less compressed) may not offer much of an improvement, but may not take that many bits either. You can get away with higher when every bit counts for sprite animation and other cases where there might be dozens of hours of content on the same disc remember to encode mono sources as mono; lots of games add all stereo effects at runtime.

Encoder

Bink files can only be encoded with the free Windows-only Bink encoder. The Bink encoder has lots of options, but in most cases there are only a few you’ll use. Most controls relate to preprocessing, but the tool’s not a great preprocessor, so most of the time you’ll to bring in preprocessed source ready for encoding.

In setting data rate, note that the units used are Bps—bytes per second, not Kbps. This specifies the total rate of audio and video data; audio uses as much as it uses, and video gets what’s left. Since Bink is largely played off optical media, sustained throughput requirements are an important constraint.

Bink doesn’t have 2-pass encoding, but can do lookahead rate control up to 64 frames. This does an analysis X-number of frames ahead before allocating bandwidth, yielding better rate control. Just use the full 64. Older versions of Bink could have lower quality with longer lookaheads, which the first edition of this book recommended against, but that issue has long since been addressed.

Bink’s encoder has good multithreading, and encoding times are perhaps 10–15:1 for 720p24 on a Core 2 8-core system.

Keyframe insertion can use either or both a “keyframe at least every” value and a sensitivity control. Using the Hint window, frame type, size, and so on can be manually controlled per frame.

Once a file has been encoded, the Analyze command displays a data rate graph of your file, to look for data rate spikes and compare to peak bitrates for various devices. Since the spikes are where the codec tried the hardest, they’re also the most likely to still any quality issues.

Playback

Bink files are played back either via the Bink Player application or from a game incorporating the SDK. Either way, there are a wide variety of tweaks available. These include full-screen playback, a wealth of different hardware display modes.

Business Model

The Bink business model is unique, and a big part of its success. First, all the tools are free. You can incorporate video playback in your app for free, but the Bink logo will be displayed. To include video without the logo requires a per-title fee or a site license. There’s also a SDK license that allows for much deeper integration into encoding tools. A full multiplatform, multi-title site license is also available.

Bink Tutorial

This tutorial covers making a Bink file for a multiplatform game title.

Scenario

We’re working on a PC/Xbox 360/PS3 game, and are ready to compress the CGI opening title sequence. The game is HD, so we’ll be encoding to 720p.

We have 110 MB of space left for the opening scene after all the assets (down from the 150 MB promised in “final” allocation budget; a bunch of extra textures for multiplayer got added at the last minute). We’re going to be preloading other content as it plays, and thus need to keep the peak bitrate to 6 Mbps.

Three Questions

What Is My Content?

The source is a 1920 × 1080p24 Lagarith compressed AVI file straight from the animators. It’s 4:05; the cinematic team went long again. And they also left some extra black at the end we need to trim off.

Who Is My Audience?

My audience is both the players of the game and the developers. The players want it to look and sound awesome, but I also need to stick within the technical constraints so the code guys can work their magic at the same time.

What Are My Communication Goals?

We want to deliver a great audio/video experience with minimal artifacts. And we don’t want to get yelled at for going over our file size or peak bandwidth.

Tech Specs

With 100 MB and 4:05, that leaves us 448 KBytes/sec (same as 3591 Kbps, but Bink measures in Kbytes). Our peak of 6000 Kbps means a peak of 750 Kbytes/sec.

It’s not a lot of bits, but audio’s going to be a pretty small part of it. We’ll bump up audio quality to 1, and use the rest for video.

Settings

There’s not much to do from there. We set peak and average where we want them. There’s no random access during the scene, so we’ll use percentage changed as the only way to add new key frames. And we specify an End frame to trim off the excess black at the end of the source. And we specify an End frame to trim off the excess black at the end of the source. Final settings are shown in Figure 21.1.

Figure 21.1 Final settings for our tutorial. The layout can be pretty confusing; the height/width on the far right set final frame size, and the middle height/width are for cropping.

image

And once we’ve done our encode, we need to go back and make sure we hit our target bitrate. Bink includes this very handy analysis graphing tool (Figure 21.2). We can see we’re well under the 750 KBytes/sec target.

Figure 21.2 Bink’s graphs aren’t just pretty—they’re very useful for verifying that you’re not blowing your bitrate budget.

image

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.12.160.63