An IVF file starts with one 32-byte header, and the frames follow it directly. All numbers are little-endian. IVF has no published specification: the layout below is what the libvpx and libaom tools write and what FFmpeg reads and writes.
Fields
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 4 | char[4] | signature | always the ASCII bytes DKIF (44 4B 49 46) |
| 4 | 2 | u16 | version | 0 |
| 6 | 2 | u16 | header length | the length of this header in bytes, 32 |
| 8 | 4 | char[4] | codec | the FourCC of the video codec: see codecs |
| 12 | 2 | u16 | width | frame width in pixels |
| 14 | 2 | u16 | height | frame height in pixels |
| 16 | 4 | u32 | time base denominator | the time units per second, see time base |
| 20 | 4 | u32 | time base numerator | the length of one time unit, in the units given by the denominator |
| 24 | 4 | u32 | frame count | the number of frames in the file, see frame count |
| 28 | 4 | u32 | unused | written as 0 and ignored by readers |
Codecs
| FourCC | Bytes | Video codec |
|---|---|---|
VP80 | 56 50 38 30 | VP8 |
VP90 | 56 50 39 30 | VP9 |
AV01 | 41 56 30 31 | AV1 |
FFmpeg’s reader looks the FourCC up in its general table of video codec tags, so an IVF file with another tag can still be read. Only these three are written by the reference tools.
Time base
Frame timestamps count in units of numerator ÷ denominator seconds. A 30 frames per second file written by counting frames has a denominator of 30 and a numerator of 1. The denominator comes first in the file, so reading the two values in the wrong order gives a time base of 30 seconds.
Frame count
Writers put the count here when they finish. FFmpeg writes 0xFFFFFFFF as a
placeholder when it opens the file and goes back to offset 24 at the end, so a file
written to a pipe, where it cannot seek back, keeps the placeholder. Treat this field
as a hint and read frames until the end of the file.
Worked example
A VP9 stream of 1920 × 1080 at 30 frames a second, 300 frames long:
00000000 44 4B 49 46 00 00 20 00 56 50 39 30 80 07 38 04
00000010 1E 00 00 00 01 00 00 00 2C 01 00 00 00 00 00 00
| Offset | Bytes | Value |
|---|---|---|
| 0 | 44 4B 49 46 | DKIF |
| 4 | 00 00 | version 0 |
| 6 | 20 00 | header length 32 |
| 8 | 56 50 39 30 | VP90, so VP9 |
| 12 | 80 07 | width 1920 |
| 14 | 38 04 | height 1080 |
| 16 | 1E 00 00 00 | denominator 30 |
| 20 | 01 00 00 00 | numerator 1, so timestamps are in 1/30 second |
| 24 | 2C 01 00 00 | 300 frames |
| 28 | 00 00 00 00 | unused |