Video editing on Linux: Davinci resolve, Premiere, and... Insta360 Studio?
28/09/2024
As I talked about in my last article, my biggest difficulty with moving to Linux is video editing - and it's fairly straight forward to understand why. When it comes to high quality videography (which is to say, not VFX) the market is dominated massively by two programs - Adobe Premiere Pro, and Black Magic Davinci Resolve.
The former is the obvious choice if you like to be ripped off, you're a pirate, or you happen to have the rest of the suite. The latter is the obvious choice if you don't like to be ripped off - let's face it, it is a bit harder to learn, but it has pretty much every significant feature Premiere does.
Well, the former isn't available on Linux and there is very limited information on using it with WINE. The latter is available on Linux, but lacks MP4 and GPU support in the free version, completely lacks AAC support, plugin support... yeah.
Well now what?
The obvious choice is to find something that's Linux native and actually capable of using your video card for, well, video editing. I'll just get this out of the way, from most comprehensive to least, KDENlive, Shotcut, and Openshot are the obvious choices. They all generally work well, but, they are a bit of a learning curve - a learning curve that I'd suggest is not proportional to the functionality offered. They're all harder to use than Premiere, in my opinion, despite having less features (Although KDENlive comes so close it won't matter for 9/10 users).
Because of that, I stumbled upon Flowblade. Flowblade, I actually get on with quite well - however, it does not appear to have the backing the other 3 have, so if you're a professional looking for something you can rely on long term, it may not be the best choice. That said, it's been going for years as it is... and I haven't encountered any bugs with it. It is my personal preference.
I won't argue that any of these editors are better than the next - Shotcut and especially Openshot may lack some features compared to the others but that doesn't make them worse. It depends on your usage. It depends on the UX you can get on with - although I managed to pick up Davinci quite easily from Premiere, I struggled to pick most of these up besides Flowblade. That doesn't mean you will have the same experience - there is 0 harm in trying them all and seeing what happens.
But but but... my Adobe!!
Alright you fanboy, I hear you. Premiere does have some things that set it apart from even Resolve - for me, the biggest is it's UX. It is easily the most intuitive editor I've ever used. Plus it packs some serious features, like stabilization and noise cancellation. Given games run on Linux and make good use of GPUs, it is theoretically possible to run Premiere on Linux, right?
Well, it isn't a theory anymore. A couple of people have got it running, and I am one of them. I found the guidance a little bit hard to follow so I will dumb it down - but the following assumes you have Wine and Winetricks installed, and you know where your Wine prefix is - these things are easy to look up if you don't know. Let's get started.
Firstly I have to give credit to this Forum post. It formed the basis of this guide. Secondly, I do not know how well this works on AMD, but there is some info in the comments on this Reddit post.
To start, we need a Premiere installer. We cannot use Creative Cloud (Not sure why you'd want to anyway...). You do have to pirate the software. Currently, Only 2024 V24.0.3.2 is known to work... if you're sailing in the bay, look for "Hax node" - it's preactivated.
Now, we are going to need a Windows VM. Sounds counterintuitive I know, but here me out. We need to "Install" Premiere Pro here, as the installer doesn't work right in WINE. For this task, I recommend you use Virtual Box, with Tiny 11 Core. This is a lightweight version of Windows 11 that's quicker to download and install. Simply create a new VM in Virtual box and point it to the ISO, then walk through the installer.
Once you boot into Windows, you need a shared folder. Use the "Devices" option at the top and select "Insert guest additions..." at the bottom. This will "Insert" a CD that will appear on the left of any explorer window. Open the CD, find the .exe that matches your architecture (probably AMD64), right click and run it as admin. Go through the install and reboot the VM. Then again, in the Devices menu, select "Shared Folders" - a menu will open. Use the plus button and then select any folder - preferably the one with your Premiere installer in it.
Now we have setup a shared folder, open it by selecting Network on the left of an explorer window. If you're prompted to enable device discovery, do it. You should see a device in there, open it, and your folder will be there. Now just run the installer
Once installed, we need to move its files back to Linux. In the VM, in Explorer go to Program Files (X86), then Adobe, and it should be right there. Copy the whole folder to your shared folder. Finally, we need some DLLs from Windows - go back to the drive's root, then into System32. Find these two files:
- msxml3.dll
- msxml3r.dll
Okay, from now on I'll post screenshots, as this is the bit where looking it up probably won't help you. Your shared folder should look like this:
Go into the Premiere folder. We need to duplicate 2 files for reasons I don't yet understand:
- icuin69.dll - rename copy to icuin.dll
- icuuc69.dll - rename copy to icuuc.dll
This will look like this
Now let's get WINE setup. This does require some terminal use I'm afriad. Have your Prefix directory to hand, even if it's the default, it's better safe than sorry. Run these commands:
- WINEPREFIX=/(Directory)/ winetricks dxvk corefont
- WINEPREFIX=/(Directory)/ winetricks msxml3
- WINEPREFIX=/(Directory)/ winetricks gdiplus fontsmooth=rgb
Now things get really interesting. The Forum I posted earlier explicitly says you shouldn't use Winetricks to install msxml3, but I found if I didn't, most of the UI didn't render. At the same time, I also found if I didn't place the DLL files in from earlier, it wouldn't work. I set this up twice and both times I had to install via Winetricks, then drop in the DLLs... so you may as well do the same. msxml sets up the DLL override for us so it is easier to just paste that command in and not have to open Regedit.
Grab the 2 DLLs from the Windows VM, go to your prefix directory, Go to drive_c, then System32, and place them in there. Override existing files. Then, go back to your drive_c folder, then into program files (x86), and create a Adobe folder and place the Premiere Pro folder inside.
Now for what should've been the easy part, but ended up being hard. We need to install some stuff to get CUDA to work. Download Nvidia Libs via the releases - don't try building it, there's not really any point. 0.7.13 is the version I am using as I was having trouble and someone on the Forum was using that version. Extract this to a safe place - bear in mind, you won't be able to delete this folder. In theory, you can open a console within the folder, and run - WINEPREFIX=/(Directory)/ ./setup_nvlibs.sh install - however, there is a chance you'll encounter "failed to create override" once the script reaches 64 bit scripts. I have no idea why this happens, but I do know how to fix it - we'll have to install this manually.
Troubleshooting (Only do this if nvlibs throws an error)
This was a bit of a headache, but I managed to work out what the script does. Basically, it creates shortcuts from your prefix syswow64 and system32 folders, to a combo of windows DLLs and standard Linux libraries - which are .so files - but the shortcuts are named "xyz.dll". In Windows, a shortcut has a unique file extension, .lnk, in Linux they don't have any extension, so any programs will read that filename and assume it's dealing with a DLL when really it's dealing with Linux libraries. So, if your script didn't work, simply check/create the following shortcuts in your prefix:
- In syswow64, nvapi.dll, pointing to nvlibs/lib/wine/i386-windows/nvapi.dll
- In syswow64, nvcuda.dll, pointing to nvlibs/lib/wine/i386-windows/nvcuda.dll
- In system32, nvcuda.dll, pointing to nvlibs/lib64/x86_64-unix/nvcuda.dll.so
- In system32, nvoptix.dll, pointing to nvlibs/lib64/x86_64-unix/nvoptix.dll.so
- In system32, nvapi64.dll, pointing to nvlibs/lib46/x86_64-windows/nvapi64.dll
Once you're sure all 5 shortcuts are present, we need to make DLL overrides. Open the Winetricks UI, select default prefix, then run Regedit. Navigate to HKEY_CURRENT_USER/Software/Wine/DLLOverrides
Then, right click and create new string values, and just replicate my setup:
OMG Premiere Pro in Linux!?!
The most user-friendly way to run it is to use Winetricks "Run arbitrary executable" option, although you can do it from the terminal if you like. To my shock, it worked. You almost certainly will get a error, and that error may be hidden behind the splash screen. If you have Plasma, right-click the WINE icon in your task manager, select more, then move. You can move it into view and continue. Select File, then create a new project. Then back to File, and then Project settings. Verify that CUDA rendering can be selected as shown:
If you have an issue here, something is up with your nvlibs. Check all the shortcuts are present, and check the DLL overrides. Once you're up and running, you'll want to select edit, then preferences, then general. Disable compatibility warnings as shown:
Okay, now for real, we're done. This is Premiere Pro, "ethically sourced", running on Linux with acceleration. However, I have something else I need for some workflows, something there isn't any alternate to.
Let's get even more niche!
Insta360 is a fairly popular 360/Action cam company. I have their OneR with the 1-Inch module, and it's still one of the best low light action cams in existence. However, it creates somewhat proprietary files if you want full post-processing - technically they're MP4s, but they contain information that can be used for stabilization. This is why Insta360 studio exists - it can apply that stabilization in post. It can also change the FOV since it knows the exact lens corrections required, and it even comes with a pretty good noise reduction system. I generally like it. I tried to get it to run via WINE, but even with acceleration turned off in the settings, it wouldn't render anything.
However, I had a trick up my sleeve. I simply added it to steam and used Proton! That got it working, and the performance isn't too far off from what I experienced on Windows - the UI lags a bit more, but render times are fine. There's a noteworthy bug though, once your render queue is complete, the UI freezes. The program is still running, as certain animated elements are still animated, but you can't do anything. I've always just cut and set the FOV of everything and then rendered it all after anyway, so this doesn't really affect my usage.
You will find your files in /home/user/.steam/steam/steamapps/compatdata/(random number)/pfx/drive_c - you can specify a specific prefix with STEAM_COMPAT_DATA_PATH=/path/ %command%
You promised us resolve!
I did, and honestly, that's still my preference. Windows resolve would have AAC support and GPU acceleration in the free version, making it go from borderline useless, to arguably the best video editor on Linux. However, I haven't been able to get it to work, even with Proton. It seems to be unable to detect my GPU and as such, fails to start. I will keep tinkering with this though, as this would truly be perfect.
Bloody hell that's a faff. What's the point?
The point is, if you need something powerful, Linux still doesn't have anything reliable. Davinci is so close, yet, so far, as it only lacks a few things but those few things are critical for many users. Everything else is tricky to learn, lacks online resources, and often lacks functionality. Some people will have moral reasons to avoid Adobe products, and I not only get that, I agree with it - but, remember to do this you have to pirate the software, so you're not giving them a penny, nor are you installing creative cloud. That said, it would be nice to be able to support their main competitor.
So, with this setup I am able to process footage from my Insta360 and then edit it further in Premiere, just like I would on Windows (Well I'd prefer Davinci on Windows but hey ho).
I grabbed a video off of my Insta360 OneR, set it to "Linear" in the Insta360 studio, exported it at 4K 55Mbit, Imported it into Premiere, did some basic colour correction and applied both an input and output LUT, then exported that at 4K 45Mbit. Everything was fine, rendering time didn't seem all that different from what I am used to and previews were instant, as they tend to be when I process footage from this Camera since it's peak bitrate is 80Mbit I believe. You can see the outcome below, although I've cut it down and compressed it much more to limit the space taken up on the site.
All in all, this is honestly the most capable video editing setup on Linux right now. As I described earlier though, a large number of people could get on with many of the Linux native editors, I did this partly for the fun of it, but also because I would really like to try and get the Windows version of Resolve running if it's possible. For now though, this is pretty impressive. I won't bother with Photo though as I'd quite like to put the command line mashing to bed and Linux actually has brilliant alternatives to Lightroom.