Kdenlive/Development/KF5: Difference between revisions
Line 366: | Line 366: | ||
git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg | git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg | ||
* | * configure the FFmpeg build with the "'''suffix'''" option. It means all FFmpeg programs/libraries will be renamed to use that suffix so that they do not mess up your system's official versions (in my exemple, the suffix is <em>mlt</em>, so ffplay will be called ffplaymlt). Choose the install prefix of your choice, but do not install in /usr. Here is a sample configure: | ||
./configure --prefix=/usr/local --progs-suffix=mlt --build-suffix=mlt --enable-shared --enable-libmp3lame \ | ./configure --prefix=/usr/local --progs-suffix=mlt --build-suffix=mlt --enable-shared --enable-libmp3lame \ | ||
--enable-gpl --enable-libfaac --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid \ | --enable-gpl --enable-libfaac --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid \ | ||
Line 373: | Line 373: | ||
--enable-libopencore-amrwb --enable-version3 --enable-libvpx | --enable-libopencore-amrwb --enable-version3 --enable-libvpx | ||
* compile the ffmpeg build | |||
<code> | |||
make -j4 | |||
</code> | |||
<ref>The -j4 parameter - this controls the number of parallel compilation jobs. -j4 is fine for a Core i3/i5, while it bores a Core i7 to death. On a Core i7 thus better use -j8 as it speeds up compilation a lot and makes use of all available real cores...</ref> | |||
* Install the build ffmpeg | |||
<code>install | |||
</code> | |||
* Next, recompile MLT to use this special FFmpeg version. Just add these 2 parameters to the MLT configure, where avformat-shared points to the install prefix of your custom FFmpeg, and avformat-suffix is the suffix used in previous step: | * Next, recompile MLT to use this special FFmpeg version. Just add these 2 parameters to the MLT configure, where avformat-shared points to the install prefix of your custom FFmpeg, and avformat-suffix is the suffix used in previous step: | ||
--avformat-shared=/usr/local --avformat-suffix=mlt | --avformat-shared=/usr/local --avformat-suffix=mlt |
Revision as of 21:12, 15 November 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 libepoxy-dev libeigen3-dev libfftw3-dev kdelibs5-plugins
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
Now obtain the source files for the melt project.
Get the latest release from https://github.com/mltframework/mlt/releases/latest. This shows the most recent release notes. Now scroll down to the end of the release note. You should see a minor section labelled "Downloads". This section contains two attachments; one for the zip sources, another for the tar.gz sources. Download one of them and unpack to some nice place in your file system. In this example the source was downloaded to ~/kdenlive/ creating a folder mlt-0.9.8
This page also has links to Melt releases http://www.mltframework.org/bin/view/MLT/ProjectNews
Decide where on the file system you want the compiled files to be installed. I choose /home/ttguy/development/kdenlive
Create shell variable for your choice by entering the following in the terminal
INSTALL_PREFIX=/your/path/of/choice
eg INSTALL_PREFIX=/home/ttguy/development/kdenlive
change directories to the melt source folder eg cd ~/kdenlive/mlt-0.9.8
Then configure, enabling all components, using target install dir specified by our INSTALL_PREFIX shell var, 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
Success will look something like:
$ ./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 Configuring framework: Configuring modules: Configuring modules/avformat: Configuring modules/core: Configuring modules/decklink: Configuring modules/feeds: Configuring modules/frei0r: Configuring modules/gtk2: - Libexif found, enabling auto rotate Configuring modules/jackrack: Configuring modules/kdenlive: Configuring modules/linsys: Configuring modules/lumas: Configuring modules/motion_est: Configuring modules/normalize: Configuring modules/oldfilm: Configuring modules/opengl: Configuring modules/plus: Configuring modules/plusgpl: Configuring modules/qt: - Libexif found, enabling auto rotate - Qt version 5.x detected - Include directory: /usr/include/x86_64-linux-gnu/qt5 - fftw found, enabling lightshow Configuring modules/resample: Configuring modules/rtaudio: Configuring modules/sdl: Configuring modules/sox: Configuring modules/swfdec: - swfdec not found: disabling Configuring modules/vid.stab: - vid.stab not found: disabling Configuring modules/videostab: Configuring modules/vmfx: Configuring modules/xine: Configuring modules/xml: Configuring mlt++: Configuring swig: GPLv3 license used
In the same melt source folder type:
make
success looks something like:
<snip> done make[1]: Leaving directory '/home/ttguy/kdenlive/mlt-0.9.8/src/swig' make[1]: Entering directory '/home/ttguy/kdenlive/mlt-0.9.8/profiles' make[1]: Nothing to be done for 'all'. make[1]: Leaving directory '/home/ttguy/kdenlive/mlt-0.9.8/profiles' $
In the same melt source folder type:
make install
success looks something like:
install -d "/home/ttguy/development/kdenlive2/bin" install -d "/home/ttguy/development/kdenlive2/include" <snip> install -d "/home/ttguy/development/kdenlive2/share/mlt/profiles" install -m 644 * "/home/ttguy/development/kdenlive2/share/mlt/profiles" rm -f "/home/ttguy/development/kdenlive2/share/mlt/profiles/"*~ rm -f "/home/ttguy/development/kdenlive2/share/mlt/profiles/Makefile" make[1]: Leaving directory '/home/ttguy/kdenlive/mlt-0.9.8/profiles' cp -R presets "/home/ttguy/development/kdenlive2/share/mlt"
Check that your compiled melt works:
cd $INSTALL_PREFIX/bin
melt myclip.mp4
Melt should play your test file in a video window.
You can check that your melt is linked to QT5 /KF5 libraries using the ldd command
ldd $INSTALL_PREFIX/lib/mlt/libmltqt.so
linux-vdso.so.1 => (0x00007ffcc0d4d000) libmlt.so.6 => /usr/lib/libmlt.so.6 (0x00007f797c7f4000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f797c5d6000) libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f797c29d000) libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007f797bd5a000) libQt5Gui.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5 (0x00007f797b80d000) libQt5Xml.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Xml.so.5 (0x00007f797ce05000) libQt5Svg.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Svg.so.5 (0x00007f797cdad000)
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
We are cloning the git repository for kdenlive into a local folder on your hard drive. This step will create a new kdenlive folder in the current directory. In this example I cloned into ~/kdenlive/kdenlive_git. Which creates ~/kdenlive/kdenlive_git/kdenlive
cd ~kdenlive mkdir kdenlive_git cd kdenlive_git git clone git://anongit.kde.org/kdenlive.git
Success looks like:
Cloning into 'kdenlive'... remote: Counting objects: 67026, done. remote: Compressing objects: 100% (12978/12978), done. remote: Total 67026 (delta 54842), reused 65893 (delta 53935) Receiving objects: 100% (67026/67026), 22.35 MiB | 582.00 KiB/s, done. Resolving deltas: 100% (54842/54842), done. Checking connectivity... done.
The master branch is the current development branch containing refactoring efforts.
Create a build directory inside the kdenlive directory that git created:
cd kdenlive;mkdir build;cd build
(working dir now /kdenlive/kdenlive_git/kdenlive/build in our eg )
Compile Kdenlive
(These instructions do not include a build of the vidstab package and thus your built kdenlive will be missing the stabilization feature)
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 qtdeclarative5-dev kde-runtime kinit kio
Then build Kdenlive with the following options (in your build dir) - (note the use of the INSTALL_PREFIX shell variable we created earlier in our melt build):
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
success for the above step looks like
-- The C compiler identification is GNU 4.9.2 -- The CXX compiler identification is GNU 4.9.2 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done <snip> -- The following RUNTIME packages have been found: * LibV4L2 , Collection of video4linux support libraries , <http://freecode.com/projects/libv4l> Required for better webcam support Required for better webcam support -- The following OPTIONAL packages have been found: * PkgConfig * Qt5Concurrent * Qt5Qml * Qt5Quick -- The following REQUIRED packages have been found: * ECM (required version >= 1.2.0) * Qt5Core * Qt5DBus <snip> * SharedMimeInfo , A database of common MIME types , <http://freedesktop.org/wiki/Software/shared-mime-info/> * OpenGL , the OpenGL library -- Configuring done -- Generating done -- Build files have been written to: /home/ttguy/kdenlive/kdenlive_git/kdenlive/build
make -j4 install
[1]
Success for the make step looks like:
<snip> Generating ui_scenecutdialog_ui.h Scanning dependencies of target kdenlive [ 35%] [ 35%] [ 36%] [ 36%] Building CXX object src/CMakeFiles/kdenlive.dir/kdenlivesettings.cpp.o Building CXX object src/CMakeFiles/kdenlive.dir/doc/doccommands.cpp.o Building CXX object src/CMakeFiles/kdenlive.dir/doc/documentchecker.cpp.o Building CXX object src/CMakeFiles/kdenlive.dir/doc/documentvalidator.cpp.o <snip> ^ Linking CXX executable kdenlive [100%] Built target kdenlive Install the project... -- Install configuration: "" -- Installing: /home/ttguy/development/kdenlive2/share/kdenlive/banner.png <snip> -- Installing: /home/ttguy/development/kdenlive2/share/doc/HTML/en/kdenlive/Kdenlive_Quickstart-Save-Project.png -- Installing: /home/ttguy/development/kdenlive2/share/doc/HTML/en/kdenlive/Kdenlive-Quickstart-Add-Transition.png -- Installing: /home/ttguy/development/kdenlive2/bin/kdenlive_render -- Set runtime path of "/home/ttguy/development/kdenlive2/bin/kdenlive_render" to "/home/ttguy/development/kdenlive2/lib/x86_64-linux-gnu" -- Installing: /home/ttguy/development/kdenlive2/share/config.kcfg/kdenlivesettings.kcfg -- Installing: /home/ttguy/development/kdenlive2/bin/kdenlive -- Set runtime path of "/home/ttguy/development/kdenlive2/bin/kdenlive" to "/home/ttguy/development/kdenlive2/lib/x86_64-linux-gnu:/home/ttguy/development/kdenlive2/lib" -- Installing: /home/ttguy/development/kdenlive2/lib/x86_64-linux-gnu/plugins/mltpreview.so -- Set runtime path of "/home/ttguy/development/kdenlive2/lib/x86_64-linux-gnu/plugins/mltpreview.so" to "/home/ttguy/development/kdenlive2/lib/x86_64-linux-gnu:/home/ttguy/development/kdenlive2/lib" -- Installing: /home/ttguy/development/kdenlive2/share/kservices5/mltpreview.desktop
Execute the Built Kdenlive
Test the built kdenlive by executing the kdenlive binary in the bin folder in your install path (again making use of the INSTALL_PREFIX shell variable we defined during the melt build)
$INSTALL_PREFIX/bin/kdenlive
The above command should start kdenlive. However, It is important to have especially the environment variable XDG_DATA_DIRS
correctly set to point to the share dir inside the Kdenlive installation directories. The given standard paths for XDG_DATA_DIRS
are typically /usr/share as well as /usr/local/share. So if you install Kdenlive to some other place, such as within your own home directory, make sure to add the path to your home-based share dir to XDG_DATA_DIRS
before attempting to start Kdenlive. Failing to do so causes Kdenlive to crash in unexpected situations, such as when trying to select a transition in the timeline.
Here's a nifty little script that sets up the environment variables automatically, then fires up Kdenlive; place this script next to your kdenlive executable (ie in $INSTALL_PREFIX/bin/). And don't forget to make it executable (chmod u+x kdenlive.sh).
#!/bin/bash SCRIPT_NAME=$(readlink -f "$0") SCRIPT_PATH=$(dirname "$SCRIPT_NAME") export INSTALL_PREFIX=$(dirname "$SCRIPT_PATH") export LD_LIBRARY_PATH=$INSTALL_PREFIX/lib export XDG_DATA_DIRS=$INSTALL_PREFIX/share:$XDG_DATA_DIRS:/usr/share echo "Environment set up for $INSTALL_PREFIX" $INSTALL_PREFIX/bin/kdenlive
If you want to be sure that you are executing the kdenlive you just built you might want to increase the version number of the build. This can be done by editing src/kdenlive/CMakeLists.txt
Older Linux Distributions
Frameworks 5 packages are hard come by in slightly old linux versions. 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 debootstrap 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 vivid -p
after running the above you will get a prompt like
(vivid)root@pcname:
You can then follow the install instructions above for melt and kdenlive. Note that many of the required packages are in the "Universe" repository - which is not enabled by default on the chroot setup. So you will need to add that repository to the package manager (edit your chroots /etc/apt/sources.list ) in order to be able to find the required packages. Don't forget the apt-get update afterwards.
If, when you test melt, it complains
./melt: error while loading shared libraries: libmlt.so.6: cannot open shared object file: No such file or directory
Then try setting shell variables LD_LIBRARY_PATH and XDG_DATA_DIRS
export LD_LIBRARY_PATH=$INSTALL_PREFIX/lib export XDG_DATA_DIRS=$INSTALL_PREFIX/share:$XDG_DATA_DIRS:/usr/share
Installing a recent git version of FFmpeg for Kdenlive (optional)
The LibAV/FFmpeg libraries that do all the encoding/decoding stuff are evolving quickly, but distributions do not always provide a recent version of these libraries. If you want to benefit from the latest features / fixes from these libraries, here is a quick howto on installing a recent FFmpeg version for MLT/Kdenlive without touching your system's LibAV/FFmpeg official version. This howto provides details for FFmpeg, but can probably be easily adapted for LibAV if you have a preference.
- Get required libraries:
sudo apt-get install libfaac-dev libgsm1-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libschroedinger-dev libtheora-dev libvorbis-dev libvpx-dev libx264-dev libx265-dev libxvidcore-dev libdc1394-22-dev
- Get the latest FFmpeg sources:
git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
- configure the FFmpeg build with the "suffix" option. It means all FFmpeg programs/libraries will be renamed to use that suffix so that they do not mess up your system's official versions (in my exemple, the suffix is mlt, so ffplay will be called ffplaymlt). Choose the install prefix of your choice, but do not install in /usr. Here is a sample configure:
./configure --prefix=/usr/local --progs-suffix=mlt --build-suffix=mlt --enable-shared --enable-libmp3lame \ --enable-gpl --enable-libfaac --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid \ --enable-x11grab --enable-libgsm --enable-libx264 --enable-libtheora --enable-libdc1394 --enable-nonfree \ --disable-stripping --enable-avfilter --enable-libschroedinger --enable-libopencore-amrnb \ --enable-libopencore-amrwb --enable-version3 --enable-libvpx
- compile the ffmpeg build
make -j4
[2]
- Install the build ffmpeg
install
- Next, recompile MLT to use this special FFmpeg version. Just add these 2 parameters to the MLT configure, where avformat-shared points to the install prefix of your custom FFmpeg, and avformat-suffix is the suffix used in previous step:
--avformat-shared=/usr/local --avformat-suffix=mlt
- Recompile Kdenlive and in the Kdenlive settings dialog, under environment, make sure to edit the FFmpeg and FFplay paths to your newly compiled versions (in my example it will be /usr/local/ffmpegmlt and /usr/local/ffplaymlt)
Footnotes
- ↑ The -j4 parameter - this controls the number of parallel compilation jobs. -j4 is fine for a Core i3/i5, while it bores a Core i7 to death. On a Core i7 thus better use -j8 as it speeds up compilation a lot and makes use of all available real cores...
- ↑ The -j4 parameter - this controls the number of parallel compilation jobs. -j4 is fine for a Core i3/i5, while it bores a Core i7 to death. On a Core i7 thus better use -j8 as it speeds up compilation a lot and makes use of all available real cores...