/sonarr-sma

Sonarr SMA Docker container with Synology hardware accelleration.

Primary LanguageDockerfileMIT LicenseMIT

Hardware accellerated Sonarr SMA Docker container (e.g. for Synology Diskstation)

This version of mdhiggins original Docker container uses ffmpeg with vaapi support enabled to enable hardware accelleration on devices with Intel QuickSync (and some others), for example most Synology Diskstations with Intel CPUs.

On a Synology Diskstation DS920+ (CPU: J4125, RAM: 4GB, GPU: Intel UHD 600) throughput is about 72fps at ~15% CPU usage with the sample command ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i input.mp4 -c:v h264_vaapi -b:v 2M -maxrate 2M output.mp4 on a typical 1080p movie.

Without hardware accelleration, it is just 20fps at 100% CPU usage.

Version Tags

Tag Branch Description
latest build Latest develop release from Sonarr (v3) with FFMPEG compiled from jrottenberg/ffmpeg:4.4-vaapi2004

Usage

First run

Unfortunately Synology disabled the use of "devices" in DSM 7, either on purpose or accidentally. So the old way does not work any more. But there is an alternative:

  • SSH into the diskstation

  • Create a file named docker-compose.yml (must be exactly this name) in a folder of your choice, for me it is /volume1/configs/docker/sonarr/docker-compose.yml

    version: "2.1"
    services:
    sonarr:
       container_name: sonarr
       image: eikowagenknecht/sonarr-sma-vaapi:latest
       environment:
          - PUID=1028
          - PGID=65536
          - TZ=Europe/Berlin
          - MAX_NAME=143 # max length for encrypted file system
       volumes:
          - /volume1/configs/sma_sonarr:/usr/local/sma/config
          - /volume1/downloads/blackhole:/blackhole # added by me
          - /volume1/downloads/complete:/downloads
          - /volume1/serien:/tv
          - /volume1/configs/sonarr:/config
       ports:
          - 38004:8989/tcp
       devices:
          - /dev/dri/renderD128:/dev/dri/renderD128
          - /dev/dri/card0:/dev/dri/card0
       network_mode: bridge
  • In this directory run docker-compose up --detach

After that you can stop and start the container using the UI if you want or continue using docker-compose.

Update (dev)

If you use my image, just skip ahead to the next section.

If you build yourself, you have to rebuild the current image with the following commands on your local machine (not the DiskStation, for some reason it doesn't work there). Replace eikowagenknecht/sonarr-sma-vaapi:latest with your dockerhub repository.

  • cd /path/to/sonarr-sma
  • docker build . -t eikowagenknecht/sonarr-sma-vaapi:latest
  • docker push eikowagenknecht/sonarr-sma-vaapi:latest
  • docker image rm eikowagenknecht/sonarr-sma-vaapi:latest

Update (user)

  • Stop the container in the diskstation with the Docker UI
  • Download the new image from Dockerhub
  • Reset the container
  • Start the container

You should now be up to date with all settings carried over.

Old method (works on DSM 6 only)

For usage on Synology Diskstation:

  • Download image

  • Create container using the information given in the official repository.

  • Do not start it yet

  • Export container as json and then delete it

  • Modify the devices section in the json file as follows

    "devices" : [
       {
          "CgroupPermissions" : "rwm",
          "PathInContainer" : "/dev/dri/renderD128",
          "PathOnHost" : "/dev/dri/renderD128"
       },
       {
          "CgroupPermissions" : "rwm",
          "PathInContainer" : "/dev/dri/card0",
          "PathOnHost" : "/dev/dri/card0"
       }
    ],
  • Import the json container configuration into the diskstation

  • Now you can run it

Don't forget to also set the vaapi codec as the first entry in the autoProcess.ini file, otherwise the hardware accelleration will not be used. Example:

[Video]
...
codec = h264vaapi, h265vaapi, h264, x264, hevc, x265
...

Please see the official repository for everything else.

Links

Docker Hub page: https://hub.docker.com/r/eikowagenknecht/sonarr-sma-vaapi

Credits

All credits go to mdhiggins.