kaeru


"Stuff I'm working on ..."

Getting Started with DaVinci Resolve Linux on AMD and Ubuntu Linux

by kaeru published 2023/12/28 13:30:00 GMT+8, last modified 2023-12-30T19:07:22+08:00
Quick guide into getting DaVinci Resolve working on Linux and AMD open source drivers

DaVinci Resolve Linux 18.6 on Ubuntu Linux Desktop

DaVinci Resolve is fast becoming the standard video editor for content creators whether you're making quick cuts or producing a full length feature movie or documentary. As a result, if you're getting started into video editing and production like me, then it also means access to a wealth of great tutorials and guides online.


Davinci Resolve was one of the first large professional video editing application to also support Linux. Earlier versions were quite specific on which versions of Linux and graphics cards/drivers it would work on. This isn't very practical if you already have a working desktop install like Ubuntu Linux. Also it only worked with Nvidia GPUs and their proprietary albeit very good, graphics drivers. With AMD GPUs or other distributions, you would get random quirks, like blank video preview screens or it just not loading up at all.

Currently however, it works well on AMD's open source driver stack.

It's not exactly plug and play experience, yet so here is a brief guide to getting DaVinci Resolve up and running on Ubuntu Linux with AMD's open source graphics drivers.

OpenCL support via rocm

DaVinci Resolve for AMD uses OpenCL to accelerate video features, especially for rendering. You will want to have this feature. While Rocm is associated with AMD's much maligned efforts at getting an open source compute and AI stack working on Linux, it does have a stable and supported GPU OpenCL driver and libraries for AMD RDNA, RDNA 2 and RDNA 3 consumer cards. Installing this also means you get OpenCL support for your GPU card which works great with other applications like Darktable for photo editing.

The official instructions for the latest version of Rocm for Ubuntu can be found here. You only need the kernel and OpenCL drivers, not the full AI/computer rocm libraries, and they will fail to install unless you're using Ubuntu 22.04 LTS This is the minimal setup for OpenCL support.

Quick install:

wget https://repo.radeon.com/amdgpu-install/6.0/ubuntu/jammy/amdgpu-install_6.0.60000-1_all.deb
sudo apt install ./amdgpu-install_6.0.60000-1_all.deb
sudo apt install "linux-headers-$(uname -r)" "linux-modules-extra-$(uname -r)
sudo apt install amdgpu-dkms
sudo apt install rocm-opencl-runtime
sudo apt install clinfo

You might get some issues with modules not found if you're using a low-latency kernel in which case, run `uname -r` which should give you your current kernel `6.5.0-14-lowlatency`

If so run the third line separately

sudo apt install "linux-headers-$(uname -r)"
sudo apt install linux-modules-extra-6.5.0-13-generic

Where the 6.5.0-13 matches your current kernel from the first command

Reboot.

To test that OpenCL is working, type clinfo and you should get 2 platforms listed, one your CPU and the second your GPU.

~$ clinfo 
Number of platforms 2

Installing Davinci Resolve

Head on over to their website and download DaVinci Resolve (free version).


The installer isn't packaged for Debian and if you would like to cleanly install, upgrade and maybe remove it in future, you probably want to to install as a debian package, there is a great utility called `MakeResolveDeb`and I recommend you install it.

Download the latest version there https://www.danieltufvesson.com/makeresolvedeb

The instructions on how to use it and install DaVinci Resolve as a Debian package are at Daniel's website.

Unable to start and problems with libraries

On newer versions of Ubuntu Linux, you might find that DaVinci Resolve won't start. This is most likely due to problems with linked libraries bundled with DaVinci. The simplest and safest solution is to remove the conflicting libraries from the DaVinci install with the following command.

sudo rm /opt/resolve/libs/libglib-2.0.so

Audio Sync Issues

Pipewire is now default audio system on Linux and DaVinci Resolve has a strange quirk that delays audio by 1 sec that requires a specific override just for the app.

It's now in the default installs, but if it isn't in yours, you'll need to add this in /etc/pipewire/client-rt.conf

# client specific properties
alsa.rules = [
    {   matches = [ { application.process.binary = "resolve" } ]
        actions = {
            update-props = {
		alsa.buffer-bytes = 131072
            }
        }
    }
]

Video Codec Support on Linux

The video codec support on Linux for the free version is very limited, unlike other platforms. You will get frustrated that the videos from your phone and camera only have audio after import.

Currently the two codecs that are known to work for me are DNxHD and Prores which can be converted using `ffmpeg`. The size for prores is much smaller then DNxHD, and 50% of the size of XAVC S 10bit at quality scale of 9.

ProRes

ffmpeg -i input.mp4 -c:v prores_ks -profile:v 3 -qscale:v 9 -acodec pcm_s16le output.mov

Prores conversion I got from another Davinci on Linux guide (flolu)

For convenience you can also do bulk conversion on command line with GNU Parallels eg. in the directory of your video files.

ls *.mp4 | 
parallel ffmpeg -i {} -c:v prores_ks -profile:v 3 -qscale:v 9 -acodec pcm_s16le {.}.mov

DNxHD

ffmpeg inputfile.avi -c:v dnxhd -vf "scale=1920:1080,format=yuv422p10" -b:v 175M -c:a pcm_s16le output.mov

First Tutorials

You should now able to launch DaVinci Resolve and started with the excellent training materials from BlackMagic

https://www.blackmagicdesign.com/products/davinciresolve/training

As before, you'll need to convert the provided files first, before it can be imported on DaVinci Resolve Linux.

Hopefully this helps, and that this guide will be reduced and not even required in the near future.