Jump to content

Kdenlive/Development/KF5

From KDE Community Wiki

Working with Kdenlive on KF5

Compiling MLT with Qt5 support

The first step is to recompile MLT with Qt5 support. If you have both Qt4 and Qt5 installed you may need to manually set the path to Qt5 libs/include dirs.

On Kubuntu, you can do it by adding the following to the configure: --qt-includedir=/usr/include/x86_64-linux-gnu/qt5 --qt-libdir=/usr/lib/x86_64-linux-gnu/

Compile MLT and make sure it works: melt myclip.mp4

As Dan Dennedy recently pointed out, the frei0r package, which contains many effects, sometimes causes crashes because 2 of its filters are usually compiled against Qt4, which conflicts with Qt5. The solution is to balacklist these 2 filters, by adding them in MLT's blacklist.txt file, found in:

  1. $INSTALL_PREFIX/share/mlt/frei0r/blacklist.txt

Just add these lines to the file:

  1. frei0r.facebl0r
  2. frei0r.facedetect

Get the frameworks branch of Kdenlive

  1. Get the sources:
    git clone git://anongit.kde.org/kdenlive
  2. Get the frameworks branch:
    git checkout -b frameworks origin/frameworks

Compile Kdenlive

You will need to install several Qt/KDE devel packages to successfully compile. On Ubuntu, packages are : qtscript5-dev libkf5xmlgui-dev libkf5newstuff-dev libkf5notifyconfig-dev libkf5plotting-dev This should allow you to compile Kdenlive/KF5 and try the current code.

Refactoring and code cleanup

Some parts of the code really need a refactoring to make the code cleaner and easier to maintain / change. Some work has already been done by separating functions in files and folders.

The plan is now to rework how Kdenlive interacts with MLT, taking ideas from Shotcut which is a video editor written by Dan Dennedy, author of MLT.

As a coordination effort, we created a Kdenlive entry in todo.kde.org (identity login required), so that developers can display what they are working on. A public version is available here.

Basically the Kdenlive/MLT refactoring is a 3 step plan:

Step 1: Handling of project clips

Currently, Mlt clips are stored in the DocClipBase class. A lot of the clip properties are stored in QMap or QDomDocument there. The idea is to move to a structure closer to Shotcut, by storing all the project clips in a special playlist that is not displayed in timeline. Then, the DocclipBase class can be simplified to just read properties directly from the clip in this special playlist, and we stop storing xml properties. This also should allow to add effects to clips in the project tree which will be a very useful feature (especially for color correction). This also means that we can simplify the Kdenlive file format which currently mostly stores clips twice (once in the usual MLT playlist and once in "kdenlive_producer" list).

Step 2: Rewrite Monitor code

The idea is to kind of import Shotcut's monitor code and adapt it to Kdenlive. This will bring back the Movit integration and will require work in several parts to make sure everyone is aware when we use Movit (some effects should be enabled/disabled depending on this, etc).


Step 3: The Timeline

Currently the timeline stores all clips positions internally, being completely independant of the MLT playlist. This is due to historical reasons, but now leads to the infamous "timeline corruption" bugs that we have been fighting for years. We should now rework on this to have a direct connection between the timeline and MLT's playlist so that the timeline is a direct representation of MLT's data.

Step 4: everything else

There are many other tasks, one of the biggest will be a rewrite of the titler code, which currently uses MLT's kdenlivetitle module that was fine for very basic titles but should now be ported to something based on an HTML overlay, like webvfx which would allow animations and many other improvements.

The Animation feature of effects parameters also should be integrated.