OBS Studio: Difference between revisions

From NixOS Wiki
imported>Wackbyte
add a guide for installing plugins
Klinger (talk | contribs)
m link to Droidcamera wiki article added
 
(5 intermediate revisions by 5 users not shown)
Line 1: Line 1:
[https://obsproject.com/ OBS Studio] is free and open source software for video recording and live streaming, licensed under the GNU GPLv2 license.
[https://obsproject.com/ OBS Studio] is free and open-source software for video recording and live streaming, licensed under the GNU GPLv2 license.


=== Installing Plugins ===
=== Installing Plugins ===
Line 8: Line 8:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
pkgs.wrapOBS.override { obs-studio = pkgs.obs-studio; } {
environment.systemPackages = [
  plugins = with pkgs.obs-studio-plugins; [
  (pkgs.wrapOBS {
    wlrobs
    plugins = with pkgs.obs-studio-plugins; [
  ];
      wlrobs
};
      obs-backgroundremoval
      obs-pipewire-audio-capture
    ];
  })
];
</syntaxhighlight>
</syntaxhighlight>


Line 24: Line 28:
     plugins = with pkgs.obs-studio-plugins; [
     plugins = with pkgs.obs-studio-plugins; [
       wlrobs
       wlrobs
      obs-backgroundremoval
      obs-pipewire-audio-capture
     ];
     ];
   };
   };
}
}
</syntaxhighlight>
</syntaxhighlight>
Including both <code>obs-studio</code> and <code>(pkgs.wrapOBS {...</code> in <code>environment.systemPackages</code> will result in a package collision; if plugins are needed, only include the "wrapped" version, which sets the plugins directory to include Nix-managed plugins (see [https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/video/obs-studio/wrapper.nix pkgs/applications/video/obs-studio/wrapper.nix].


=== Using the Virtual Camera ===
=== Using the Virtual Camera ===


The virtual camera requires the <code>v4l2loopback</code> [[Linux kernel#Custom kernel modules|kernel module]] to be installed, like so:
The virtual camera requires the <code>v4l2loopback</code> [[Linux kernel#Custom kernel modules|kernel module]] to be installed, a loopback device configured, and polkit enabled so OBS can access the virtual device:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
Line 39: Line 47:
     v4l2loopback
     v4l2loopback
   ];
   ];
  boot.extraModprobeConfig = ''
    options v4l2loopback devices=1 video_nr=1 card_label="OBS Cam" exclusive_caps=1
  '';
  security.polkit.enable = true;
}
}
</syntaxhighlight>
</syntaxhighlight>
It is possible to use [[Droidcam]] as virtual camera.


[[Category:Applications]]
[[Category:Applications]]

Latest revision as of 18:01, 18 June 2024

OBS Studio is free and open-source software for video recording and live streaming, licensed under the GNU GPLv2 license.

Installing Plugins

Plugins are available from the obs-studio-plugins package set.

They can be installed by either wrapping the package with wrapOBS:

environment.systemPackages = [
  (pkgs.wrapOBS {
    plugins = with pkgs.obs-studio-plugins; [
      wlrobs
      obs-backgroundremoval
      obs-pipewire-audio-capture
    ];
  })
];

or using Home Manager:

{ config, pkgs, ... }:
{
  programs.obs-studio = {
    enable = true;
    plugins = with pkgs.obs-studio-plugins; [
      wlrobs
      obs-backgroundremoval
      obs-pipewire-audio-capture
    ];
  };
}

Including both obs-studio and (pkgs.wrapOBS {... in environment.systemPackages will result in a package collision; if plugins are needed, only include the "wrapped" version, which sets the plugins directory to include Nix-managed plugins (see pkgs/applications/video/obs-studio/wrapper.nix.

Using the Virtual Camera

The virtual camera requires the v4l2loopback kernel module to be installed, a loopback device configured, and polkit enabled so OBS can access the virtual device:

{ config, ... }:
{
  boot.extraModulePackages = with config.boot.kernelPackages; [
    v4l2loopback
  ];
  boot.extraModprobeConfig = ''
    options v4l2loopback devices=1 video_nr=1 card_label="OBS Cam" exclusive_caps=1
  '';
  security.polkit.enable = true;
}

It is possible to use Droidcam as virtual camera.