Skip to content

HW Transcoding

Varun Patil edited this page Mar 18, 2023 · 6 revisions

Memories supports transcoding acceleration with VA-API and NVENC.

External Transcoder (Recommended)

If you plan to use hardware transcoding, it may be easier to run the transcoder (go-vod) in a separate docker image containing ffmpeg and hardware acceleration dependencies. For this, you need to clone the go-vod repository and build the docker image. Then you need to change the vod connect address and mark go-vod as external (Memories v4.13+). The important requirement for running go-vod externally is that the file structure must be exactly same for the target video files.

In the directory with the docker-compose.yml file, run,

git clone

If you are using docker compose, configure a service to start go-vod with the correct devices and filesystem structure. Otherwise, manually start the container with these parameters.

# docker-compose.yml

    image: nextcloud
    restart: always
      - db
      - redis
      - ncdata:/var/www/html

     build: ./go-vod
     restart: always
      - /dev/dri:/dev/dri
      - ncdata:/var/www/html:ro
      - ./go-vod.json:/app/config.json

You need to create a config file for go-vod. You can get the current config file by running occ memories video-setup --print-config. Note that the ffmpeg and ffprobe paths as well as bind address must be set to the values below. Note that you will need to configure hardware acceleration in this file.

Note: If your Nextcloud container does not have the correct dependencies for hardware acceleration, then video-setup will not properly detect it. In this case you must configure it manually in the go-vod config JSON file.

    "bind": "",
    "ffmpeg": "\/usr\/local\/bin\/ffmpeg",
    "ffprobe": "\/usr\/local\/bin\/ffprobe",
    "tempdir": "\/tmp\/go-vod"

    "vaapi": false,
    "vaapiLowPower": false,
    "nvenc": false,
    "nvencTemporalAQ": false,
    "nvencScale": "npp"

Finally, point Memories to the external go-vod instance. In config.php,

  'memories.vod.external' => true,
  'memories.vod.connect' => 'go-vod:47788',


Newer Intel processors come with a feature called QuickSync that can significantly boost transcoding performance (4-5x improvement over x264 is common). QuickSync can be used for hardware accelerated transcoding using the VA-API in ffmpeg.

To configure VAAPI, you need to have /dev/dri available to the Nextcloud instance with the www-data in the group owning the drivers. You also need the correct drivers and a compatible version of ffmpeg installed.


sudo apt-get update
sudo apt-get install -y intel-media-va-driver-non-free ffmpeg


apk update
apk add --no-cache bash ffmpeg libva-utils libva-vdpau-driver libva-intel-driver intel-media-driver mesa-va-gallium

Docker installations (Internal Transcoder)

If you use Docker, you need to:

  1. Pass the /dev/dri device to the container. In docker-compose.yml:

      build: .
      restart: always
        - /dev/dri:/dev/dri
  2. Make sure the right drivers are installed. This can be done using a custom Dockerfile, for example

    FROM nextcloud:25
    RUN apt-get update && \
        apt-get install -y software-properties-common && \
        apt-add-repository -y non-free && \
        apt-get update && \
        apt-get install -y intel-media-va-driver-non-free ffmpeg && \
        rm -rf /var/lib/apt/lists/*
    COPY /
    CMD /


    GID=`stat -c "%g" /dev/dri/renderD128`
    groupadd -g $GID render2 || true # sometimes this is needed
    GROUP=`getent group $GID | cut -d: -f1`
    usermod -aG $GROUP www-data
  3. Check the output of /tmp/go-vod/<instance-id>.log if playback has issues

linuxserver/nextcloud image

You can add the following to the docker-compose.yml file to install the drivers:

      - /dev/dri:/dev/dri
      - DOCKER_MODS=linuxserver/mods:universal-package-install
      - INSTALL_PACKAGES=libva|libva-intel-driver|intel-media-driver|mesa-va-gallium

Building drivers and FFmpeg from source

In some cases, you may need to build the drivers and ffmpeg from source. For example, the available version of the media driver for the current debian image used by Nextcloud only supports upto Ice Lake CPUs. This recipe might be useful.

FROM nextcloud:25

# Enable QSV support
SHELL ["/bin/bash", "-c"]
RUN apt-get update && \
    apt-get install -y sudo curl git && \
    rm -rf /var/lib/apt/lists/*
RUN curl | bash