Bug 426134

Summary: MELT.EXE can support GPU if enabled
Product: [Applications] kdenlive Reporter: Peter Whisker <peter>
Component: Video Display & ExportAssignee: Jean-Baptiste Mardelle <jb>
Status: CONFIRMED ---    
Severity: wishlist CC: facorread, fritzibaby, snd.noise
Priority: NOR Flags: fritzibaby: Brainstorm+
Version: git-master   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Peter Whisker 2020-09-03 08:00:48 UTC
SUMMARY

Swapping the version of melt.exe for that supplied with Shotcut (C:/Program Files/Shotcut/melt.exe) allows GPU rendering

STEPS TO REPRODUCE
1. Swap melt.exe as above (I also swap the three ffmpeg executables for consistency)
2. Create custom profile (see below in Additional Information)
3. Render in half the time using GPU

OBSERVED RESULT

This is a request that the Kdenlive shipped version of melt.exe has the libav hardware based encoders enabled by default to avoid having to swap the binary. GPU rendering on my Intel UHD 620 works very well and is a lot faster.

EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 10
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION

HEVC_QSV:
vf='hwupload=extra_hw_frames=64,format=qsv' preset=veryslow global_quality=%quality vcodec=hevc_qsv progressive=1 acodec=aac ab=%audiobitrate+'k'

H264_QSV:
f=mp4 movflags=+faststart init_hw_device=qsv:hw filter_hw_device=hw hwaccel=qsv vf='hwupload=extra_hw_frames=64,format=qsv' preset=veryslow global_quality=%quality look_ahead=1 vcodec=h264_qsv acodec=aac ab=%audiobitrate+'k'
Comment 1 emohr 2020-09-14 16:44:49 UTC
Tested on Win7 (NVidia 1650) and Win10 (Intel HD 620). Following your steps and select "H264_QSV" I get the error message "unsupported video codec: h264_qsv". 

How do you manage to get GPU rendering? 
Which Kdenlive version and which Shotcut version do you use?
Comment 2 Peter Whisker 2020-09-15 11:22:14 UTC
I am currently using 20.11.70 which is a daily although I think it also works on the latest formal release.

I have deliberately not checked "Bypass codec verification" on the Configure page as that causes another problem because it corrupts the GUI when it comes across the [misc] section on the kdenliverc file (see bug #420595).

So when you start kdenlive the Custom codecs in the Rendering menu have a red X and "Unsupported video codec" message, simply select one of them and hit the edit button and then press OK and they will come back to life for that kdenlive session and should work fine.
Comment 3 Peter Whisker 2020-09-15 11:28:38 UTC
PS: By "Swap the version of melt.exe" what I mean is that I configured the Environment section, MLT environment tab to the following:

* C:/Program Files/Shotcut/ffmpeg.exe
* C:/Program Files/Shotcut/ffplay.exe
* :/Program Files/Shotcut/ffprobe.exe
* C:/Program Files/kdenlive/share/mlt/profiles
* C:/Program Files/Shotcut/melt.exe

I did not move any files around.
Comment 4 Jean-Baptiste Mardelle 2020-09-17 15:31:43 UTC
Thanks for the information. In fact, this is possible in Shotcut because they built FFmpeg with all libraries necessary for GPU accel:

NVENC: git://github.com/FFmpeg/nv-codec-headers.git
AMF:   git://github.com/GPUOpen-LibrariesAndSDKs/AMF.git
QSV:   git://github.com/lu-zero/mfx_dispatch.git

For reference, Shotcut's build script including FFmpeg and MLT's builds is here:
https://github.com/mltframework/shotcut/blob/master/scripts/build-shotcut.sh

So to have this in Kdenlive's Windows version, we need to add these libraries to Craft, so they can be used when building FFmpeg and MLT.

We need to create recipes to build these libs, like is currently done for the other libraries :

https://invent.kde.org/packaging/craft-blueprints-kde/-/tree/master/libs/_autotools

Also, Craft's FFmpeg version is currently 4.1 while Shotcut uses 4.3

Probably won't have time in the very near future myself so if someone wants to explore this, welcome!
Comment 5 farid 2021-03-04 21:04:10 UTC
This is fixed right?
Comment 6 Peter Whisker 2021-03-05 14:09:22 UTC
(In reply to farid from comment #5)
> This is fixed right?

I don't think so. And if you want to render subtitles you have to use the Kdenlive version of melt and do without GPU support.