MLT2EDL script error fix

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.

The CMX doc has 2 padding spaces after this field. I had one; will fix it. Next time, upload a revised version of the EDL so I can see exactly what you are trying to say.

The dissolve is from seals to birds. In Blender, you have to set the correct fps before importing.

That is not happening for this first version. Reminds me though that we should use a different channels code for muted video tracks.

Cool. It’s ready for prime time. :wink:

Oh, btw that “playlist” line, though it might be useful visually to separate the tracks in the edl, I’m not sure that it is supported in the edl format(It was a leftover from the kdenliveparser script). There are TITLE: and FCM: options for header info, but the edl imports fine without those, so there is proberly no need to bother.

Really great with the EDL export. Now users can grade in Resolve and edit sound in Ardour. Thank you!

Maybe Uwe can update the tutorial to be shared with the users? Btw. instead of manually splitting the text file into separate track files, I guess Uwe can hide/mute all tracks except one track at a time to get a file for each individual track.

For whatever it is worth I came across a node.js/javascript project which parses edl to csv format: https://github.com/dsaint/edl
Here’s the EDL CMX 3600 parsing: https://github.com/dsaint/edl/blob/master/lib/parsers/cmx3600.js
(Looks like they’re missing the edit type style and duration with ex. dissolves).

If at some point EDL import is considered something useful to implement, then this parsing script and the new Shotcut feature of locating missing files in loaded projects, might come in very handy?

Thank you Guys! Amazing Job. This is really a breakthrough in workflows. I used the slides in my class to teach Shotcut to my students. I will update it as soon as I can.

1 Like

I’m trying to help the coder of Flowblade out implementing edl export. He has based his code on mlt2edl and on your code. He has spotted a difference in the duration of an exported edited strib and an edl - this problem happens in both Flowblade and Shotcut export. I’ve tested in both Blender and in Lightworks and the edl is shorter than the exported strip, so I’m afraid that there might be a bug in the mlt2edl code:

Btw. the frame rate is set to the same in Blender as in Shotcut.

OK, great. Now all we need is someone to fix it and share it.

I’ve been investigating this problem of missing frames in edl exports.

The following two edls are the same video file split, at the same frames and exported as edl. (The first two time codes are player time codes and the next two are recorder time codes.)

Notice that Resolve reuses the same frame “21” in the player time codes, where as SC/FB adds one frame pr. cut.

Resolve:

001  001      V     C        00:00:00:00 00:00:15:21 00:00:00:00 00:00:15:21  
002  001      V     C        00:00:15:21 00:01:15:21 00:00:15:21 00:01:15:21  
003  001      V     C        00:01:15:21 00:01:29:01 00:01:15:21 00:01:29:01  

Shotcut/Flowblade:

001  shotcut_ AA/V  C        00:00:00:00 00:00:15:20 00:00:00:00 00:00:15:20
002  shotcut_ AA/V  C        00:00:15:21 00:01:15:21 00:00:15:20 00:01:15:20
003  shotcut_ AA/V  C        00:01:15:22 00:01:29:01 00:01:15:20 00:01:28:23

In Shotcut UI the cut is at 00:00:15:21, but exported in the edl as 00:00:15:20.
In Shotcut UI the cut is at 00:01:15:22, but exported in the edl as 00:01:15:20.

So it seems like a frame is missing pr. cut - which is also what I count when importing an sc edl in Blender and compare it to a sc rendered file.

Another Shotcut related thing I noticed was that if you split exactly between to cuts, then the thumbnail of the 2. clip will not be the first frame of the new clip, but the last frame of the last clip, so the thumbnail might be one frame to early?

In MLT, the out point is the time at beginning of the last frame - not the time at the end of it. In terms of frame numbers (and the last field of timecode), MLT’s out point is the frame number of the last frame such that duration = out - in + 1.

So, it appears we may need to add one for the out time. If so, what I do not understand is how a single frame edit as shown in your event 002 can have the same times for both in and out? Or, is that the same frame as the last frame of the previous edit? That would be like a null cut. It is hard to understand your intent from this especially when I do not have the MLT XML to go with it.

I used a clip the coder of Flowblade uploaded: https://www.dropbox.com/s/8kke9xkdcuerzei/shotcut_24_full.mp4?dl=0

And I just made splits at the visible cut points.

Here’s a link to the Flowblade thread which may contain more info: https://github.com/jliljebl/flowblade/issues/252

The 002 event is a 1:00:00 long clip. That’s why sec & frames are the same.

Maybe the best way to find out what is happening is to make a clip with continued time code running in the image, export it, start a new session, import that clip, do some split cuts in it and save an mlt XML and an edl.

New session, open the mlt XML and check for missing frames in the video. Open the edl i Blender and also there check for missing frames in the video.

If there are missing or double frames in the cuts they should visible in time code running in the image.

I added a time code in picture to a 1 minute long clip and exported it from Shotcut.

Then I imported the file into Shotcut.
And made split cuts at 15:15 16:16 17:17 and 18:18

Then I exported that file(OneMinuteTC.mlt) and there was not missing frames at the cuts. See FromShotcut.mp4

Then I exported an edl. OneMinuteTC.edl.

I imported the edl and the SC exported clip in Blender.
And one or two frames where missing before the cut. See FromBlender.avi

Then I imported the same clip and the edl in Davinci Resolve.
And one frame is missing before each cut. See FromResolve.mov

Then I corrected the edl so the video runs continuously. OneMinuteTC_corrected (Resolve).edl

I then imported that edl in Blender and it shows that Blender doubles the frame at the cut. Two times frame 14.

So Davinci is not importing the edl the same way as Blender is importing it…

Files (13.3 MB total)
OneMinuteTC.zip
Will be deleted on
13 September, 2016
Download link
https://we.tl/IKFZ1dDDMq

Just checked with Lightworks edl import and it behaves like Davinci: One frame is missing before the cut.

So the conclusion is that there is some rounding issue with Blender, so occasionally two frames are missing, but Davinci and Lwks are in line when importing an Shotcut EDL: one frame is missing just before each cut.

I wish I did not have to analyze your files and retrace your steps. Why combine OneMinuteTC.edl with FromShotcut.mp4 instead of the source file? Why change “AA/V” to “V” and remove the FROM CLIP NAME lines? Is there really hope for EDL interoperability to bother working on this?

I see you changed the in point of edit 002 from 00:00:15:15 to 00:00:15:14 and then edit 003 from 00:00:16:16 to 00:00:16:14 (-2) and so on accumulating a drift. That is a non-sensible fix; the in points of the source (first timecode column) must remain the same. You even said it yourself:

made split cuts at 15:15 16:16 17:17 and 18:18

Need to find a fix that involves adjusting out points if there is one. I am not going to add something silly into the code that subtracts n-1 from the in point. However, a difference in handling out points is understandable: timecode of last frame or timecode after last frame has played or recorded? Unfortunately, I do not have much experience with Lightworks or Davinci - don’t even have them installed. So, this is going to wait if I have to do it.

I wish I did not have to analyze your files and retrace your steps. Why combine OneMinuteTC.edl with FromShotcut.mp4 instead of the source file? Why change “AA/V” to “V” and remove the FROM CLIP NAME lines? Is there really hope for EDL interoperability to bother working on this?

I’m sorry if I make things more complicated than they are. The FromShotcut.mp4 was error free, so I used that instead of the source - which I probably shouldn’t have, though there’s no visual difference. OneMinutteTC_corrected (Resolve).edl is exported from Resolve. The other edl file is from SC. The missing stuff from the Resolve edl is properly because I used embedded reel name in the source file and didn’t have any audio tracks.

I see you changed the in point of edit 002 from 00:00:15:15 to 00:00:15:14 and then edit 003 from 00:00:16:16 to 00:00:16:14 (-2) and so on accumulating a drift. That is a non-sensible fix; the in points of the source (first timecode column) must remain the same.

This way no frames were missing in Resolve(non visible split cuts). It’s puzzling why the edl needs to add the same frame twice in both player and recorder timecode, but if I ex. move recorder in point one frame, one frame will be missing. I guess it all comes down to this question?

However, a difference in handling out points is understandable: timecode of last frame or timecode after last frame has played or recorded?

Maybe trying the opposite of what MLT expects or maybe the answer is in those old edl docs. I’ll take a look when I get a moment. The coder of Flowblade might come up with a solution.

The coder of Flowblade came up with a solution to the EDL problem. Now it imports correctly in Lwks and Davinci(but not Blender - it has bugs in the import script): https://github.com/jliljebl/flowblade/issues/252

OK, the problem was exactly as I suspected: a difference in the out frame timecode. I fixed this in git for next release and tested it with Resolve.

I noticed a small bug when using file names with less that 8 characters:

001 10_sec_m AA/V C 00:00:00:00 00:00:01:00 00:00:00:00 00:00:01:00

  • FROM CLIP NAME: 10_sec.mov
    002 10_sec_m AA/V C 00:00:01:00 00:00:02:00 00:00:01:00 00:00:02:00
  • FROM CLIP NAME: 10_sec.mov

The reel name column is correctly 8 characters wide: “10_sec_m”
However the extension should not be used in that line. So instead it should be: "10_sec "(2 spaces)

Another thing. I mentioned above that there is a way to add the full file path to the EDL. It is mentioned here: UM:Edl Import And Conform - DigitalVision

Like this:

TITLE: comptest

001 tape-1 V C 05:04:46:13 05:04:56:03 01:03:16:04 01:03:25:19

  • FROM FILE: S:\media\images\mazda-2k\OE5012A\438877.dpx

I would suggest that CLIP NAME and FROM FILE was used like this:

TITLE: comptest

001 438877 V C 05:04:46:13 05:04:56:03 01:03:16:04 01:03:25:19

  • FROM CLIP NAME: 438877.dpx
  • FROM FILE: S:\media\images\mazda-2k\OE5012A\438877.dpx

The reason for using all 3 ways of specifying the file is that not all softwares support all of them. Only very few will support the last one, though that will be the most hassle free of them.

(NB. posting here subtracts spaces from the columns)

Hi team,

I wonder why I get an empty EDL export. Could you please give me a hint?

The background is about my need to move from Shotcut to DaVinci as Shotcut is unfortunately not stable on my brand new Ubuntu 20.4 system setup. Also I am using the current version of Shotcut provided by flathub, have enough ram, a recent CPU and GPU.

The EDL export message is:
[Error ] <MainWindow::on_actionExportEDL_triggered> Uncaught exception at line 6981 : “TypeError: Cannot read property ‘0’ of undefined”
Maybe caused by a wrong declared array as argument of a function, as said right here: https://stackoverflow.com/questions/29431225/javascript-uncaught-typeerror-cannot-read-property-0-of-undefined

I attach the mlt file: Uploading: 2020-07-20T14 Mit Buddha im Tank.mlt….

Thank you so much for your help
York

This will probably not work as you expect. It does not keep any filters and only exports one track: the one indicated as current when you export. It might also have accuracy problems with 29.97 or 59.94 fps. Also, your mlt file did not upload and therefore not downloadable.