AlexxIT/go2rtc · error

ffmpeg: unsupported params:

Error message

ffmpeg: unsupported params: 

What it means

ffmpeg.NewProducer consumes an existing FFmpeg process output and supports only a single audio track and no explicit video-track selection query. If the URL's fragment contains a video parameter, or more/less than exactly one audio parameter, the producer refuses to build, reporting the offending parameter fragment.

Solutions

  1. Remove the video parameter from the URL fragment
  2. Keep exactly one audio parameter in the fragment (or none)
  3. If multiple audio tracks are needed, remux/select tracks before feeding go2rtc

Example fix

// before
rtsp://cam/stream#video=h264#audio=aac#audio=mp3
// after
rtsp://cam/stream#audio=aac
Defensive patterns

Strategy: validation

Validate before calling

q := streams.ParseQuery(fragment)
if len(q["video"]) != 0 || len(q["audio"]) != 1 { return errors.New("need exactly one audio param and no video param") }

Try / catch

p, err := ffmpeg.NewProducer(url); if err != nil && strings.HasPrefix(err.Error(), "ffmpeg: unsupported params") { /* strip/fix fragment and retry */ }

Prevention

When it happens

Trigger: Calling NewProducer with a URL whose #fragment has video=... (any value) or an audio list whose length != 1 (zero or multiple audio= params).

Common situations: Passing multi-audio sources intended for the ffmpeg binary itself; copy-pasted URLs with both video and audio selectors; constructing the URL programmatically and appending duplicate audio params.

Understand the failure class

Background: "Invalid query parameter" / "Failed to parse value of ...": fixing bad query string parameters across APIs — this error's family across 36 libraries.

Related errors


AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07). Data as JSON: /api/errors/dbbf3c0b4d7e598a. Report an issue: GitHub.

Appendix: source

Thrown at internal/ffmpeg/producer.go:31

)

type Producer struct {
	core.Connection
	url    string
	query  url.Values
	ffmpeg core.Producer
}

// NewProducer - FFmpeg producer with auto selection video/audio codec based on client capabilities
func NewProducer(url string) (core.Producer, error) {
	p := &Producer{}

	i := strings.IndexByte(url, '#')
	p.url, p.query = url[:i], streams.ParseQuery(url[i+1:])

	// ffmpeg.NewProducer support only one audio
	if len(p.query["video"]) != 0 || len(p.query["audio"]) != 1 {
		return nil, errors.New("ffmpeg: unsupported params: " + url[i:])
	}

	p.ID = core.NewID()
	p.FormatName = "ffmpeg"
	p.Medias = []*core.Media{
		{
			// we can support only audio, because don't know FmtpLine for H264 and PayloadType for MJPEG
			Kind:      core.KindAudio,
			Direction: core.DirectionRecvonly,
			// codecs in order from best to worst
			Codecs: []*core.Codec{
				// OPUS will always marked as OPUS/48000/2
				{Name: core.CodecOpus, ClockRate: 48000, Channels: 2},
				{Name: core.CodecPCML, ClockRate: 16000},
				{Name: core.CodecPCM, ClockRate: 16000},
				{Name: core.CodecPCMA, ClockRate: 16000},
				{Name: core.CodecPCMU, ClockRate: 16000},
				{Name: core.CodecPCML, ClockRate: 8000},

View on GitHub (pinned to c245815e75)