Jump to content

Kdenlive/Development/KF5: Difference between revisions

From KDE Community Wiki
Jbm (talk | contribs)
Jbm (talk | contribs)
No edit summary
Line 102: Line 102:
  ===
  ===
  schroot -c -p vivid
  schroot -c -p vivid
== 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 [http://www.shotcut.org Shotcut] which is a video editor written by Dan Dennedy, author of MLT.
As a coordination effort, we created a Kdenlive entry in [http://todo.kde.org todo.kde.org] (identity login required), so that developers can display what they are working on. A public version is available [https://todo.kde.org/?controller=board&action=readonly&token=12c577c6fa43a6f57160b0c8e7763920c2e2f0ae058dc7a0fd061815a1ce 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. [https://todo.kde.org/?controller=task&action=readonly&task_id=701&token=12c577c6fa43a6f57160b0c8e7763920c2e2f0ae058dc7a0fd061815a1ce 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. [https://todo.kde.org/?controller=task&action=readonly&task_id=711&token=12c577c6fa43a6f57160b0c8e7763920c2e2f0ae058dc7a0fd061815a1ce 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. [https://todo.kde.org/?controller=task&action=readonly&task_id=750&token=12c577c6fa43a6f57160b0c8e7763920c2e2f0ae058dc7a0fd061815a1ce 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 [[Kdenlive/Development/File format | File Format Info Page]]

Revision as of 20:30, 15 February 2015

Working with Kdenlive on KF5

If you want to test the KF5 (KDE Frameworks 5, based on Qt5) version of Kdenlive, you need a distribution that provides a running KF5 environnment, like Kubuntu Vivid (15.04) preview releases.
The status of the refactoring development process can be found on Refactoring page

Compiling MLT with Qt5 support

The first step is to recompile MLT with Qt5 support.

First install dependencies, on ubuntu:

sudo apt-get install build-essential pkg-config \
 libavformat-dev libavdevice-dev frei0r-plugins-dev libgtk2.0-dev libexif-dev \
 libmovit-dev libsdl1.2-dev libsox-dev libxml2-dev \
 ladspa-sdk libcairo2-dev libswscale-dev qtscript5-dev libqt5svg5-dev libqt5opengl5-dev

On OpenSuse 13.2, for MLT+Kdenlive (not very used to that system, please correct me):

zypper ar -f http://download.opensuse.org/repositories/KDE:/Qt5/openSUSE_13.2 Qt5
zypper ar -f http://download.opensuse.org/distribution/13.2/repo/oss/ oss
zypper ar -f http://download.opensuse.org/source/distribution/13.2/repo/oss/ oss-src
zypper refresh
zypper si kdenlive libmlt
zypper install libqt5-qtscript-devel libqt5-qtsvg-devel \
 libQt5OpenGL-devel libQt5Concurrent-devel kplotting-devel \
 libQt5Test-devel kparts-devel knotifications-devel

Then configure, enabling all components, selecting target install dir, and pointing to Qt5...

On ubuntu 15.04 (multiarch enabled):

./configure --enable-gpl --enable-gpl3 --prefix=$INSTALL_PREFIX \
 --qt-includedir=/usr/include/x86_64-linux-gnu/qt5 --qt-libdir=/usr/lib/x86_64-linux-gnu

While on ubuntu 14.10 or OpenSuse 13.2:

./configure --enable-gpl --enable-gpl3 --prefix=$INSTALL_PREFIX \
 --qt-includedir=/usr/include/qt5 --qt-libdir=/usr/lib64

Compile and install:

make install

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 balcklist these 2 filters, by adding them in MLT's blacklist.txt file, found in:

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

Just add these lines to the file:

frei0r.facebl0r
frei0r.facedetect

Get the Qt5/KF5 branch of Kdenlive

  1. Get the sources:
    git clone git://anongit.kde.org/kdenlive
  2. Get the KF5 branch of your choice:
For developers, the frameworks branch is the current development branch containing refactoring efforts.
git checkout -b frameworks origin/frameworks
For users, the 15.04 branch is the "clean port" of KDE version for KF5.
git checkout -b 15.04 origin/15.04

Create a build directory:

cd kdenlive;mkdir build;cd build

Compile Kdenlive

You will need to install several Qt/KDE devel packages to successfully compile.

On Ubuntu 15.04 the following packages will pull all the necessary dependencies:

sudo apt-get install libkf5newstuff-dev libkf5notifications-dev libkf5notifyconfig-dev libkf5plotting-dev \
 extra-cmake-modules  kdoctools-dev libsm-dev libv4l-dev libav-tools cmake

Then build Kdenlive with the following options (in your build dir):

export LD_LIBRARY_PATH=$INSTALL_PREFIX/lib
export XDG_DATA_DIRS=$INSTALL_PREFIX/share:$XDG_DATA_DIRS:/usr/share
PKG_CONFIG_PATH=$INSTALL_PREFIX/lib/pkgconfig cmake .. -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX
make -j4 install

And test

$INSTALL_PREFIX/bin/kdenlive

Frameworks 5 packages are hard come by in current linux versions. Beta versions of Ubuntu/Kubuntu 15.04 are a safe bet for getting these packages. Consider installing a virtual Ubuntu/Kubuntu 15.04 for testing the frameworks branch.

A light virtualization option is using chroot, setting it up in a ubuntu/debian environment is as simple as:

sudo -s
apt-get install schroot debottstrap
debootstrap --arch amd64 vivid $CHROOTDIR http://us.archive.ubuntu.com/ubuntu/
cat << === >> /etc/schroot/chroot.d/vivid.conf
[vivid]
aliases=default
description=vivid
type=directory
profile=desktop
directory=$CHROOTDIR
users=$USER
===
schroot -c -p vivid