AlexxIT/go2rtc · error
rtmp: read command
Error message
rtmp: read command %x
What it means
Framing guards in RTMP acceptCommand: the decoded AMF0 items are fewer than two, or the first item is not a string command name, so the RTMP command message is malformed. The raw bytes are the faulting input.
Solutions
- Verify the publisher speaks standard AMF0-encoded RTMP commands
- Inspect the raw bytes to identify the encoder producing malformed commands
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pkg/rtmp/server.go:133 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/ff368178311afc01.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/rtmp/server.go:133
const (
CommandConnect = "connect"
CommandReleaseStream = "releaseStream"
CommandFCPublish = "FCPublish"
CommandCreateStream = "createStream"
CommandPublish = "publish"
CommandPlay = "play"
)
func (c *Conn) acceptCommand(b []byte) error {
items, err := amf.NewReader(b).ReadItems()
if err != nil {
return nil
}
//log.Printf("%#v", items)
if len(items) < 2 {
return fmt.Errorf("rtmp: read command %x", b)
}
cmd, ok := items[0].(string)
if !ok {
return fmt.Errorf("rtmp: read command %x", b)
}
tID, ok := items[1].(float64) // transaction ID
if !ok {
return fmt.Errorf("rtmp: read command %x", b)
}
switch cmd {
case CommandConnect:
if len(items) == 3 {
if v, ok := items[2].(map[string]any); ok {
c.App, _ = v["app"].(string)
}View on GitHub (pinned to c245815e75)