Skip to content

Latest commit

 

History

History
454 lines (280 loc) · 20.9 KB

README.md

File metadata and controls

454 lines (280 loc) · 20.9 KB

AV1 - Intel ARC Encoding Guide via Unraid + Tdarr Node Scaling/Killer

Want to Help? Click the Star in the Upper-Right Corner! ⭐

NOTE
We’re using ghcr.io/haveagitgat/tdarr:2.35.02 instead of ghcr.io/haveagitgat/tdarr:latest.
The latest probably works FINE, but just a note!

Change Log:

  • v1-3: Original AV1 flow, Removed-B Frames, Improved Quality
  • v4: Removed images from files, cutting failure rates from ~25% to 1–2%
  • v5: Enhanced quality and simplified workflow
  • v6: Added a Special-ish Variable - If file is still to big, try again at a slightly lower quality
image

Introduction

This guide helps you optimize your media library by encoding to AV1 on Unraid while efficiently sharing GPU resources between Plex and Tdarr. You’ll learn how to:

  • Set up Intel ARC GPU support on Unraid.
  • Configure Tdarr for AV1 encoding.
  • Manage SABnzbd download speeds based on Plex streams (to prevent buffering).
  • Automatically pause and resume Tdarr when Plex needs the GPU.

Following these steps will dramatically reduce video file sizes, saving huge amounts of storage, while ensuring Plex always has GPU priority. You’ll also see how to tweak download speeds to avoid streaming slowdowns.

Quick Tip: Always test your AV1 encoding on a small library or a few files. Adjust CRF to balance quality and size before converting your entire collection.


Table of Contents


Data Savings with AV1 Encoding

AV1 encoding drastically shrinks file sizes. In one example, using three Intel ARC GPUs to encode 10–15% of a large library yielded about 116TB of savings. For a 300TB media collection, you can potentially reduce it to 75–100TB with careful AV1 conversion.

image

I’ve already saved 255TB and counting!


AV1 Drawbacks

No codec is perfect. Some devices lack native AV1 decoding, forcing Plex to handle software transcoding. AV1 also requires more resources to encode, which means encoding jobs take longer. For details, check out the AV1 Drawbacks page.


Upgrading to Unraid 7.0 and Installing Required Plugins

Make sure you’re on Unraid 7.0 or newer, then install the required GPU plugins before using Tdarr or running the Tdarr Node Killer script.

Installing Intel GPU TOP Plugin

Install Intel GPU TOP (by ich777) from Unraid Community Apps to monitor your Intel ARC GPU’s performance directly on Unraid.

Intel GPU TOP Plugin

Installing GPU Statistics Plugin

Then install GPU Statistics (by b3rs3rk). Combined with Intel GPU TOP, it offers detailed GPU usage data during encoding or transcoding.

GPU Statistics Plugin

After installing both, you’ll see real-time GPU usage:

GPU Usage Example 1
GPU Usage Example 2


Deploying Plex with Intel ARC GPU Support

Adding the Intel ARC GPU to the Plex Docker Template

In your Plex Docker template, add the Intel ARC GPU as a device. Plex won’t see the GPU without this.

Add Intel ARC GPU to Plex Template

Configuring Plex Settings

Enable hardware transcoding in Plex and HDR tone mapping (if supported). If your server has multiple GPUs, pick the correct one.

image

Verifying GPU Transcoding

Play a video that needs transcoding. On Plex’s dashboard, watch the GPU usage. You should see minimal CPU usage and smooth playback. If you have an AV1 file handy, test it to confirm AV1 transcoding works too!

image

Setting Up Tdarr

What is Tdarr?
Tdarr streamlines media transcoding using a friendly GUI, handling conversions for you without complex command lines. At first, it might feel overwhelming, but once you get the hang of it, it’s incredibly powerful for media optimization.

If you find this guide helpful, please click the ★ (Star) button above. It shows your support and helps others discover this guide.

Deploying Tdarr Server

You’ll see an option to deploy the server and node in a single container. To simplify troubleshooting, deploy them separately:

  1. Install Tdarr (not Tdarr Node) from the Unraid App Store.
  2. Name it clearly (e.g., “Server” or “TdarrServer”).
  3. Check that the server IP is correct (usually your Unraid server’s IP).
  4. Set Internal Node to False so you can install a separate node container.
image image image

Tdarr Transcoding Location

Decide where to store transcoded files temporarily. For small workloads, an SSD/NVMe cache is enough. If you plan to transcode heavily (multiple streams, multiple GPUs), consider a dedicated NVMe. Avoid HDDs or RAM to reduce bottlenecks and random errors.

Important: High-volume transcoding quickly wears down SSD/NVMe drives. Many users add a lower-end NVMe just for Tdarr. This preserves your main system drives.

For instance, I use a cheap 512GB NVMe for Tdarr, since Tdarr can easily handle hundreds of terabytes of reads/writes. Doing so keeps my primary NVMe healthier.

image

Deploying Tdarr Node(s)

Once the Tdarr Server is running, install Tdarr Node (a separate listing). The server manages libraries and tasks, while the node handles the actual transcoding.

image
  1. Install Tdarr Node from the Unraid App Store.
  2. Name it clearly, like “Node1.” If you have multiple GPUs, install multiple node containers (Node1, Node2, etc.).


image

  1. Ensure the server IP and node IP match.


image

  1. Keep each node’s configs and logs separate.
  2. Match the transcode cache path to the server’s path. If you have more than one node, label them for clarity.
  3. Assign the correct GPU to each node. Don’t overlap GPUs if you have multiple nodes.


image

Identify GPUs by running:
image

Warning: One entry might be your iGPU. Don’t assign your iGPU to a Tdarr node.

Tip: Go to Plex → Settings → Transcoding. When you pick a GPU in Plex, the GPU order matches the order from ls -la /dev/dri. In the example below, render129 is the iGPU, so I skip it and use render130 for Node2 and render131 for Node3.


image

Configuring Tdarr

  1. Go to http://<your-unraid-IP>:8265.
  2. You should see your nodes listed:


image

  1. For each node, click it and set CPU/GPU worker counts based on your ARC card:

    • ARC 310/380/500/700
      • Transcode: CPU (0), GPU (2–4)
      • Health Check: CPU (2), GPU (0)


image

  1. Click Options, scroll to the bottom, and enable “GPU Workers to do CPU Tasks,” then close.


image

  1. In the staging section, check Auto-accept successful transcodes so Tdarr replaces old files automatically.


image

  1. In Status, pick the queue order (e.g., largest files first).


image


Setting up the AV1 Tdarr Flow

Change Log

  • v1: Original AV1 flow
  • v2: Removed B-frames
  • v3: Improved quality
  • v4: Removed images from files (failure rates ~25% → 1–2%)
  • v5: Better quality, simpler flow
  • v6: Added a retry value if file is still to big

JSON Script: av1_flow_v6.json

image

What is the AV1 Flow?

The AV1 Flow is a prebuilt workflow that encodes your media to AV1 for huge storage savings, without requiring expert knowledge of encoding parameters. You must import it before creating your Tdarr libraries.

Importing the AV1 Flow in Tdarr

  1. In Tdarr, go to Flows.
  2. Scroll down and click Import.
  3. Paste the AV1 Flow JSON.
  4. Apply it to your libraries.

Adding a New Flow in Tdarr
Scroll to Import Option
Pasting the JSON Content


Optimizing AV1 Encoding Settings

Within the AV1 flow, adjust CRF and bitrate to balance quality and size. Make sure you’ve enabled hardware acceleration so the GPU does the heavy lifting. In general:

  • Higher CRF → Lower quality, smaller files
  • Lower CRF → Higher quality, larger files

I’ve found the default settings in the AV1 Flow give an excellent quality-to-size ratio. If you want finer control, test small sets of files and tweak CRF/bitrate until you find your sweet spot.


image

image


Setting Up Tdarr Libraries

Libraries let you specify locations and define how Tdarr processes them. For instance, you might have separate libraries for “tv” and “movies.” Adjust to your setup.

  1. Click Libraries:

    image

  2. Click Library+:
    image

  3. Name your new library (e.g., “TV,” “Movies,” etc.).

  4. Under Source, point it to your media folder. Enable [Hourly] scanning to catch new content.


image

image

  1. Under Transcode Cache, set the path to /temp (or your chosen transcode folder).


image

  1. In Filters, add AV1 to “Codecs to Skip,” so you never re-encode existing AV1 files. You can also skip small files if you like.


image

  1. In Transcode Options, uncheck “Classic Plugins,” go to the Flows tab, and pick the AV1 flow. (If you haven’t imported the flow yet, see the Importing the AV1 Flow in Tdarr section first.)


image

  1. Repeat for all your libraries.
  2. Perform a Fresh New Scan to apply changes.


image

  1. After scanning, the home page should show transcoding activity. If not, re-check your GPU assignments and node settings.


image

  1. If you see tons of errors, review your GPU configuration or flow settings.


image


Tdarr Node Killer Script

Change Log

  • v1: Original script
  • v2: Switched to Tautulli for simpler detection
  • v3: Option to avoid killing Tdarr node on local-only transcodes
  • v4: Added a threshold to kill the Tdarr container only if transcodes exceed (default) 3 sessions
  • v5: Added Tautulli API connectivity check in logs at startup
  • v6: Added Optional GPU Job Scaling instead of Killing Tdarr Node

Overview

The Tdarr Node Killer script ensures Plex always has GPU priority. When Plex starts transcoding on the same GPU, the script stops Tdarr. Once Plex stops, it waits a short cooldown and restarts Tdarr.

Script Behavior

  • Stops the Tdarr Node container as soon as Plex begins GPU transcoding.
  • Waits for Plex transcoding to end, then restarts Tdarr after a short cooldown (e.g., 3 minutes).

Script (OLD): tdarr_node_killer.sh
Script (NEW): tdarr_node_scaling.sh - Instructions Not Updated Yet

Use User Scripts in Unraid to install this script, set it to run on array startup, and keep it running in the background.

image

Step-by-Step Implementation for Unraid

  1. Confirm Tdarr Node the targetted Node is running when no one’s transcoding in Plex:

    image

  2. The script runs and waits for Plex transcoding activity:

    image

  3. A user begins transcoding in Plex:

    image

4A. (Tdarr Scaling) Script detects transcoding threshold set and reduces amount of Tdarr GPU Workers:


image

4B. (Tdarr Killer) Script detects transcoding exceeding set threshold and kills Tdarr Node:


image

image

  1. Tdarr Node [N1] is now stopped:


    image

Script Behavior After Plex Transcoding Stops

When Plex finishes transcoding, the script waits a cooldown (e.g., 180 seconds) and then restarts Tdarr:

  1. You’ll see a countdown timer in the logs before it restarts the container.

  2. Tdarr Node starts again after the countdown:


    image

    image

  3. Tdarr Node is fully online:

    Tdarr Node Online

Troubleshooting Common Issues

  • Plex Not Using GPU? Re-check your Plex Docker template and transcoding settings.
  • Tdarr Not Restarting? Make sure the script has the right container name, Tautulli API key, and is set to run in the background.
  • High CPU Usage? Some features, like HDR tone mapping, can be CPU-intensive. Ensure your GPU and drivers support it. Update drivers if needed.

Experimental: Running the Script on Other Operating Systems

You can run this script on other Linux distributions or OSes that support Docker and systemd. The steps are similar: place the script, set permissions, and create a systemd service.

  1. Save the Script: Save your Tdarr Node Killer Script as tdarr_node_killer.sh in /usr/local/bin/.

    sudo nano /usr/local/bin/tdarr_node_killer.sh
  2. Set the Proper Permissions:

    sudo chmod +x /usr/local/bin/tdarr_node_killer.sh
    sudo chown root:root /usr/local/bin/tdarr_node_killer.sh
  3. Create a Service File: Create a service file for the script:

    sudo nano /etc/systemd/system/tdarr_node_killer.service
  4. Add the Following Content:

    [Unit]
    Description=Tdarr Node Killer Script
    After=network.target
    
    [Service]
    Type=simple
    ExecStart=/bin/bash /usr/local/bin/tdarr_node_killer.sh
    Restart=on-failure
    
    [Install]
    WantedBy=multi-user.target
  5. Reload Systemd:

    sudo systemctl daemon-reload
  6. Start and Enable the Service:

    sudo systemctl start tdarr_node_killer.service
    sudo systemctl enable tdarr_node_killer.service

This ensures the script runs automatically and manages your GPU resources even if you’re not on Unraid.


Backup and Recovery Tips

Before making changes:

  • Backup Plex configs (metadata, watch history, etc.).
  • Backup Docker templates so you can quickly restore containers.
  • Backup your Unraid flash drive so you don’t lose your server setup.

Test your backups occasionally to ensure they work when you need them.


Summary

By setting up AV1 encoding with Intel ARC GPUs, you can achieve massive storage savings and still maintain great quality. Adding the optional Tdarr Node Killer Script ensures Plex always has priority access to the GPU when needed. With careful tuning and a bit of experimentation, you can streamline your server’s performance, reduce storage costs, and keep everyone happy with smooth, high-quality streams.

Found this useful? Consider clicking the star (★) button at the top!