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 (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.
  • Rewrite the project bin (tree) to use the model / view that was featured in Till Theato's refactoring branch
  • Simplify the Kdenlive file format which currently mostly clips twice (once in the usual MLT playlist and once in "kdenlive_producer" list). This should also improve compatibility with Shotcut project files.
  • As a bonus, this should allow to add effects to clips in the project tree which will be a very useful feature (especially for color correction).

Status: in progress, mostly done. Detailled infos

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).

Status: todo. Detailled infos

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.

Status: todo. Detailled infos

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.

What's new in Kdenlive/KF5

File format

The Kdenlive project file format has changed. In previous KDE4 Kdenlive versions, some xml was manually added to MLT's xml output to store Kdenlive specific data. This has now changed and all data will be read / written by MLT's XML module. This means that all Kdenlive properties must be passed onto MLT objects (tractor, playlist, clips, etc). A description of these new properties can be found on the File Format Info Page

This page was last edited on 15 February 2015, at 20:28. Content is available under Creative Commons License SA 4.0 unless otherwise noted.