2016-07-22

Inside Kdenlive Projects: The Analyzer

Out of (sheer) curiosity I started developing a Kdenlive project analyzer as a pet project. A nice side effect of snooping around inside the XML of Kdenlive projects turned up bugs concerning the automatic audio mixing and automatic compositing of video. So what's this analyzer thing...?

Online Analyzer


You may try the online Kdenlive Project Analyzer.

Don't worry, the Doctor gets loaded into your browser. Then you simply select your Kdenlive project file to analyze from the Doctor's form. All will be kept strictly in your web browser. Project files won't ever get uploaded to any web server!

The Doctor works now in Chromium/Chrome, Firefox, and some other webbrowsers with decent Javascript support too.

The Doctor's In

 
Well, my Kdenlive Project Analyzer (find it on GitHub) is some kind of simple Kdenlive project doctor. However, it has only limited diagnosis capabilities (like some real leeches) and it won't cure your ill Kdenlive projects (as some leeches won't either). As its name suggests, it just analyzes a Kdenlive .kdenlive project file and sheds light on some of its contents.

It gives some general project information, such as project ID, document version, Kdenlive version, et cetera.

General Kdenlive project information.

These are your project bin contents, neatly sorted into folders as in Kdenlive's project bin:

Project bin content.

Now comes the timeline track configuration, with track title and properties, such as muted, hidden, locked, track, length, and so on.

Project timeline configuration.

But there are things going on behind the scenes, so our doctor also looks at these hidden things. First come the video compositing transitions: which ones are there and between which tracks, neatly presented. Including strange things which shouldn't be there...

This project has some timeline compositing issues.

Also check the hidden audio mixing transitions: which ones and between which tracks, again, neatly presented.

Timeline audio mixing, unfortunately with an issue.

And then there's the master clip list, for your reference. Sorted by clip, not by folder.

Master clip list (bin clips, flat).

The Doctor's ... Totally Crazy


Inside, the Kdenlive Project Analyzer is a simple HTML5 form with a totally crazy XSLT stylesheet. The latter analyzes the project file you've selected in the form and generates a report. I never thought that I would every write an analyzer in XSLT, that is, in a functional, bracket-ridden language. A case of urgent brackitis, me thinks...

The analyzer XSLT stylesheet now requires an XSLT 2.0 conforming XSLT processor. As there is basically no native support for XSLT 2.0 or even XSLT 1.0 with some necessary extensions, I finally settled on Saxon-CE, which is a pure JavaScript XSLT 2.0-conforming engine. Speed is fine especially on Chromium, albeit the native XSLT 1.0 engine of Firefox is still faster. However, I can perfectly live with an acceptable performance penalty at the price of supporting more browser engines and getting much more informative XSLT error messages.

Understanding Kdenlive Projects


In case you are curious too as to what's inside Kdenlive XML project files, please head over to the Inside Kdenlive Projects blog post, which is the first of a series of upcoming posts about Kdenlive project internals. Happy analyzing, Dr Jung!