banner
小鱼

小鱼's Blog

Deploying Jellyfin with Docker

Installing via Docker#

docker run -d \
--name jellyfin \
--add-host=api.themoviedb.org:13.225.174.30 \
--add-host=www.themoviedb.org:54.192.22.105 \
--add-host=api.themoviedb.org:13.35.8.65 \
--add-host=api.themoviedb.org:13.224.161.90 \
--add-host=api.themoviedb.org:13.35.8.93 \
--add-host=api.themoviedb.org:13.35.8.6 \
--add-host=api.themoviedb.org:13.35.8.54 \
--add-host=image.tmdb.org:138.199.37.230 \
--add-host=image.tmdb.org:108.138.246.49 \
--add-host=image.tmdb.org:13.227.73.57 \
--add-host=api.thetvdb.org:13.225.89.239 \
--add-host=api.thetvdb.org:192.241.234.54 \
--volume /home/soft/jellyfin/config:/config \
--volume /home/media/video:/media \
--restart=unless-stopped \
--device /dev/dri/renderD128:/dev/dri/renderD128 \
--device /dev/dri/card0:/dev/dri/card0 \
-p 8096:8096 \
-e TZ=Asia/Shanghai -e PUID=0 -e PGID=0 \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=$DISPLAY \
nyanmisaka/jellyfin:latest
--name jellyfin: Container name.
--add-host: Configure host resolution in the container, resolving domain names such as api.themoviedb.org and image.tmdb.org to specified IP addresses. Jellyfin needs to access these sites' APIs to obtain metadata, but the default DNS in the container may not be able to resolve them, so these domain name resolutions need to be configured separately.
--volume: Mount the host directory into the container for persistent storage of Jellyfin's configuration data and media library data.
--restart=unless-stopped: Always restart the container unless it is manually stopped.
--device: Mount the host's GPU device files into the container for hardware decoding.
-p 8096:8096: Port mapping, establish a mapping between port 8096 on the host and port 8096 inside the container.
-e TZ and -e DISPLAY: Set the time zone and display environment variables.
-v /tmp/.X11-unix:/tmp/.X11-unix: Mount the X11 socket directory for graphical applications to access the X server display.
nyanmisaka/jellyfin:latest: Use the Docker image named nyanmisaka/jellyfin with the tag latest.

Configuring in a Virtual Machine#

Enter the virtual machine

docker exec -it jellyfin /bin/bash

Changing the apt source#

Refer to the previous notes on changing the source.

Then install

apt-get install vim

apt-get install -my wget gnupg

You may encounter an error

E: The repository 'https://mirrors.ustc.edu.cn/ubuntu focal-backports InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: https://mirrors.ustc.edu.cn/ubuntu focal-security InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32 NO_PUBKEY 871920D1991BC93C

Solution:

Execute the following command, replacing the string of numbers at the end

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 871920D1991BC93C

Installing Chinese fonts#

apt install fonts-noto-cjk-extra

Checking GPU passthrough#

 ls /dev/dri/

If renderD128 and card0 appear, it means it's successful

Installing drivers#

apt install -y intel-media-va-driver-non-free vainfo

Then enter

vainfo

If something similar appears

root@61f034a94ef0:/# vainfo
error: XDG_RUNTIME_DIR not set in the environment.
error: can't connect to X server!
libva info: VA-API version 1.7.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_7
libva error: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed
libva info: va_openDriver() returns 1
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_6
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.7 (libva 2.6.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Bay Trail - 2.4.0
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264StereoHigh         : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileJPEGBaseline           : VAEntrypointVLD

It means the driver can be initialized successfully and supports multiple encodings.

Although there is an error

error: XDG_RUNTIME_DIR not set in the environment.
error: can't connect to X server!

This mainly affects the operation of vaapi software and does not affect the effect of vaapi hardware acceleration.

In pure encoding and decoding scenarios, vaapi does not need to connect to the display server.

As long as the driver is successfully initialized, the effect of accelerated encoding and decoding will not be affected.


If you encounter this error

error: XDG_RUNTIME_DIR not set in the environment.
error: can't connect to X server!
libva info: VA-API version 1.7.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_7
libva error: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed
libva info: va_openDriver() returns 1
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit

Then you need to install the i965 VA-API driver

apt install -y libva2 i965-va-driver

Page Configuration#

Now open port 8096 on the server, and you can open the Jellyfin page

Content Type: Select "Movies" for movie content and "TV Shows" for TV show content.

Display Name: Custom:

Add Media Library: Click the plus sign next to "Folder" to add the folders where the movie or TV show content is located.

Preferred Language: Select "Chinese", Country/Region: Select "People's Republic of China"

Metadata Downloaders: Keep only "TheMovieDb"

Image Fetchers: Keep only "TheMovieDb"

For options not mentioned, choose according to the situation;

After setting everything, click "OK", and the system will automatically generate a list of movie and TV show posters,

The speed of completion depends on your network environment.

Network Settings#

Open the "Dashboard" and select "Networking" in "Advanced";

Set "Local Network Address for Listening" to the address of the Jellyfin server,

Set "LAN Networks" to your local network address, such as: 192.168.1.0/255.255.255.0,

If there are multiple LAN network segments, separate them with a "comma";

Finally, click "OK" to complete the network configuration.

Video Hardware Decoding Settings#

Open the "Dashboard" and select "Playback" in "Server",

Hardware Acceleration: Select "Video Acceleartion API (VAAP)" or "Intel QuickSync (QSV)",

For CPUs/graphics cards that are not too old, it is recommended to choose QSV;

Enable Hardware Decoding: Select according to the supported decoding of the graphics card, for Intel 3455 and above CPUs,

that is, UHD500 and above graphics cards, you can select all;

Preferred native DXVA or VA-API hardware decoders: Do not select;

Hardware Encoding Options: Only select "Enable hardware encoding", "Enable VPP tone mapping", and do not select any options not mentioned.

Finally, select "Allow subtitle extraction in real-time" and "Limit transcoding speed" based on the actual situation:

Options not mentioned should not be selected, and other parameters should use the default values,

Finally, click "OK" to complete the settings.

Note: Do not select "Enable tone mapping", this is a pit, after selecting,

many HEVC/HDR movies will report an error when playing, indicating that there is no suitable container, and ultimately cannot be played.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.