Jellyfin: Difference between revisions

From NixOS Wiki
fix links
Ponder (talk | contribs)
m Copyedit throughout, mend copy/paste from Plex
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Jellyfin is the volunteer-built media solution that puts you in control of your media. Stream to any device from your own server, with no strings attached.
Jellyfin is the volunteer-built media solution that puts you in control of your media. Stream to any device from your own server, with no strings attached.


== Installing & Initial Configuration & Setup ==
== Installation and configuration ==


To get up and running with Jellyfin, add the packages <code>pkgs.jellyfin</code> <code>pkgs.jellyfin-web</code> & <code>pkgs.jellyfin-ffmpeg</code> to your `configuration.nix` file as shown below.
To get up and running with Jellyfin, add the packages <code>pkgs.jellyfin</code> <code>pkgs.jellyfin-web</code> & <code>pkgs.jellyfin-ffmpeg</code> to your `configuration.nix` file as shown below.
Line 27: Line 27:
</syntaxHighlight>
</syntaxHighlight>


Once you have included the correct packages to be installed, and enabled and configured Jellyfin to your liking, then rebuild your system for changes to take effect.
Once you have included the packages to be installed, and enabled and configured Jellyfin to your liking, then rebuild your system for changes to take effect.
<syntaxHighlight lang=bash>$ sudo nixos-rebuild switch</syntaxHighlight>
<syntaxHighlight lang=bash>$ sudo nixos-rebuild switch</syntaxHighlight>


After the rebuild is complete Jellyfin should be running, verify that it is with the following command.
After the rebuild is complete, Jellyfin should be running. Verify that it is with the following command.
<syntaxHighlight lang=bash>$ sudo systemctl status jellyfin</syntaxHighlight>
<syntaxHighlight lang=bash>$ sudo systemctl status jellyfin</syntaxHighlight>


<b>If jellyfin is not running</b> you should be able to start it by simply running <code>jellyfin</code> in your terminal.
If jellyfin is not running you should be able to start it by running <code>jellyfin</code> in your terminal.
<syntaxHighlight lang=bash>$ jellyfin</syntaxHighlight>
<syntaxHighlight lang=bash>$ jellyfin</syntaxHighlight>


Finally. After you've verified that Jellyfin is running you can start the configuration process.
After you've verified that Jellyfin is running you can start the configuration process.
* The Jellyfin server should be running on port 8096.
* The Jellyfin server should be running on port 8096.
* Go to http://localhost:8096 if your setting this up on your primary computer or want to test your build locally.  
* Go to http://localhost:8096 if you are setting this up on your primary computer or want to test your build locally.
* If you're logging into a remote server, replace localhost with the ip address of the server.
* If you're logging into a remote server, replace localhost with the ip address of the server.


=== Allow Jellyfin to read external drives ===
=== Allow Jellyfin to read external drives ===


You might encounter permission issues when you try to access external drives if you haven't configured anything else with the server yet. If you haven't explicitly set up a mounting configuration for your drives and instead have your desktop environment (e.g. GNOME or KDE) automatically mount it when you try accessing it via their file explorers, Jellyfin won't be able to access the drive. This is because the desktop environment mounts it to your user, while Jellyfin uses by default the "jellyfin" user.
You might encounter permission issues when you try to access external drives if you haven't configured anything else with the server yet. If you haven't explicitly set up a mounting configuration for your drives and instead let your desktop environment (e.g. GNOME or KDE) automatically mount it when you try accessing it via their file explorers, Jellyfin won't be able to access the drive. This is because the desktop environment mounts it to your user, while Jellyfin runs by default as the "jellyfin" user.


The easiest way to allow it to see these external drives mounted is to change the service's user . Here is an example:
The easiest way to allow it to see these external drives is to change the service's user . Here is an example:
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
   services.jellyfin = {
   services.jellyfin = {
Line 54: Line 54:
</syntaxhighlight>
</syntaxhighlight>


If you have changed the user option after you have already installed Jellyfin, you have to change the permissions of the folder /var/lib/jellyfin via chown to the user you set it to by doing this:
If you have changed the user option after you have already installed Jellyfin, you have to change the ownership of the folder /var/lib/jellyfin to the user you set it to by doing this:
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
   sudo chown -R /var/lib/jellyfin  
   sudo chown -R /var/lib/jellyfin  
</syntaxhighlight>
</syntaxhighlight>


The alternative to this is to explicitly mount the drives via [[Filesystems]], but takes more effort to set up and requires every new drive you want plex to see to be explicitly declared, but allows more control in what Plex is allowed to see.
The alternative is to explicitly mount the drives via [[Filesystems]]. This takes more effort to set up and requires every new drive to be explicitly declared, but allows more control in what Jellyfin is allowed to see.


== Hardware Transcoding ==
=== Intro Skipper plugin ===
In most cases you want to make most of your hardware. Modern boards often come with Hardware Accelerators, all you need to do is enable it!
If you install the Intro Skipper plugin, it will not be able to display the skip button in the web interface. This is due to the plugin being unable to modify contents of files in the nix store. To get around this you can make the changes yourself with this:
<syntaxhighlight lang="nix">
  nixpkgs.overlays = with pkgs; [
    (
      final: prev:
        {
          jellyfin-web = prev.jellyfin-web.overrideAttrs (finalAttrs: previousAttrs: {
            installPhase = ''
              runHook preInstall
 
              # this is the important line
              sed -i "s#</head>#<script src=\"configurationpage?name=skip-intro-button.js\"></script></head>#" dist/index.html
 
              mkdir -p $out/share
              cp -a dist $out/share/jellyfin-web
 
              runHook postInstall
            '';
          });
        }
    )
  ];
 
</syntaxhighlight>
 
== Hardware transcoding ==
In most cases you want to make most of your hardware. Modern boards often come with a hardware accelerator, all you need to do is enable it!


Source: https://jellyfin.org/docs/general/administration/hardware-acceleration.html
Source: https://jellyfin.org/docs/general/administration/hardware-acceleration.html


=== VAAPI ===
=== VAAPI and Intel QSV ===
VAAPI is often available on intel boards (Intel HD).
 
VAAPI and QSV is often available on platforms with Intel GPUs but need their corresponding packages in <code>hardware.graphics.extraPackages</code>.


<syntaxHighlight lang=nix>
<syntaxHighlight lang=nix>
Line 76: Line 103:
     vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
     vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
   };
   };
   hardware.opengl = {
   hardware.graphics = { # hardware.opengl in 24.05
     enable = true;
     enable = true;
     extraPackages = with pkgs; [
     extraPackages = with pkgs; [
       intel-media-driver
       intel-media-driver
       vaapiIntel
       intel-vaapi-driver # previously vaapiIntel
       vaapiVdpau
       vaapiVdpau
      libvdpau-va-gl
       intel-compute-runtime # OpenCL filter support (hardware tonemapping and subtitle burn-in)
       intel-compute-runtime # OpenCL filter support (hardware tonemapping and subtitle burn-in)
      vpl-gpu-rt # QSV on 11th gen or newer
      intel-media-sdk # QSV up to 11th gen
     ];
     ];
   };
   };
Line 92: Line 120:
</syntaxHighlight>
</syntaxHighlight>


Related:  [[Accelerated_Video_Playback]]
Related:  [[Accelerated Video Playback]] and [[Intel Graphics]]
 
[[Category:Server]]
[[Category:Applications]]

Latest revision as of 10:09, 26 August 2024

Jellyfin is the volunteer-built media solution that puts you in control of your media. Stream to any device from your own server, with no strings attached.

Installation and configuration

To get up and running with Jellyfin, add the packages pkgs.jellyfin pkgs.jellyfin-web & pkgs.jellyfin-ffmpeg to your `configuration.nix` file as shown below.

{
  services.jellyfin.enable = true;
  environment.systemPackages = [
    pkgs.jellyfin
    pkgs.jellyfin-web
    pkgs.jellyfin-ffmpeg
  ];
}

If you want more advanced configuration, use something like what's shown below and see the docs for more configuration options

{
  services.jellyfin = {
    enable = true;
    openFirewall = true;
  };
}

Once you have included the packages to be installed, and enabled and configured Jellyfin to your liking, then rebuild your system for changes to take effect.

$ sudo nixos-rebuild switch

After the rebuild is complete, Jellyfin should be running. Verify that it is with the following command.

$ sudo systemctl status jellyfin

If jellyfin is not running you should be able to start it by running jellyfin in your terminal.

$ jellyfin

After you've verified that Jellyfin is running you can start the configuration process.

  • The Jellyfin server should be running on port 8096.
  • Go to http://localhost:8096 if you are setting this up on your primary computer or want to test your build locally.
  • If you're logging into a remote server, replace localhost with the ip address of the server.

Allow Jellyfin to read external drives

You might encounter permission issues when you try to access external drives if you haven't configured anything else with the server yet. If you haven't explicitly set up a mounting configuration for your drives and instead let your desktop environment (e.g. GNOME or KDE) automatically mount it when you try accessing it via their file explorers, Jellyfin won't be able to access the drive. This is because the desktop environment mounts it to your user, while Jellyfin runs by default as the "jellyfin" user.

The easiest way to allow it to see these external drives is to change the service's user . Here is an example:

  services.jellyfin = {
    enable = true;
    openFirewall = true;
    user="yourusername";
  };

If you have changed the user option after you have already installed Jellyfin, you have to change the ownership of the folder /var/lib/jellyfin to the user you set it to by doing this:

  sudo chown -R /var/lib/jellyfin

The alternative is to explicitly mount the drives via Filesystems. This takes more effort to set up and requires every new drive to be explicitly declared, but allows more control in what Jellyfin is allowed to see.

Intro Skipper plugin

If you install the Intro Skipper plugin, it will not be able to display the skip button in the web interface. This is due to the plugin being unable to modify contents of files in the nix store. To get around this you can make the changes yourself with this:

  nixpkgs.overlays = with pkgs; [
    (
      final: prev:
        {
          jellyfin-web = prev.jellyfin-web.overrideAttrs (finalAttrs: previousAttrs: {
            installPhase = ''
              runHook preInstall

              # this is the important line
              sed -i "s#</head>#<script src=\"configurationpage?name=skip-intro-button.js\"></script></head>#" dist/index.html

              mkdir -p $out/share
              cp -a dist $out/share/jellyfin-web

              runHook postInstall
            '';
          });
        }
    )
  ];

Hardware transcoding

In most cases you want to make most of your hardware. Modern boards often come with a hardware accelerator, all you need to do is enable it!

Source: https://jellyfin.org/docs/general/administration/hardware-acceleration.html

VAAPI and Intel QSV

VAAPI and QSV is often available on platforms with Intel GPUs but need their corresponding packages in hardware.graphics.extraPackages.

{ pkgs, lib,config, ... }:
{
  # 1. enable vaapi on OS-level
  nixpkgs.config.packageOverrides = pkgs: {
    vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
  };
  hardware.graphics = { # hardware.opengl in 24.05
    enable = true;
    extraPackages = with pkgs; [
      intel-media-driver
      intel-vaapi-driver # previously vaapiIntel
      vaapiVdpau
      intel-compute-runtime # OpenCL filter support (hardware tonemapping and subtitle burn-in)
      vpl-gpu-rt # QSV on 11th gen or newer
      intel-media-sdk # QSV up to 11th gen
    ];
  };

  # 2. do not forget to enable jellyfin
  services.jellyfin.enable = true;
}

Related: Accelerated Video Playback and Intel Graphics