You are not logged in.

#1 2020-03-30 19:20:47

d_fajardo
Member
Registered: 2017-07-28
Posts: 1,563

[Solved] Possible to render using GPU instead of the CPU in Kdenlive?

I have an Nvidia Quadro P2000 GPU and currently editing a video in Kdenlive. I would like to know if I can use the GPU to render my project instead of the CPU.
I've always rendered with the CPU in the past but since ffmpeg is the main transcoder for Kdenlive and since it also has support for Nvidia's nvenc, I would think it should be possible to use the GPU to render in Kdenlive.
Any help will be highly appreciated.

Last edited by d_fajardo (2020-04-03 13:01:28)

Offline

#2 2020-03-30 19:41:39

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,441
Website

Re: [Solved] Possible to render using GPU instead of the CPU in Kdenlive?

https://wiki.archlinux.org/index.php/NVIDIA_Optimus

EDIT: I think I misunderstood - this may not be relevant.

Last edited by Trilby (2020-03-31 12:28:25)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2020-03-31 06:25:28

d_fajardo
Member
Registered: 2017-07-28
Posts: 1,563

Re: [Solved] Possible to render using GPU instead of the CPU in Kdenlive?

Thanks Trilby. I'm not sure the Optimus answers my question but I could be wrong. First of all this is a desktop and secondly, I'm already using discrete Nvidia graphics via my BIOS.
My question is really ffmpeg's support for nvidia nvenc and how I can bind that support into Kdenlive for rendering. I've just finishing editing a video and just need to do a final render. In the past, I simply render with Kdenlive's default rendering which uses the CPU. Just wondering if there's a way of telling Kdenlive to use the ffmpeg nvenc support.

Offline

#4 2020-03-31 11:55:30

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,866

Re: [Solved] Possible to render using GPU instead of the CPU in Kdenlive?

Maybe you can do that with a custom render profile, see https://userbase.kde.org/Special:MyLang … r_Profiles


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#5 2020-03-31 12:30:04

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,441
Website

Re: [Solved] Possible to render using GPU instead of the CPU in Kdenlive?

Yes, sorry, I think I misread.  But wouldn't this then require a cuda setup and kdenlive, or at least ffmpeg, patched to use cuda?  There is a ffmpeg-cuda in the AUR.

EDIT: strike 2 for me.  Sorry.

Last edited by Trilby (2020-03-31 12:36:52)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#6 2020-03-31 12:35:13

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,410

Re: [Solved] Possible to render using GPU instead of the CPU in Kdenlive?

No you don't need cuda for this and the ffmpeg package is compiled with nvenc/nvdec support: https://wiki.archlinux.org/index.php/FF … VENC/NVDEC

Online

#7 2020-03-31 15:26:46

d_fajardo
Member
Registered: 2017-07-28
Posts: 1,563

Re: [Solved] Possible to render using GPU instead of the CPU in Kdenlive?

Lone_Wolf wrote:

Maybe you can do that with a custom render profile

Thanks. I'll have a look at this.

Offline

#8 2020-04-03 09:43:00

dbrief
Member
Registered: 2020-01-21
Posts: 16

Re: [Solved] Possible to render using GPU instead of the CPU in Kdenlive?

Comparatively, quality will blow encoding from GPU.

But it will be blazing fast.

Offline

#9 2020-04-03 13:00:24

d_fajardo
Member
Registered: 2017-07-28
Posts: 1,563

Re: [Solved] Possible to render using GPU instead of the CPU in Kdenlive?

Yes, creating a custom render profile works.

dbrief wrote:

Comparatively, quality will blow encoding from GPU.

I'll do a CPU render and compare but the issue is solved.

Offline

#10 2020-05-01 13:07:56

simple-user
Member
Registered: 2020-05-01
Posts: 2

Re: [Solved] Possible to render using GPU instead of the CPU in Kdenlive?

Hello!
I am new here and I have read this thread with highest interest. I have exactly the same problem with kdenlive, getting it to render by using nv_enc. I am running a XFCE-Manjaro system.

My problem has been first, to follow the advice here and get the correct syntax for the rendering settings. Finally I have found these in this YouTube-Video https://www.youtube.com/watch?v=X14GvmBpq08 in the comments of some users.

For encoding h264 mp4, they recommended the rendering settings

f=mp4 vcodec=nvenc_h264 acodec=aac g=120 global_quality=21 ab=384k vq=21 r=60 preset=slow bf=2

and for h265 mp4

f=mp4 vcodec=nvenc_hevc acodec=aac g=120 global_quality=23 ab=384k vq=23 r=60 preset=slow bf=2

h265 did not work for me as the rendered file did only contain audio.

h264 did work immediately. But when I loaded a project in Kdenlive, which contained three AV tracks and one title track for overlay, it endend up with nearly the same rendering time as on ffmepg software encoding with my i5-7400 CPU @ 3 GHz (4 threads).

I could watch the load on CPU and GPU (Nvidia GTX 1650 4GB RAM) via Psensor. On nearly all circumstances graphics and video section of the Nvidia showed up with loads of some few percents whereas the CPU runs with about 60% load continously.

I have deactivated the track with all the titles in Kdenlive and did rendering again. Same thing there.

The original clips in Kdenlive are all 1920 x 1080 @50 fps 24248 kB/s and audio 48000 kHz PCM signed 1536 kB/s stereo.

When I render it to the same dimensions using the rendering recommended nvidia profile, it will take 3:32 hours (!!!).

f=mp4 vcodec=nvenc_h264 acodec=aac g=120 global_quality=21 ab=384k vq=21 r=60 preset=slow bf=2

When I render it to the same dimensions, using default profile in Kdenlive (CPU-rendering), it will take 4:

f=mp4 movflags=+faststart vcodec=libx264 progressive=1 g=15 bf=2 crf=%quality acodec=aac ab=%audiobitrate+'k'

I am very sure to have installed all drivers, which are necessary for GPU rendering. I have tested this:

$ ffmpeg -h encoder=h264_nvenc

ffmpeg version n4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9.3.0 (Arch Linux 9.3.0-1)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-nvdec --enable-nvenc --enable-omx --enable-shared --enable-version3
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Encoder h264_nvenc [NVIDIA NVENC H.264 encoder]:
    General capabilities: delay hardware 
    Threading capabilities: none
    Supported pixel formats: yuv420p nv12 p010le yuv444p p016le yuv444p16le bgr0 rgb0 cuda
h264_nvenc AVOptions:
  -preset            <int>        E..V..... Set the encoding preset (from 0 to 11) (default medium)
     default                      E..V..... 
     slow                         E..V..... hq 2 passes
     medium                       E..V..... hq 1 pass
     fast                         E..V..... hp 1 pass
     hp                           E..V..... 
     hq                           E..V..... 
     bd                           E..V..... 
     ll                           E..V..... low latency
     llhq                         E..V..... low latency hq
     llhp                         E..V..... low latency hp
     lossless                     E..V..... 
     losslesshp                   E..V..... 
  -profile           <int>        E..V..... Set the encoding profile (from 0 to 3) (default main)
     baseline                     E..V..... 
     main                         E..V..... 
     high                         E..V..... 
     high444p                     E..V..... 
  -level             <int>        E..V..... Set the encoding level restriction (from 0 to 51) (default auto)
     auto                         E..V..... 
     1                            E..V..... 
     1.0                          E..V..... 
     1b                           E..V..... 
     1.0b                         E..V..... 
     1.1                          E..V..... 
     1.2                          E..V..... 
     1.3                          E..V..... 
     2                            E..V..... 
     2.0                          E..V..... 
     2.1                          E..V..... 
     2.2                          E..V..... 
     3                            E..V..... 
     3.0                          E..V..... 
     3.1                          E..V..... 
     3.2                          E..V..... 
     4                            E..V..... 
     4.0                          E..V..... 
     4.1                          E..V..... 
     4.2                          E..V..... 
     5                            E..V..... 
     5.0                          E..V..... 
     5.1                          E..V..... 
  -rc                <int>        E..V..... Override the preset rate-control (from -1 to INT_MAX) (default -1)
     constqp                      E..V..... Constant QP mode
     vbr                          E..V..... Variable bitrate mode
     cbr                          E..V..... Constant bitrate mode
     vbr_minqp                    E..V..... Variable bitrate mode with MinQP (deprecated)
     ll_2pass_quality              E..V..... Multi-pass optimized for image quality (deprecated)
     ll_2pass_size                E..V..... Multi-pass optimized for constant frame size (deprecated)
     vbr_2pass                    E..V..... Multi-pass variable bitrate mode (deprecated)
     cbr_ld_hq                    E..V..... Constant bitrate low delay high quality mode
     cbr_hq                       E..V..... Constant bitrate high quality mode
     vbr_hq                       E..V..... Variable bitrate high quality mode
  -rc-lookahead      <int>        E..V..... Number of frames to look ahead for rate-control (from 0 to INT_MAX) (default 0)
  -surfaces          <int>        E..V..... Number of concurrent surfaces (from 0 to 64) (default 0)
  -cbr               <boolean>    E..V..... Use cbr encoding mode (default false)
  -2pass             <boolean>    E..V..... Use 2pass encoding mode (default auto)
  -gpu               <int>        E..V..... Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on. (from -2 to INT_MAX) (default any)
     any                          E..V..... Pick the first device available
     list                         E..V..... List the available devices
  -delay             <int>        E..V..... Delay frame output by the given amount of frames (from 0 to INT_MAX) (default INT_MAX)
  -no-scenecut       <boolean>    E..V..... When lookahead is enabled, set this to 1 to disable adaptive I-frame insertion at scene cuts (default false)
  -forced-idr        <boolean>    E..V..... If forcing keyframes, force them as IDR frames. (default false)
  -b_adapt           <boolean>    E..V..... When lookahead is enabled, set this to 0 to disable adaptive B-frame decision (default true)
  -spatial-aq        <boolean>    E..V..... set to 1 to enable Spatial AQ (default false)
  -temporal-aq       <boolean>    E..V..... set to 1 to enable Temporal AQ (default false)
  -zerolatency       <boolean>    E..V..... Set 1 to indicate zero latency operation (no reordering delay) (default false)
  -nonref_p          <boolean>    E..V..... Set this to 1 to enable automatic insertion of non-reference P-frames (default false)
  -strict_gop        <boolean>    E..V..... Set 1 to minimize GOP-to-GOP rate fluctuations (default false)
  -aq-strength       <int>        E..V..... When Spatial AQ is enabled, this field is used to specify AQ strength. AQ strength scale is from 1 (low) - 15 (aggressive) (from 1 to 15) (default 8)
  -cq                <float>      E..V..... Set target quality level (0 to 51, 0 means automatic) for constant quality mode in VBR rate control (from 0 to 51) (default 0)
  -aud               <boolean>    E..V..... Use access unit delimiters (default false)
  -bluray-compat     <boolean>    E..V..... Bluray compatibility workarounds (default false)
  -init_qpP          <int>        E..V..... Initial QP value for P frame (from -1 to 51) (default -1)
  -init_qpB          <int>        E..V..... Initial QP value for B frame (from -1 to 51) (default -1)
  -init_qpI          <int>        E..V..... Initial QP value for I frame (from -1 to 51) (default -1)
  -qp                <int>        E..V..... Constant quantization parameter rate control method (from -1 to 51) (default -1)
  -weighted_pred     <int>        E..V..... Set 1 to enable weighted prediction (from 0 to 1) (default 0)
  -coder             <int>        E..V..... Coder type (from -1 to 2) (default default)
     default                      E..V..... 
     auto                         E..V..... 
     cabac                        E..V..... 
     cavlc                        E..V..... 
     ac                           E..V..... 
     vlc                          E..V..... 
  -b_ref_mode        <int>        E..V..... Use B frames as references (from 0 to 2) (default disabled)
     disabled                     E..V..... B frames will not be used for reference
     each                         E..V..... Each B frame will be used for reference
     middle                       E..V..... Only (number of B frames)/2 will be used for reference
  -a53cc             <boolean>    E..V..... Use A53 Closed Captions (if available) (default true)

What can I do, to get GPU rendering working?

Last edited by simple-user (2020-05-01 17:48:12)

Offline

Board footer

Powered by FluxBB