AlexxIT/go2rtc · error
adts: wrong header
Error message
adts: wrong header
What it means
ADTS Producer.Open's format guard: the first ADTSHeaderSize bytes were read successfully but ADTSToCodec could not recognize a valid ADTS sync word/profile, so the input is not an MPEG-2 ADTS audio stream (or is corrupt at the start). Open refuses to build a producer for it.
Solutions
- Confirm the input is actually raw ADTS AAC, not wrapped in a container (MP4/FLV) or another codec
- Check for leading garbage before the first ADTS frame
- Provide the stream via a producer for the correct container format instead
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pkg/aac/producer.go:27 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07).
Data as JSON: /api/errors/e6c1f6f12a9a1107.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/aac/producer.go:27
"github.com/pion/rtp"
)
type Producer struct {
core.Connection
rd *bufio.Reader
}
func Open(r io.Reader) (*Producer, error) {
rd := bufio.NewReader(r)
b, err := rd.Peek(ADTSHeaderSize)
if err != nil {
return nil, err
}
codec := ADTSToCodec(b)
if codec == nil {
return nil, errors.New("adts: wrong header")
}
codec.PayloadType = core.PayloadTypeRAW
medias := []*core.Media{
{
Kind: core.KindAudio,
Direction: core.DirectionRecvonly,
Codecs: []*core.Codec{codec},
},
}
return &Producer{
Connection: core.Connection{
ID: core.NewID(),
FormatName: "adts",
Medias: medias,
Transport: r,
},
rd: rd,View on GitHub (pinned to c245815e75)