[Improvements] Improve And Optimize Kdenlive's Performance
So, with new features coming to Kdenlive, I think its time to think about getting Kdenlive up to Performance. For example, Kdenlive's Playback stutters is still which needs a fix. Improving the startup speed could be usefull, Realtime Playback needs improving and Reducing the Memory Usage needs to be fixed somehow. I think all this needs to be in top shape before 20.03. Kdenlive needs this in order to satisfy more users into using Kdenlive more. I have high hopes that Kdenlive will succeed.
Edit [jbm]
There are several performance related things that can/should be done to improve current situation. Some of them in Kdenlive, some of them in MLT.
Current slowdowns in Kdenlive:
-
Jobs are created with QtConcurrent::Map which doesn't support adjusting job priority. We could probably get faster jobs (audio/video thumbs) by launching command line apps with nice like Shotcut -> see #986 (closed) -
Drawing of audio thumbnails in timeline relies on not very efficient qml code that should be refactored -
Operations on groups of items in timeline are very slow because view and backend are refreshed with each item... to be reviewed -
One difference between Shotcut and Kdenlive in timeline management is that we reuse the same MLT producer for all instances of the same clip on a track, while Shotcut uses a different MLT producer for each clip instance. That might affect caching performance when playing a track with multiple cuts of the same bin clip...
Improvments on MLT's side:
-
Explore possible performance gain for timeline playbavk by using lower resolution playback. This will require adding percentage storage for animated rect parameters so that it behaves correctly -
Full GPU support - from ffmpeg to filters. This will require some infrastructural changes in MLT. -
Add filtergraph support for avformat producer. It should allow applying ffmpeg filters directly to a video clip without passing through MLT. Basically you have to pass ffmpeg filter syntax in this filtergraph property to apply them. Currently Kdenlive has no way to do this but it's an interesting step. -
Have a different audio and video cache, allowing smoother audio but choppy video. See #1617
Project bin and timeline playback [ME]
-
Improve RAM management of placeholders. 1.3GB RAM needed for loading "weird_scrollPos.kdenlive" with 160 clips (all place holders!). Clips in the timeline need 0.2GB only. Each placeholder need 7MB RAM in the Project bin. weird_scrollPos.kdenlive. See here how the RAM get filled up until Kdenlive crash: #439 (comment 655137) -
Improve playback performance with track composition: high quality
. Problem is that without track compositing on high quality there is no transparency, every track is opaque. So if you want to have a title clip or a png with transparency you would have to manually add a composition. Subtitle doesn't need a composition to be transparent. See #439 (comment 383163) -
@jlskuz Memory is allocated every time the timeline cursor comes across a new clip with av_malloc from avutil, but it seems to get never released. The leak seems to happen in a different thread and hence the trace is not that clear… From a quick test in Shotcut this does not seem to happen, but I will do more test with Shotcut. Tested with Heaptrack. -
Audio distortion of first 500 – 1000ms when starting playback. See #1617
Rendering
-
@jlskuz [25.02.2022] I opened and rendered a project with about 45 minutes length. I didn't do any editing, just rendering and Kdenlive got frequently killed by the OS because it ate all RAM (about 10GB for Kdenlive it self). The melt render progress continued to work and used only about 1.8GB of RAM (The machine had 16GB RAM in total)
See here as well: #970 (closed)