mirror of
https://github.com/joshuaboniface/rffmpeg.git
synced 2026-07-17 16:36:57 +00:00
Update SETUP guide for newer versions
Fixes a few bugs, and includes setup details for more recent versions of Jellyfin that do not allow setting the FFmpeg path from the WebUI.
This commit is contained in:
parent
16ddb2bdee
commit
6117e0d81d
1 changed files with 37 additions and 19 deletions
56
SETUP.md
56
SETUP.md
|
|
@ -85,16 +85,16 @@ This guide is provided as a basic starting point - there are myriad possible com
|
|||
jellyfin1 $ sudo $EDITOR /etc/rffmpeg/rffmpeg.yml # if required
|
||||
```
|
||||
|
||||
1. Initialize `rffmpeg` (note the `sudo` command) and add at least one remote host to it. You can add multiple hosts now or later, set weights of hosts, and add a host more than once. For full details see the [main README](README.md) or run `rffmpeg --help` to view the CLI help menu.
|
||||
1. Initialize `rffmpeg` (note the `sudo` command) and add at the target host to it. You can add other hosts now or later, and set weights of hosts, if required; for full details see the [main README](README.md) or run `rffmpeg --help` to view the CLI help menu.
|
||||
|
||||
```
|
||||
jellyfin1 $ sudo rffmpeg init --yes
|
||||
jellyfin1 $ rffmpeg add --weight 1 gpu1
|
||||
jellyfin1 $ rffmpeg add --weight 1 transcode1
|
||||
```
|
||||
|
||||
### NFS Setup
|
||||
|
||||
* **WARNING:** This guide assumes your hosts are on the same private local network. It is not recommended to run NFS over the Internet as it is unencrypted and bandwidth-intensive. Consider other remote filesystems like SSHFS in such cases as these will offer greater privacy and robustness.
|
||||
* **WARNING:** This guide assumes your hosts are on the same private local network. It is not recommended to run NFS over the Internet as it is unencrypted, and any rffmpeg connection will be very bandwidth-intensive. If you must have both systems in separate networks, consider other remote filesystems like SSHFS in such cases as these will offer greater privacy and robustness.
|
||||
|
||||
1. Install the NFS kernel server. We will use NFS to export the various required directories so the transcode machine can read from and write to them.
|
||||
|
||||
|
|
@ -106,11 +106,9 @@ This guide is provided as a basic starting point - there are myriad possible com
|
|||
|
||||
* Always export the `${jellyfin_data_path}` in full. Advanced users might be able to export the required subdirectories individually, but I find this to be not worth the hassle.
|
||||
* Note the security options of NFS. It will limit mounts to the IP addresses specified. If your home network is secure, you can use the entire network, e.g. `192.168.0.0/24`, but I would recommend determining the exact IP of your transcode server(s) and use them explicitly, e.g. for this example `192.168.0.101` and `192.168.0.102`.
|
||||
* It's quite important to both set `sync` on the transcode host(s), and ensure that the `transcodes` directory is on a real filesystem on the Jellyfin system (i.e. is not a remote filesystem mount itself) which is then exported to the clients. If this is not the case, playback will be very slow to start. I believe the reason for this is that Jellyfin (and presumably Emby) listen for an `inotify` on the directory to know that the playlist is ready for consumption, but I have not confirmed this, and NFS *et al.* do not properly support this.
|
||||
* If your `transcodes` directory is not on a **native Linux filesystem** (i.e. external to Jellyfin, such as on a NAS exported by NFS, SMB, etc.), then you may experience delays of ~15-60s when playback starts. This is because NFS uses a file attribute cache that in most applications greatly increases performance, however for this usecase it causes a delay in Jellyfin seeing the `.ts` files. The solution for this is to reduce the NFS cache time by adding `sync` and `actimeo=1` to your NFS mount(s) (command or fstab), which will set the NFS file attribute cache to 1 second (reducing the NFS delay to ~1-2 seconds). This time can be further reduced to 0 by setting the `noac` option, but this is not normally recommended because it will negatively impact the performance other NFS applications. Verify that your mount added the `actimeo=1` parameter correcly by checking `mount` or `cat /proc/mounts`, which will show `sync,acregmin=1,acregmax=1,acdirmin=1,acdirmax=1` as parameters for your `transcodes` mount.
|
||||
* If your media is local to the Jellyfin server (and not already mountable on the transcode host(s) via a remote filesystems like NFS, Samba, CephFS, etc.), also add an export for it as well.
|
||||
|
||||
* If your `transcodes` directory is external to Jellyfin, such as a NAS, then you may experience delays of ~15-60s starting content as NFS uses a file attribute cache that in most applications greatly increases performance, however for this usecase it causes a delay in Jellyfin seeing the `.ts` files. The solution for this is to reduce the NFS cache time by adding `actimeo=1` to your mount command (or fstab), which will set the NFS file attribute cache to 1 second (reducing the NFS delay to ~1-2 seconds.) It is not recommended to use the `noac` flag, which would reduce the NFS delay to ~0, but at the cost of negatively impacting other NFS performance. To verify your mount added the `actimeo=1` parameter correcly `cat /proc/mounts`, which will show `acregmin=1,acregmax=1,acdirmin=1,acdirmax=1` as parameters for your `transcodes` mount.
|
||||
|
||||
An example `/etc/exports` file would look like this:
|
||||
|
||||
```
|
||||
|
|
@ -138,16 +136,18 @@ This guide is provided as a basic starting point - there are myriad possible com
|
|||
|
||||
1. Install and configure anything you need for hardware transcoding, if applicable. For example GPU drivers if using a GPU for transcoding.
|
||||
|
||||
* **NOTE:** Make sure you understand the caveats of using hardware transcoding with `rffmpeg` from the main README if you do decide to go this route.
|
||||
* **NOTE:** Make sure you understand the caveats of using hardware transcoding with `rffmpeg` from [the main README](README.md#hardware-acceleration).
|
||||
|
||||
1. Install the `jellyfin-ffmpeg` (Jellyfin <= 10.7.7), `jellyfin-ffmpeg5` (Jellyfin >= 10.8.0) or `jellyfin-ffmpeg6` (Jellyfin >= 10.9.0) package; follow the same steps as you would to install Jellyfin on the media server, only don't install `jellyfin` (and `jellyfin-server`/`jellyfin-web`) itself, just `jellyfin-ffmpeg[5,6]`.
|
||||
1. Install the correct `jellyfin-ffmpeg` package for your version of Jellyfin; check which version is installed on your `jellyfin1` system with `dpkg -l | grep jellyfin-ffmpeg`, then install that version on this host too; follow the same steps as you would to install Jellyfin on the media server, only don't install `jellyfin` (and `jellyfin-server`/`jellyfin-web`) itself, just the `jellyfin-ffmpeg` of the required version.
|
||||
|
||||
```
|
||||
jellyfin1 $ dpkg -l | grep jellyfin-ffmpeg
|
||||
ii jellyfin-ffmpeg6 6.0.1-8-bookworm amd64 Tools for transcoding, streaming and playing of multimedia files
|
||||
transcode1 $ sudo apt -y install curl gnupg
|
||||
transcode1 $ curl -fsSL https://repo.jellyfin.org/ubuntu/jellyfin_team.gpg.key | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/jellyfin.gpg
|
||||
transcode1 $ echo "deb [arch=$( dpkg --print-architecture )] https://repo.jellyfin.org/$( awk -F'=' '/^ID=/{ print $NF }' /etc/os-release ) $( awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release ) main" | sudo tee /etc/apt/sources.list.d/jellyfin.list
|
||||
transcode1 $ sudo apt update
|
||||
transcode1 $ sudo apt install jellyfin-ffmpeg6 # or jellyfin-ffmpeg5 with Jellyfin <= 10.8.13, jellyfin-ffmpeg with Jellyfin <= 10.7.7
|
||||
transcode1 $ sudo apt install jellyfin-ffmpeg6
|
||||
```
|
||||
|
||||
1. Install the NFS client utilities:
|
||||
|
|
@ -165,7 +165,7 @@ This guide is provided as a basic starting point - there are myriad possible com
|
|||
|
||||
* **NOTE:** For some hardware acceleration, you might need to add this user to additional groups. For example `--groups video,render`.
|
||||
|
||||
* **NOTE:** The UID and GIDs here are dynamic; on the `jellyfin1` machine, they would have been created at install time with the next available ID in the range 100-199 (at least in Debian/Ubuntu). However, this means that the exact UID of your Jellyfin service user might not be available on your transcode server, depending on what packages are installed and in what order. If there is a conflict, you must adjust user IDs on one side or the other so that they match on both machines. You can use `sudo usermod` to change a user's ID if required.
|
||||
* **NOTE:** The UID and GIDs here are dynamic; on the `jellyfin1` machine, they would have been selected automatically at install time with the next available ID in the range 100-199 (at least in Debian/Ubuntu). However, this means that the exact UID of your Jellyfin service user might not be available on your transcode server, depending on what packages are installed and in what order. If there is a conflict, you must adjust user IDs on one side or the other so that they match on both machines. You can use `sudo usermod` to change a user's ID if required.
|
||||
|
||||
1. Create the Jellyfin data directory at the same location as on the media server, and set it immutable so that it won't be written to if the NFS mount goes down:
|
||||
|
||||
|
|
@ -208,12 +208,14 @@ This guide is provided as a basic starting point - there are myriad possible com
|
|||
|
||||
```
|
||||
transcode1 $ sudo systemctl daemon-reload
|
||||
transcode1 $ sudo systemctl start var-lib-jellyfin.mount
|
||||
transcode1 $ sudo systemctl enable --now var-lib-jellyfin.mount
|
||||
```
|
||||
|
||||
Note that mount units are fairly "new" and can be a bit finicky, be sure to read the SystemD documentation if you get stuck! Generally for new users, I'd recommend the `/etc/fstab` method instead.
|
||||
|
||||
1. Mount your media directories in the same location(s) as on the media server. If you exported them via NFS from your media server, use the process above only for those directories instead.
|
||||
**NOTE:** Don't forget about `actimeo=1` here if you need it!
|
||||
|
||||
1. Mount your media directories in the **same location(s)** as on the media server. If you exported them via NFS from your media server, use the process above only for those directories instead.
|
||||
|
||||
## Test the setup
|
||||
|
||||
|
|
@ -237,23 +239,39 @@ This guide is provided as a basic starting point - there are myriad possible com
|
|||
[...]
|
||||
```
|
||||
|
||||
As long as these steps work, all further steps should as well.
|
||||
As long as these steps work, all further steps should as well. If one of these *doesn't* work, double-check all previous steps and confirm that everything is set up right.
|
||||
|
||||
## Configure Jellyfin
|
||||
## Configure Jellyfin to use `rffmpeg`
|
||||
|
||||
1. In the Hamburger Menu -> Administration -> Dashboard, navigate to Playback.
|
||||
**NOTE**: With Jellyfin 10.8.13 and newer, the ability to configure the `ffmpeg` path has been removed from the WebUI due to major security concerns. You must follow this method to change it.
|
||||
|
||||
1. On the `jellyfin1` system, edit `/etc/default/jellyfin`:
|
||||
|
||||
```
|
||||
jellyfin1 $ sudo $EDITOR /etc/default/jellyfin
|
||||
```
|
||||
|
||||
1. Change the value of `JELLYFIN_FFMPEG_OPT` to be `--ffmpeg=/usr/local/bin/ffmpeg` (the `rffmpeg` alias name `ffmpeg` in whatever path you installed `rffmpeg` to).
|
||||
|
||||
1. Save the file and restart Jellyfin:
|
||||
|
||||
```
|
||||
jellyfin1 $ sudo systemctl restart jellyfin
|
||||
```
|
||||
|
||||
If you wish to use hardware transcoding, you must also enable it in Jellyfin's WebUI:
|
||||
|
||||
1. Navigate to Hamburger Menu -> Administration -> Dashboard, navigate to Playback.
|
||||
|
||||
1. Configure any hardware acceleration you require and have set up on the remote server(s).
|
||||
|
||||
1. Under "FFmpeg path:", enter `/usr/local/bin/ffmpeg`.
|
||||
|
||||
1. Save the settings.
|
||||
|
||||
1. Try to play a movie that requires transcoding, and verify that everything is working as expected.
|
||||
Now, run `rffmpeg log -f` on the `jellyfin1` machine and try to play a video that requires transcoding. You should see `rffmpeg` spawn a process on the `jellyfin1` machine, which then begins running the `ffmpeg` process on the `transcode1` machine, writing data to the configured paths, and playback should begin normally. If anything doesn't work, double-check all previous steps and confirm that everything is set up right.
|
||||
|
||||
## NOTE for NVEnv/NVDec Hardware Acceleration
|
||||
|
||||
If you are using NVEnv/NVDec, it's probably a good idea to symlink the `.nv` folder inside the Jellyfin user's homedir (i.e. `/var/lib/jellyfin/.nv`) to somewhere outside of the NFS volume on both sides. For example:
|
||||
If you are using NVEnv/NVDec, you will need to symlink the `.nv` folder inside the Jellyfin user's homedir (i.e. `/var/lib/jellyfin/.nv`) to somewhere outside of the NFS volume on both the Jellyfin and transcoding hosts. For example:
|
||||
|
||||
```
|
||||
jellyfin1 $ sudo mv /var/lib/jellyfin/.nv /var/lib/nvidia-cache # or "sudo mkdir /var/lib/nvidia-cache" and "sudo chown jellyfin /var/lib/nvidia-cache" if it does not yet exist
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue