The basis for this plugin is the work of JarBinks.
This is a Tdarr plugin that converts videos to H265/HEVC using nvenc GPU-accelerated encoding. Resolutions higher than 1080p are resized to 1080p. The target bitrate is calculated based on the resolution, frame rate, bitrate, and a compression factor selected by the user.
Audio, subtitles, chapters, and metadata are untouched.
Dependencies:
- mediainfo
- mkvpropedit
The target bitrate (passed to ffmpeg) is as follows:
However, there are two exceptions:
- If the target bitrate is greater than 70% of the H264 bitrate, then 70% of the H264 bitrate will be used.
- The target bitrate will not be reduced to less than 60% of the original.
- If the video is already in H265/HEVC, then it will be transcoded only if it is more than 150% the target. This is avoid quality loss from transcoding for limited gains.
This is based on the theory that H265 provides similar video quality with significant savings over H264.
Additionally, the maximum bitrate (-maxrate) is set to 130% of the target. The minimum (-minrate) is set to 70% of the target.
It is expected that you have a working installation of Tdarr, with nvenc working in the docker container.
Once the Tdarr container is set up, connect to the container:
sudo docker exec -it tdarr /bin/bash
Then execute these commands:
sudo apt update && apt install mediainfo mkvtoolnix
Note, however, that these additions will be lost when the container is restarted and the plugin will fail. A better option is to use a Dockerfile:
FROM haveagitgat/tdarr:latest
RUN sudo apt-get update --allow-releaseinfo-change && \
sudo apt-get install -y mediainfo mkvtoolnix && \
Build command: docker build -t jeffr47/tdarr-plus:1.0 . (the name can be anything you want.)
I believe mediainfo and mkvtoolnix have been updated in the repos to support the needed commands. You can, if needed, use this code to get newer versions:
sudo apt-get update
sudo apt-get install wget
sudo wget https://mediaarea.net/repo/deb/repo-mediaarea_1.0-12_all.deb && sudo dpkg -i repo-mediaarea_1.0-12_all.deb &&
sudo wget -q -O - https://mkvtoolnix.download/gpg-pub-moritzbunkus.txt | sudo apt-key add -
sudo sh -c 'echo "deb https://mkvtoolnix.download/ubuntu/ bionic main" >> /etc/apt/sources.list.d/bunkus.org.list'
sudo sh -c 'echo "deb-src https://mkvtoolnix.download/ubuntu/ bionic main" >> /etc/apt/sources.list.d/bunkus.org.list'
sudo apt update
sudo apt install mkvtoolnix