MLT2EDL script error fix

I do not think another XML as the target is necessarily any easier than another text format. FCPXML does have a DTD to make validating the result easier. Meanwhile, EDL has some documentation and Blender’s source code to make understanding it easier. Both FCPXML and EDL are popular interchange formats.

As for porting to another language, I think it is best to keep it as a high level language for other people to maintain. Qt apps such as Shotcut and Kdenlive make it possible to use Javascript to run a conversion, and there are npm modules (Javascript library) to make processing XML easy.

ok, I will have a look at the code an try to compile it by myself to see if I get some ideas.

If you are thinking about trying to compile the Shotcut code, beware! It is not easy. We use a long and complicated bash script to make nightly and release builds [1]. And on OS X, it also requires MacPorts to provide many dependencies outside the script. Trust me when I say, I do not think this is the road you want to go down for this task.

I suggest if you want to look into porting the MLT2EDL code to Javascript, you do that separately using node.js and npm modules. In essence, node.js is simply a command line interpreter. There is plenty of good information about getting, running, and using node.js. It is quite a joy to use. After that, I will accept the burden of integration into Shotcut.


Great to hear that you turn that MLT2EDL script into something useful for you. I’m not a python coder nor am I a coder in general, so that script is just a result of me tinkering with the kdenparse script(which I haven’t touched since).

EDL may at first seem like a simple format, however it’s original purpose of carrying information on a celluloid footage reel and a frame number and later a tape name and a time code, is that archaic, that various softwares using this format have added several alterations, which makes it prone to errors.

What makes it even more difficult to work with is that the reel names and time codes listed in the edl file are read from embedded metadata in the source files. So unless you source material is in a format which can’t carry reel name/time code - you can’t be sure that the first frame of a source clip is 00:00:00:00 - which means that you would have to transcode your source material into a codec which allows embedded time code (and Shotcut would have to read the embedded time codes and adjust the in/out point in the EDL according to the start value of the time code).

With the reel name it is even more important to embed it into the sourcefile metadata because there is no common naming convention, however the reel name is limited to 8 characters, no spaces and no file extension. The limited reel name often means that you would manually have to point to the folder where you source files are located or even pointing to the specific file mentioned in the EDL. As an alternative to using the reel name for indicating the file name FCP is using a line before the edl line. Like this: * FROM CLIP NAME: CLIP NAME HERE(can contain the full path). But other softwares use clip name specified in a comment line but saying * COMMENT: instead of * FROM CLIP NAME: Some softwares read that from the line before the time code line and other softwares use the line after the time code line. And yet other softwares doesn’t read this line at all(like the Blender edl import script), so you would have to add the file name information from the reel name tag. ( can transcode to ex. ProRes or DNxHD with embedded reel name and time code)

Another inconsistent value is the EditMode value written and read differently in different softwares. They can be written/read like this:
Blender: ‘V’ | ‘A’ | ‘VA’ | ‘B’ | ‘v’ | ‘a’ | ‘va’ | ‘b’ which equals Video, Audio, Video_Audio edits (note B or b can be used in place of VA or va).

Or Lightworks:
AA/V – Video and audio on channel 1 and 2
VA1A2 – Video and audio on channel 1 and 2
A12V – Video and audio on channel 1 and 2
AUD3 – Audio only on channel 3
A3 – Audio only on channel 3

Or this:
NONE, A, B, V, A2, A2\V, AA, AA\V

So some softwares writes/reads what tracks goes where and some don’t(Blender doesn’t). I believe that Lightworks limits export to an EDL with 2 or 4 audio tracks.

I’ve written a bit about my findings here:

(Btw. I don’t think that the EDL format can carry effect information - only a handful of various transitions).

The good thing about EDL is that it is widespread, and you can edit it by hand.

The newer alternative is aaf, which supports more options(maybe even effects).


Most of the pro NLEs out there support this format, and also most pro DAWs which means you can import this format into an audio editing software to edit your project natively in there. Unfortutately the author of Ardour hates the aaf format with passion:

I believe it is a huge undertaking to implement I/O of EDL or AAF, but maybe as a Google Summer of Code project it would be possible? Or maybe it would be better to implement it in MLT so all projects using MLT would be able to benefit from it?

So in other words at this time there is no perfect interchange format, which is kind of sad, since it would be really great if projects could be painless moved between ex. Shotcut, Blender, Natron, Resolve, OpenCine, OpenToonz and Ardour.

Thanks Dan for inviting me here!

I think we should avoid going to extremes in this area. Apparently, conversion to EDL is useful to some people even when assuming start timecode is 00:00:00:00. As for the reel name, one can use an 8 character hash. Shotcut already computes a hash (of the file contents) into its MLT XML. Use the first 8 characters from that hash. Sure, this is not best way to EDL, but it solves many people’s itch to simply repurpose a Shotcut sequence. Again, if someone ports MLT2EDL to Javascript, I will integrate it in a manner that makes it easy for someone to hack on it by simply installing Shotcut.

thanks tin2tin.
I am also sharing what I found out so far with Davinci Resolve and Shotcut.
A small tutorial I made. (510.0 KB)

1 Like

Nice tutorial. So you save a mlt file pr track, convert them individually, and import them in Resolve one by one? I believe I have imported more tracks in one go, but maybe I remember it wrong…

Dan, wouldn’t you prefer a qt sollution? And the reading of a mlt file, would’t be needed, right? Is there code included in shotcut to do math with time codes, like frames to TC?

Btw. There is a edl2aaf c++ code project here:
I’m unfamiliar with c++, but maybe this project would make it easier to get a head start with the edl format or even code a aaf exporter.

In connection to the above mentioned project there is a description of the edl cmx 3600 format edl2aaf can import:

Javascript is a Qt solution. The Shotcut timeline and filter panels make use of Javascript. If you look into the share/shotcut subdir of a Shotcut installation, you will find many .qml and .js files.

I am not really volunteering to doing a lot in this area. I cannot do everything, or at least I have many higher priorities. All I offer to do is to embrace this related project (MLT2EDL and kdenparse) by integrating and giving it a new home for ongoing maintenance. But I am cannot integrate a Python solution.

True, but someone making a standalone Javascript port of this script needs to read a file (or paste the XML into one big string in the script). When I integrate, the script will likely take on quite a different shape. Upon integration, the MLT XML will probably be supplied as a string. How exactly this integrates is not important at this time.

Yes, to convert between frames and timecode given a fps.

I’m sorry I do not have the time for learning java at this time, however I came across this project to convert the syntax from python to java:

Running mlt2edl through that thing the syntax looks like this, however the functions etc. are not converted:

OK, but Java and JavaScript are two very different things. I just took a look at the python script, and the core code (minus command line option processing and frames/timecode conversion) is only 300 lines. And I know Python well. So, I will give a crack myself.

I ported and integrated it as File > Export EDL…

Wow, that was quick! If you post an Shotcut saved EDL we can test it against Blender/Resolve/Avid if you like. Or is there a nightly build we can test?

Looking through your code, I realize that what you’ve done is a complete rewrite in only one day. That’s downright impressive!

I worry that not all softwares will be able to digest the “AA/V” setting. Maybe “b” will be more digestable for more softwares out there? Uwe, can you test if Resolve will accept “b” for video+audio?

Another thing I found out is that ex. Premiere Pro writes the comment line after the edit decisions concerning that clip, followed by an empty line:

001 DL02_024 AA/V C 00:00:00:19 00:00:04:19 00:00:00:00 00:00:04:00


002 DL02_002 AA/V C 00:00:10:16 00:00:23:14 00:00:04:00 00:00:16:23


The more I look around, the more it seems to be a common way to do it. The other way around was, I believe, for Blender import. So this way around is probably better.

Just for later reference I’ll add a few links here concerning EDL:
A free (Windows) EDL toolkit to check EDL files and spot differences:
FCP manual on EDL:
Really old EDL specifications:

Python script to parse and import EDL into Blender:

The old, scanned CMX3600 document is my baseline specification.
I am willing to add a submenu:
File > Export EDL > ToolA / ToolB…
File > Export EDL > ToolC…
File > Export EDL > Generic / CMX3600…

However, at the moment, I do not have enough information (in my head) to differentiate them. Definitely, “AA/V” seems wrong to me, and “B” more correct, and that is probably an area of difference. Also, which tools can accept a very long reel name? Do they accept an absolute file path? A quoted absolute file path? Which ones use the “FROM CLIP NAME” comment to resolve file links? Do they accept absolute file path?
A simple table based on those criteria will be a good start.

My sample. This uses the example video Wildlife.wmv that came with Windows 7, which you can get here:
Except, mine is .avi because I had converted it to MJPEG.
wildlife shots.mlt (10.0 KB)
test.edl (1006 Bytes)

Will have to investigate further. Here are a few edl’s found on the (1.2 KB)

As both Final Cut and Premiere has the comment line following the “time codes” line, this is probably the correct way to do it. One thing one must be very careful about when importing into Lightworks is that each column has the exact number of characters - which means that the reel name can contain spaces, however the Blender import script separates columns by locating the spaces. So that’s the reason for strict 8 characters for the reel name and only containing characters a-Z and 0-9. another thing to note is that “cleaning” your test.edl in EDLtoolkit AA/V gets translated to A12V. (A12V is not supported in Blender)

I’ve been trying to find an example with absolute paths, but unsuccessfully. This is one of the major shortcomings of this format. Maybe it was Sony Vegas, however their edl seems to be something completely different. This is the reason for the somewhat complicated import process Uwe mentioned in his Resolve write up. And same thing (but no media pool) when importing edl in Blender:


    • Open Blender.
    • File > User preferences > Addons > Categories > Import – Export > Import – Export Import EDL > Check it.
    • Click button > Save user settings (so that setting will be used each time you start Blender).
    • Close the user preferences window.
    • Change the combo box in the top bar saying Default to Video Editing.
    • To the right of the time line you’ll see EDL import (if not, maybe Blender needs a restart after enabling the addon?)
    • Click the open folder button under the offset line and select your edl file.
    • Click ‘Refresh Reels’.
    • Add paths to the missing reels using the open folder buttons.
    • When all is set click ‘Import video sequence (.edl)
    • The time line should now show your Shotcut project.
    • A+alt is play/pause.

Good news. Blender opens your EDL correctly(though one audio clip looks a bit too long):

Lwks doesn’t open it. I’ve tried to embed reel name and time code in the source files(which Lwks demands), but still without success. As I wrote earlier on Lwks is very picky on the exact number of spaces between columns. I managed to get something into Lightworks by adding the wildlife to the edl included in the zip above. (Lwks will import edl in the free version).

On the mlt project. I changed the absolute paths to relative paths and changed the file extension to mp4, but I haven’t succeeded to load the video into the project. (running SC 16.04.01)

Will have to look more closely on the complicated EDL Manager to try to import the edl to Avid.

[Edit: Resolve appears to import the edl fine, with and without embedded meta data]

I made some fixes and changes, and here is a new version of the generated EDL.
test.edl (1006 Bytes)

The code now has a way to pass options from the C++ Shotcut integration into the JavaScript; so, I can start to tailor it for different types of output as they become defined. Importing into Blender is nicer now around the dissolve now, especially if you set your global FPS to 29.97 before.

I gave the Lwks import another shot and found that if the channel column is one character wider - a total of 10 before the first timecode - it will import the EDL (source files have embedded filenames as reel name and embedded a time code of 00:00:00:00).

I checked an EDL with one character wider channel column in Blender and Resolve and both import it successfully. Maybe it is not needed to have different edls depending on what softwares the edls are exported to, after all.

(Since I haven’t seen your .mlt in Shotcut, is the dissolve from seals to seals(as in Blender) or a dissolve from seals to birds (as in Resolve/Lwks)? Is one of them using the wrong clip? Or is the a wrong fps in Blender(it might actually be that…))

Have you found any reason for the audio during the dissolve is too long in Blender? It might be a bug in the Blender import script?

Looking at Uwe’s tutorial, it might be a good option to export an edl file pr. track. Or hidden+muted tracks will not be exported, so one could manually export an edl pr. enabled track.