Repository navigation
Description
Describe the bug
With room.enabled_codecs restricted to H.264 for video, desktop Firefox on Linux joins the room but its camera track can't be decoded by any subscriber: they see a blank tile. The server registers the track's codec as video/rtx while H.264 packets arrive.
Two things combine:
-
The static client configuration disables H.264 publishing for desktop Linux Firefox.
pkg/clientconfiguration/conf.godisablesvideo/h264publish for(c.browser == "firefox" || c.browser == "firefox mobile") && (c.os == "linux" || c.os == "android"). That rule came from Remove un-preferred codecs for android firefox #2183 / Disable h264 for android firefox #2190, which were about Firefox for Android ("Android firefox don't comply with the codec order in answer sdp and has problem to publish h.264"). But the user agent parser reports Firefox for Android asos: "Android"(browser: "Firefox Mobile"), so thelinuxclause only ever matches desktop Linux Firefox. That browser publishes H.264 through OpenH264. In our test it encoded H.264 with all three simulcast layers (q/h/f) without trouble.uap-go output, as used by
AugmentClientInfo:browser="Firefox" os="Linux" <- Mozilla/5.0 (X11; Linux x86_64; rv:156.0) Gecko/20100101 Firefox/156.0 browser="Firefox Mobile" os="Android" <- Mozilla/5.0 (Android 14; Mobile; rv:131.0) Gecko/131.0 Firefox/131.0 browser="Firefox Mobile" os="Android" <- Mozilla/5.0 (Android 10; Tablet; rv:120.0) Gecko/120.0 Firefox/120.0 -
selectAlternativeVideoCodeccan pickvideo/rtx. With H.264 removed, the participant's enabled publish codecs are[video/rtx, audio/opus, audio/red]. The client requests VP8, which isn't enabled, soselectAlternativeVideoCodec(pkg/rtc/mediaengine.go) returns the first entry with avideo/prefix, and that's RTX. RTX (and ULPFEC/FlexFEC) can never be a track's codec. The function should skip them and fall back to VP8 as its comment intends.
Server
- Version: 1.13.6 (the same code is on
masterat edb19c9) - Environment: self-hosted, single node, arm64
- Config:
room: auto_create: false enabled_codecs: - mime: audio/opus - mime: audio/red - mime: video/h264
Client
- SDK: JS (client-sdk-js 2.22.3), via Element Call
- Browser: Firefox 156 on Fedora Linux, OpenH264 installed. The other participant was Element X on Android (JS SDK in a WebView), which published
video/H264fine.
To reproduce
- Configure
enabled_codecsas above. - Join from desktop Firefox on Linux with the camera on, requesting the default VP8, and from any other client.
- The other client shows a blank tile for the Firefox participant.
Expected behavior
Desktop Linux Firefox publishes H.264, as allowed by enabled_codecs. Failing that, the server should never register a track as video/rtx.
Server log (participant identities redacted)
INFO livekit.pub rtc/participant.go:3055 falling back to alternative video codec
{"participantID": "PA_uVovgeuv2Rrz", "codec": "video/vp8", "altCodec": "video/rtx",
"enabledPublishCodecs": [{"mime": "video/rtx"}, {"mime": "audio/opus"}, {"mime": "audio/red"}]}
INFO livekit.pub rtc/participant.go:2413 mediaTrack published
{"participantID": "PA_uVovgeuv2Rrz", "kind": "video", "rid": "q", "mime": "video/H264", ...}
WARN livekit.pub rtc/mediatrack.go:386 could not find codec for webrtc receiver
{"participantID": "PA_uVovgeuv2Rrz", "mime": "video/H264",
"track": {..., "simulcast": true, "codecs": [{"mimeType": "video/rtx", ...}]}}
The warning repeated once per simulcast layer, on every rejoin.
Additional context
- A related failure: with only
video/h265enabled, desktop Firefox (which has no WebRTC H.265) can't join at all. Publisher negotiation fails withcreate answer failed: unable to populate media section, RTPSender created with no codecs→NEGOTIATE_FAILED. That's probably expected for an unsupported codec, and is listed here only for completeness. - client-sdk-js has a similar pattern:
setEnabledPublishCodecskeeps everyvideo/*entry and the publish fallback takesenabledPublishVideoCodecs[0]. It didn't trigger here becausevideo/h264was listed beforevideo/rtx, but it looks like it could pick RTX in the same way. - Firefox for Android may still have the H.264 problems that Remove un-preferred codecs for android firefox #2183 worked around: Mozilla bugs 2073068 and 2014007 are open. So the fix PR keeps the rule for Android and only drops the
linuxclause.
I have a fix with tests ready (narrowing the rule to Android, and skipping RTX/FEC in the fallback) and will open a PR referencing this issue.
Activity
biglittlebigben commentedon Oct 5, 2026
See comments to #4934 (comment)
krithin commentedon Oct 6, 2026
Ah I see - yeah the partial fix you merged makes sense. I'd been hoping that Cisco's OpenH264 was available on all desktop linux distros, and so unblocking h.264 wouldn't be a problem, but I trust that you have actual data on whether that's true.
Also, for larger context if it's helpful: I went down this route because I run a self-hosted livekit alongside Element Call with my own Matrix homeserver, and when I get on video calls with family members who use iPhones they complain that their phones get really hot, presumably because software VP8 encoding uses a lot of power on an iPhone. So I want them to at least be able to send h.264 video instead, since that has hardware encoding support on iPhones, and the combination of my patch in #4934 plus setting the server's config to only list
mime: video/h264under enabled_codecs seemed to do the trick.Is there any other way that I can allow calls between iPhones and desktop Linux to avoid using VP8? Otherwise I'm happy to keep running my forked livekit with the patch that unblocks h.264 on linux.
boks1971 commentedon Oct 6, 2026
Thank you @krithin . Unfortunately, the matrix is fairly wide to be sure about what works. And there are versions.
I am okay enabling H.264 for desktop Linux and probably be more restrictive if there are findings of non-working combinations.
boks1971 commentedon Oct 6, 2026
Available in https://github.com/livekit/livekit/releases/tag/v1.13.8. Please let us know how it goes.
krithin commentedon Oct 7, 2026
This looks great! I reverted my local patch and upgraded my self-hosted livekit to your release 1.13.8, and have confirmed that after limiting enabled_codecs to
mime: video/h264I was able to have a call between desktop firefox on linux and element x on a phone that used h.264 instead of VP8. Thanks for picking this up so quickly!