Skip to content

Desktop Linux Firefox can't publish video when enabled_codecs only lists H.264 (track registered as video/rtx) #4929

Closed

Description

@krithin

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:

  1. The static client configuration disables H.264 publishing for desktop Linux Firefox. pkg/clientconfiguration/conf.go disables video/h264 publish 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 as os: "Android" (browser: "Firefox Mobile"), so the linux clause 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
    
  2. selectAlternativeVideoCodec can pick video/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, so selectAlternativeVideoCodec (pkg/rtc/mediaengine.go) returns the first entry with a video/ 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 master at 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/H264 fine.

To reproduce

  1. Configure enabled_codecs as above.
  2. Join from desktop Firefox on Linux with the camera on, requesting the default VP8, and from any other client.
  3. 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/h265 enabled, desktop Firefox (which has no WebRTC H.265) can't join at all. Publisher negotiation fails with create 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: setEnabledPublishCodecs keeps every video/* entry and the publish fallback takes enabledPublishVideoCodecs[0]. It didn't trigger here because video/h264 was listed before video/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 linux clause.

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

  1. biglittlebigben commented on Oct 5, 2026

    @biglittlebigben
    Contributor

    See comments to #4934 (comment)

  2. krithin commented on Oct 6, 2026

    @krithin
    Author

    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/h264 under 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.

  3. boks1971 commented on Oct 6, 2026

    @boks1971
    Contributor

    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.

  4. boks1971 commented on Oct 6, 2026

    @boks1971
    Contributor
  5. krithin commented on Oct 7, 2026

    @krithin
    Author

    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/h264 I 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions