Tdarr setup

December 11, 2022

Overview

My media library has grown rather large over the past few years. Once I learned about tdarr, I decided to give it a try and see if I could reduce the storage space required for my media files. I initially tried setting it up on a system with no desktop environment. For various reasons, this was not a good fit. I settled on using a fresh Proxmox VM with Fedora Workstation installed.

Initial system setup

After installing Fedora Workstation, I updated the hostname with # hostnamectl set-hostname --static tdarr.jlhinson.com and set a static IP in pfSense. Since this is a Proxmox VM, I installed and enabled qemu-guest-agent. I also installed cockpit and enabled it with # systemctl enable --now cockpit.socket. The nfs-utils package is needed for mounting NFS shares from my NAS as well as creating shares on tdarr (more on this later). In Proxmox, all of my VMs are hosted on a single 1TB SSD. I don’t want to take up space on this drive with media waiting to be processed (or currently being processed), so I added a few other drives to the VM for these purposes. I have an old 2TB spinning drive that I added to store the media waiting to be processed /mnt/stash. I also added a 60GB SSD I had laying around to be used to store the file that is actively being processed /mnt/encode. For the spinning drive, I enabled the Proxmox settings to emulate a SSD and enabled discard. This will make sure the system can properly free up space in qcow2 disk images when running fstrim. For both drives, I disabled the check box to include them in backups of the VM. Be sure these locations have write access for the user running tdarr.

NFS

I’m using NFS to copy files to and from my tdarr VM. I have a read-only tv and movies share from my NAS which I use to copy items to the tdarr VM. I also have a read-only share on the VM that I use to copy files back to my NAS after they’ve been processed. For information on setting up the NFS server, take a look at the NFS section in this post.

Install tdarr

Tdarr has an updater script that can be downloaded and run after making it executable. This script will install the server and node binaries. I chose to create a new directory (~/tdarr) and run the updater script from there. The updater script and all of the installation information can be found in the tdarr docs. The only change I had to make was the Handbrake location.

I chose to install the Handbrake CLI Flatpak from the Handbrake website. For some reason, I couldn’t get this to install properly without first enabling Flathub. After that, the flatpak install command can be used to install the file downloaded from Handbrake. The CLI should then be available at /var/lib/flatpak/exports/bin/fr.handbrake.HandBrakeCLI. This is the path that will need to be added to the tdarr node and server config files.

Tdarr service files

I chose to go the route of creating service files to start the node and server at boot. I used the comment string referenced in the tdarr instructions and came up with the following service files. I’m creating them as user service files so they will run as the user and not root. For the service file to start up before you actually login, you’ll need to run # loginctl enable-linger username. Only the tdarr-node.service file needs to be enabled since it requires tdarr-server.service. These files should be placed in ~/.config/systemd/user.

tdarr-node.service

[Unit]
Description=Tdarr Node Daemon
Requires=tdarr-server.service

[Service]
Type=simple
ExecStart=/path/to/Tdarr_Node/Tdarr_Node
TimeoutStopSec=20
KillMode=process
Restart=on-failure

[Install]
WantedBy=default.target

tdarr-server.service

[Unit]
Description=Tdarr Server Daemon

[Service]
Type=simple
ExecStart=/home/john/tdarr/Tdarr_Server/Tdarr_Server
TimeoutStopSec=20
KillMode=process
Restart=on-failure

My tdarr transcode options

I know everyone will have a little something different here. I’m going to provide my current setup as an example and as documentation for me. One thing that may be particularly unique is my audio settings. I don’t have any kind of surround sound system and never intend to. To keep things simple and consistent, I’m creating stereo audio if it’s not already part of the file. I’m then only keeping that stereo audio track.

  • Migz-Remove image formats from file
  • Migz-Clean title metadata
    • clean_audio = true; clean_subtitles=true
  • Migz-Clean audio streams
    • language = eng,und; commentary = true; tag_title = false
  • Migz-Clean subtitle streams
    • language = eng; commentary = true
  • Tdarr_Plugin_lmg1_Reorder_Streams
  • Migz-Transcode Using CPU & FFMPEG
    • container = mkv; enable_10bit = false; force_conform = true
  • Migz-Convert audio streams
    • aac_stereo = true; downmix = true
  • Keep one audio stream
    • audioCodec = aac; language = en; channels = 2
  • Migz-Order Streams
  • New file size check
    • upperBound = 110; lowerBound = 40

Conclusion

I’ve been running tdarr for a little over a month now, and it’s already saved me close to 1TB of space. I’ve got quite a bit of media left to process too. Once I got the initial setup out of the way, it has been running flawlessly. I’m definitely looking forward to the space savings.