RF64
Chunk sizes in a WAV file are 32-bit, so a file stops at 4 GB: a little over 4 hours of stereo audio at 48 kHz and 24 bits. RF64, defined by the EBU in Tech 3306, keeps the WAV layout and adds a chunk with 64-bit sizes.
How it differs
- The file starts
RF64instead ofRIFF, and the RIFF size is set to0xFFFFFFFF. - A
ds64chunk comes first, straight afterWAVE, holding the real sizes. - The data chunk’s size, and any other size too large for 32 bits, is set to
0xFFFFFFFF, meaning “look inds64”.
The ds64 chunk
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 4 | char[4] | ckID | ds64 |
| 4 | 4 | u32 | ckSize | 28 + 12 × tableLength |
| 8 | 8 | u64 | riffSize | the real RIFF size: the file size minus 8 |
| 16 | 8 | u64 | dataSize | the real size of the data chunk |
| 24 | 8 | u64 | sampleCount | the real value for the fact chunk |
| 32 | 4 | u32 | tableLength | the number of entries that follow |
| 36 | 12 each | record | table | for any other large chunk: its ID (4 bytes) and its 64-bit size |
00000000 52 46 36 34 FF FF FF FF 57 41 56 45 64 73 36 34 RF64....WAVEds64
00000010 1C 00 00 00 48 F2 05 2A 01 00 00 00 00 F2 05 2A ....H..*.......*
00000020 01 00 00 00 80 7C 81 4A 00 00 00 00 00 00 00 00 .....|.J........
Here riffSize is 5,000,000,072, dataSize is 5,000,000,000,
sampleCount is 1,250,000,000 frames and the table is empty. The format
chunk follows at offset 48, then a data chunk whose size reads
FF FF FF FF.
The JUNK chunk trick
A recorder does not know in advance whether a file will pass 4 GB. So it writes an
ordinary WAV file with a 28-byte JUNK chunk straight after the RIFF header,
the same size as an empty ds64. If the recording stays small, the file is a
normal WAV. If it grows past 4 GB, the recorder changes RIFF to
RF64 and JUNK to ds64, and fills in the 64-bit
sizes, without moving any audio.
BW64 and Wave64
BW64, from ITU-R BS.2088, has the same layout with the ID BW64, and adds
chunks for describing object-based and immersive audio. Sony’s Wave64
(.w64) is a separate format that solves the same problem with 64-bit sizes
and GUIDs as chunk IDs.