pion/webrtc · error
IVF signature mismatch
Error message
IVF signature mismatch
What it means
The IVF reader's parseFileHeader rejects a file whose first 4 bytes do not equal the required IVF signature "DKIF". It is a sentinel error fired by a generic guard whenever NewWith is given a stream that is not an IVF container (wrong format, truncated, or shifted data).
Source
Thrown at pkg/media/ivfreader/ivfreader.go:25
if header.signature != ivfFileHeaderSignature {
return nil, errSignatureMismatch
} else if header.version != uint16(0) {
return nil, fmt.Errorf("%w: expected(0) got(%d)", errUnknownIVFVersion, header.version)
}
i.bytesReadSuccesfully += int64(bytesRead)
return header, nilView on GitHub (pinned to 8c25dc09fa)
Solutions
- Verify the input file begins with the bytes "DKIF" before parsing.
- Point the code at the correct IVF file or convert the source (e.g. via ffmpeg) to IVF.
- Classify with errors.Is(err, errSignatureMismatch) to report a friendly 'not an IVF file' message.
Example fix
// before
f, _ := os.Open(path)
r, _, _ := ivfreader.NewWith(f)
// after
magic := make([]byte, 4)
io.ReadFull(f, magic)
if string(magic) != "DKIF" {
return fmt.Errorf("%s is not an IVF file", path)
}
f.Seek(0, io.SeekStart)
r, _, err := ivfreader.NewWith(f) Defensive patterns
Strategy: validation
Validate before calling
magic := make([]byte, 4)
if _, err := io.ReadFull(f, magic); err != nil {
return err
}
if string(magic) != "DKIF" {
return fmt.Errorf("%s: not an IVF file (bad magic)", path)
}
f.Seek(0, io.SeekStart) Try / catch
if err == ivfreader.ErrSignatureMismatch {
return fmt.Errorf("input is not an IVF file: %w", err)
} Prevention
- Sniff the first 4 bytes ("DKIF") before parsing any allegedly-IVF input.
- Ensure upload/ingest pipelines enforce the expected container format.
- Don't rely on file extensions; always verify magic bytes.
When it happens
Trigger: NewWith/parseFileHeader on a non-IVF stream: the first four bytes differ from 'D','K','I','F'.
Common situations: Passing WebM/MKV, MP4, OGG, or raw frame dumps where an IVF was expected; wrong file extension; files concatenated with other formats.
Related errors
- stream is nil
- incomplete frame header
- incomplete frame data
- incomplete file header
- IVF version unknown, parser may not parse correctly
AI-assisted analysis of pion/webrtc@8c25dc09fa (2026-09-03).
Data as JSON: /api/errors/dd280dcbd837bf85.
Report an issue: GitHub.