Jellyfin: Difference between revisions

Ponder (talk | contribs)
m Copyedit throughout, mend copy/paste from Plex
m Fixed dead link for Jellyfin's official documentation on hardware acceleration.
 
(11 intermediate revisions by 8 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.
[https://jellyfin.org/ Jellyfin] is an open source media server (Jellyfin Server) with several clients (Jellyfin Media Player and web client).


== Installation and configuration ==
== Installation and configuration ==
Line 54: Line 54:
</syntaxhighlight>
</syntaxhighlight>


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:
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">
 
   sudo chown -R /var/lib/jellyfin  
<syntaxhighlight lang="bash">
   sudo chown -R yourusername:yourusername /var/lib/jellyfin
</syntaxhighlight>
 
Additionally, you should also change the ownership of the cache directory to avoid transcoding issues:
 
<syntaxhighlight lang="bash">
  sudo chown -R yourusername:yourusername /var/cache/jellyfin
</syntaxhighlight>
 
Finally, restart Jellyfin for the changes to take effect:
 
<syntaxhighlight lang="bash">
  systemctl restart jellyfin
</syntaxhighlight>
</syntaxhighlight>


Line 90: Line 103:
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!
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/post-install/transcoding/hardware-acceleration/


=== VAAPI and Intel QSV ===
=== VAAPI and Intel QSV ===
Line 96: Line 109:
VAAPI and QSV is often available on platforms with Intel GPUs but need their corresponding packages in <code>hardware.graphics.extraPackages</code>.
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>
You have to choose between <code>intel-vaapi-driver</code> (old driver for pre-Broadwell CPUs) and <code>intel-media-driver</code> depending of your CPU.
 
<syntaxhighlight lang="nix">
{ pkgs, lib,config, ... }:
{ pkgs, lib,config, ... }:
{
{
   # 1. enable vaapi on OS-level
   # 1. enable vaapi on OS-level
   nixpkgs.config.packageOverrides = pkgs: {
   nixpkgs.config.packageOverrides = pkgs: {
     vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
     # Only set this if using intel-vaapi-driver
    intel-vaapi-driver = pkgs.intel-vaapi-driver.override { enableHybridCodec = true; };
   };
   };
   hardware.graphics = { # hardware.opengl in 24.05
   systemd.services.jellyfin.environment.LIBVA_DRIVER_NAME = "iHD"; # Or "i965" if using older driver
  environment.sessionVariables = { LIBVA_DRIVER_NAME = "iHD"; };      # Same here
  hardware.graphics = {
     enable = true;
     enable = true;
     extraPackages = with pkgs; [
     extraPackages = with pkgs; [
       intel-media-driver
       intel-media-driver # For Broadwell (2014) or newer processors. LIBVA_DRIVER_NAME=iHD
       intel-vaapi-driver # previously vaapiIntel
       intel-vaapi-driver # For older processors. LIBVA_DRIVER_NAME=i965
       vaapiVdpau
       libva-vdpau-driver # Previously vaapiVdpau
       intel-compute-runtime # OpenCL filter support (hardware tonemapping and subtitle burn-in)
       intel-compute-runtime # OpenCL filter support (hardware tonemapping and subtitle burn-in)
      # OpenCL support for intel CPUs before 12th gen
      # see: https://github.com/NixOS/nixpkgs/issues/356535
      intel-compute-runtime-legacy1
       vpl-gpu-rt # QSV on 11th gen or newer
       vpl-gpu-rt # QSV on 11th gen or newer
       intel-media-sdk # QSV up to 11th gen
       intel-media-sdk # QSV up to 11th gen
      intel-ocl # OpenCL support
     ];
     ];
   };
   };
Line 118: Line 140:
   services.jellyfin.enable = true;
   services.jellyfin.enable = true;
}
}
</syntaxHighlight>
</syntaxhighlight>
 
==== Troubleshooting VAAPI and Intel QSV ====
You can check supported vaapi profile supported by your CPU / driver with : <code>nix-shell -p libva-utils --run vainfo</code>. If
 
You can check the OpenCL properties and devices available on the system with : <code>nix-shell -p clinfo --run clinfo</code>. If clinfo shows <code>Number of platforms 0</code> on the first line, OpenCL is not enabled or available.
 
The command <code>intel_gpu_top</code>, provided by the <code>intel-gpu-tools</code> package is also useful to check the status of your intel GPU: <code>nix-shell -p intel-gpu-tools --run intel_gpu_top</code>.
 
At least on Intel N100 CPU, you will need the option <code>hardware.enableAllFirmware = true;</code> otherwise GuC formware will not load properly. Here is the type of error you will get without it : <syntaxhighlight lang="dmesg">
[    4.174843] i915 0000:00:10.0: [drm] *ERROR* GT0: GuC firmware i915/tgl_guc_70.bin: fetch failed -ENOENT
[    4.175621] i915 0000:00:10.0: [drm] GT0: GuC firmware(s) can be downloaded from https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915
[    4.176286] i915 0000:00:10.0: [drm] GT0: GuC firmware i915/tgl_guc_70.bin version 0.0.0
[    4.176350] i915 0000:00:10.0: [drm] *ERROR* GT0: GuC initialization failed -ENOENT
[    4.176977] i915 0000:00:10.0: [drm] *ERROR* GT0: Enabling uc failed (-5)
[    4.177502] i915 0000:00:10.0: [drm] *ERROR* GT0: Failed to initialize GPU, declaring it wedged!
</syntaxhighlight>
 
==== VAAPI and Intel QSV on Arc GPU ====
 
 
If you want to use an Arc GPU for transcoding, you may need to override the ffmpeg version used by jellyfin to ensure that it is compiled with <code>vpl</code> and, potentially, <code>unfree</code>. An example to achieve this through [[Overlays|an overlay]]:<syntaxhighlight lang="nix">
{ pkgs, ... }:
let
  jellyfin-ffmpeg-overlay = (
    _ prev: {
      jellyfin-ffmpeg = prev.jellyfin-ffmpeg.override {
        # Exact version of ffmpeg_* depends on what jellyfin-ffmpeg package is using.
        # In 24.11 it's ffmpeg_7-full.
        # See jellyfin-ffmpeg package source for details
        ffmpeg_7-full = prev.ffmpeg_7-full.override {
          withMfx = false; # This corresponds to the older media driver
          withVpl = true; # This is the new driver
          withUnfree = true;
        };
      };
    }
  );
in
{
  nixpkgs.overlays = [ jellyfin-ffmpeg-overlay ];
}
</syntaxhighlight>This will trigger a rebuild of Jellyfin package, but the end result is that if you select "Intel QuickSync (QSV)" you should see little to no CPU load when transcoding.
 
Note that if your system has an integrated GPU (one built into the CPU) and a discrete GPU, you may need to select the QSV device in the "Playback" settings. Otherwise the device may be picked at random and produce random results. You can use <code>intel_gpu_top -L</code> to identify the devices.


Related:  [[Accelerated Video Playback]] and [[Intel Graphics]]
Related:  [[Accelerated Video Playback]] and [[Intel Graphics]]
Line 124: Line 190:
[[Category:Server]]
[[Category:Server]]
[[Category:Applications]]
[[Category:Applications]]
[[Category:Web Applications]]