Install codecs for Firefox / Librewolf

I’m using LibreWolf with NixOS 22.05. I can play regular youtube videos but youtube live streams and videos on fail with LibreWolf telling me to install additional codecs.

Several help forums advised to install ffmpeg. I had it installed already but to no avail (NixOS works differently anyway).

Right now, i have LibreWolf set up like this:

  programs.firejail.enable = true;
  programs.firejail.wrappedBinaries = {

    librewolf = {
      executable = "${pkgs.lib.getBin pkgs.librewolf}/bin/librewolf";
      profile = pkgs.writeText "librewolf.local" ''
        noblacklist ''${DOWNLOADS}
        whitelist ''${DOWNLOADS}
        # Add the next line to your librewolf.local to enable native notifications. org.freedesktop.Notifications
        # Add the next line to your librewolf.local to allow inhibiting screensavers. org.freedesktop.ScreenSaver
        # Add the next lines to your librewolf.local for plasma browser integration.
        dbus-user.own org.mpris.MediaPlayer2.plasma-browser-integration org.kde.JobViewServer org.kde.kuiserver
        include librewolf.profile

I noticed that in the source file of LibreWolf there is

      ffmpegSupport = browser.ffmpegSupport or false;
      gssSupport = browser.gssSupport or false;
      alsaSupport = browser.alsaSupport or false;
      pipewireSupport = browser.pipewireSupport or false;
      sndioSupport = browser.sndioSupport or false;
      jackSupport = browser.jackSupport or false;
      # PCSC-Lite daemon (services.pcscd) also must be enabled for firefox to access smartcards
      smartcardSupport = cfg.smartcardSupport or false;

Would it help to enable them? How do i enable them?

I’m still learning Nix and tried the following:

  nixpkgs.config = {
    allowUnfree = true;
    librewolf = {
      ffmpegSupport = true;
      pipewireSupport = true;

This didn’t help but also didn’t throw an error (i was quite surprised :joy:).

Does someone know how to add additional codecs to Firefox / LibreWolf in NixOS?

Firefox packaging is a bit complicated. You found the generic wrapper; the actual librewolf definition lives here: nixpkgs/default.nix at 75dc8da20c96011951f87a49d2a95fb622717dc4 · NixOS/nixpkgs · GitHub

The browser argument to the wrapper is the result of that build. This build in turn is performed with the function defined in this file: nixpkgs/common.nix at b47d4447dc2ba34f793436e6631fbdd56b12934a · NixOS/nixpkgs · GitHub

Note that, crucially, ffmpegSupport is not disabled in that build script by default. Its build result will be passed to the other file you saw, with ffmpegSupport set to true by default. Disabling it is possible, but a tad more tricky than I want to show right now (since you need to override both the unwrapped and wrapped versions).

So, ffmpegSupport should be enabled for you. I suspect firejail is the issue here.

Yeah, nixpkgs.config is freeform and will allow any values.

Thank you for your explanation and suggestion!

You are right, firejail was to blame, kind of (took me a while to figure it out):

I had a “Pin to taskbar” shortcut in my Plasma taskbar that i launched LibreWolf from most of the time. This shortcut was created with the un-firejailed LibreWolf running.

After firejailing LibreWolf, i could still launch it from the shortcut but apparently in a somehow different way. The codecs just didn’t work.

I noticed that they worked when i launched LibreWolf from the terminal and then realized, that is has got something to do with the shortcut. With thunderbird i have a similar issue. I now deleted the old shortcut and made a new “Pin to taskbar” shortcut and the codecs work fine.

Sorry for the confusion, you couldn’t have known.

1 Like