Windows + Kdenlive + NVENC - Part 1: Nvidia H264 & H265 Hardware encoders
Rédigé par uTux 4 commentairesKdenlive is a great software but I noticed a major drawback on the Windows version: render time that is really slow. For example, let's take a 45min H264 2560x1440 60fps video file and crop it to 1920x1080 ("Position and Zoom" effect on Kdenlive). Render time is about 1h15 on Kdenlive while it's only 15 minutes on Adobe Premiere Pro, the difference is insane. Why is the later so fast ? Spoiler: GPU rendering.
Let's talk about how rendering works. Kdenlive use ffmpeg and MLT. The Windows version of Kdenlive is built with an embedded minimal ffmpeg that does not support GPU hardware acceleration, which is sad. Fortunately, it is possible to download the full version of ffmpeg and install it on Kdenlive, here is how to proceed.
Download
- Kdenlive Standalone (self-extracting archive)
- ffmpeg shared (ffmpeg-release-full-shared.7z)
Installation
- Run the kdenlive installer which is in fact a self-extracting archive. Extract the contents in a location, for example C:\Program Files\Kdenlive.
- Extract ffmpeg-release-full-shared.7z to a temporary location, for example C:\Users\utux\Downloads.
- Copy C:\Users\utux\Downloads\ffmpeg\bin\* to C:\Program Files\Kdenlive\bin\
- Copy C:\Users\utux\Downloads\ffmpeg\presets\* to C:\Program Files\Kdenlive\share\ffmpeg\
Configuration
Start or restart Kdenlive then click Configuration > Run Config Wizzard. Check "Nvidia hardware acceleration" and make sure it is properly detected.
The following render profiles show be available now:
- NVENC H264 CBR
- NVENC H264 VBR
- NVENC H265 CBR
- VAAPI Intel H264
- VAAPI AMD H264
Try to render a project using one of these profiles and take a look at the Performance / GPU / Video Encode section in the Task Manager:
If the GPU Encode graph is low (20% or less) that means that Kdenlive is rendering Effects on the CPU (such as "Position and zoom"). See limitations below.
Limitations
- Right now (Apr 2021) effects cannot be rendered by the GPU (at least on Windows). This may lead to frustrating situations where the GPU encoder only works at 20% and render is slow. I used to capture 1080p games in a 1440p desktop, then crop with the "Position and Zoom" effect, I changed that. Now I have set OBS Studio to record in 1080p, negating the need any transformation.
- I could not make NVENC work for proxy clips, which is bad.
- The Windows version of Kdenlive does not seems to support Movit aka "Experimental GPU processing" which add effects that can be rendered by the GPU. For example, instead of "Position and zoom" you can use "Pan and zoom (GPU)". You should try the Flatpak version (Linux).