Documentation
¶
Overview ¶
Package bik reads RAD Game Tools Bink (.bik) video headers — the cutscene format TA: Kingdoms uses in place of the Smacker (.zrb) videos shipped with the original Total Annihilation.
Like the smacker package, this reader parses the container header natively (geometry, frame counts, frame rate, audio tracks) but does not decode the compressed video bitstream: Bink uses a proprietary DCT-based codec with no open-source encoder. Pixel decoding and conversion are delegated to FFmpeg, which ships a Bink 1 decoder (binkvideo + binkaudio_dct/rdft). Because no Bink encoder exists outside RAD's own tools, conversion is decode-only — the reverse of smacker.ConvertFromMP4 is intentionally absent.
Index ¶
- Constants
- func ConvertToMP4(bikPath, mp4Path string) error
- func FFmpegAvailable() bool
- type AudioTrack
- type Header
- type Reader
- func (r *Reader) Close() error
- func (r *Reader) Duration() float64
- func (r *Reader) FrameCount() int
- func (r *Reader) FrameRate() float64
- func (r *Reader) HasAlpha() bool
- func (r *Reader) HasAudio() bool
- func (r *Reader) Header() *Header
- func (r *Reader) Height() int
- func (r *Reader) Info() string
- func (r *Reader) IsGrayscale() bool
- func (r *Reader) Version() string
- func (r *Reader) Width() int
Constants ¶
const HeaderMinSize = 44
HeaderMinSize is the smallest valid Bink header (no audio tracks): the 44-byte fixed prefix up to and including the audio-track count.
Variables ¶
This section is empty.
Functions ¶
func ConvertToMP4 ¶
ConvertToMP4 decodes a Bink video to MP4 using FFmpeg, which ships a native Bink 1 decoder (binkvideo plus binkaudio_dct/binkaudio_rdft). The encode settings mirror the Smacker converter: visually-lossless H.264 (CRF 18) and high-fidelity AAC audio.
func FFmpegAvailable ¶
func FFmpegAvailable() bool
FFmpegAvailable reports whether an ffmpeg binary is on the PATH.
Types ¶
type AudioTrack ¶
type AudioTrack struct {
SampleRate int // samples per second
Channels int // 1 (mono) or 2 (stereo)
Bits int // 8 or 16
Codec string // "DCT" or "RDFT"
ID uint32 // track identifier from the trailing ID table
}
AudioTrack describes one Bink audio stream.
type Header ¶
type Header struct {
Revision byte // the 4th signature byte: 'b','d','f','g','h','i','k', …
FileSize uint32
Frames uint32
LargestFrame uint32
Width uint32
Height uint32
FPSNum uint32
FPSDen uint32
VideoFlags uint32
AudioTracks []AudioTrack
}
Header holds the parsed fields of a Bink container header.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader wraps an open Bink file and its parsed header.
func OpenReader ¶
OpenReader opens a Bink video file and parses its header.
func (*Reader) FrameCount ¶
FrameCount returns the number of video frames.
func (*Reader) FrameRate ¶
FrameRate returns the frame rate in frames per second. Bink stores the rate as a numerator/denominator pair, so the result can be fractional.
func (*Reader) IsGrayscale ¶
IsGrayscale reports whether frames are luma-only.