Export all markers

I want to export all markers in a project.
Would you recommend that I implement it as:

a) adapt MultiFileExportDialog to handle markers
b) create a variant of MultiFileExportDialog specific for markers
c) copy all markers into playlist

My current workflow is to mark all ranges I want to export. Then I step through every marker range using hotkeys:

S,              (split at start) 
>,              (go to range end marker)
S,              (split at end) 
<,              (go to range start marker)
Ctrl+Space,     (select clip under playhead)
Ctrl+C,         (copy clip)
Ctrl+Z, Ctrl+Z, (undo splitting)
Shift-A,        (insert into playlist) 
>, >            (go to next range)

I could record this using AutoHotkey, but it becomes messy when 2 marker ranges overlap.

I would also like to use marker names as export file names. This is currently not possible, even for single marker exports.
Therefore, I would like to implement a solution into Shotcut.

a) MultiFileExportDialog takes an argument Mlt::Playlist *playlist; that could be refactored.
b) Or, if Mlt::Playlist and the marker struct do not share a common superinterface, an export dialog specific for markers could be built.
c) Or, a function for transferring all markers into the playlist, setting their names as clip names, could be built. A button for this could be put into the marker dock.

Which approach do you recommend?

Related requests:

(I noticed the Shotcut - Road Map has entry “clip markers or flags”, though that seems done already.)

Sounds like a fun feature.

I do not think the dialog should know about markers. But you might have to adapt the interface to work for both. Maybe you could create a playlist from the marker segments and pass that in. For each entry in the generated playlist, set the name to the marker name so that the existing “Name” field in the dialog would work with marker names.

Creating an ad-hoc implicit playlist struct from markers, you mean? That could be an alternative to copying the marker into the playlist dock, i.e. (c).

The playlist dock has no business knowing anything about markers.

Off the cuff, here is a suggested starting place:

  1. Add a function to the timelineDock called getPlaylistFromMarkers()
  2. In that function, create a temporary playlist, loop through each marker and add an entry to the playlist for each marker. Be sure to set the in, out and name on each entry
  3. Call that function from the export dock as appropriate.

Seems straight-forward.
Can you tell me where the title of a playlist item shall be stored?

I guess it may be in producer, a concept which I don’t understand yet.
Assuming so, does every playlist item need its own producer, or should MAIN.multitrack() be the producer for all playlist items derived from a marker?

There is a caption that is shown at the top of the properties panel and in the “clip” column of the playlist. It is stored on the producer using the shotcut:caption property. This is the property that is used for the “name” field of the MultiFileExportDialog

Yes. Each entry in the temporary playlist will be a producer that is “cut” from MAIN.multitrack(). You make a cut by specifying the in/out points from the original producer. The in/out points are the stop/end properties from the marker.

Thanks for the pointers.
I’ve come across in util.cpp:
void Util::applyCustomProperties(Mlt::Producer &destination, Mlt::Producer &source, int in, int out)
I have no idea what it does.

Should I call that method to after I’ve cut a producer using Producer *Producer::cut(int in, int out) ?

No. The only producer you will be cutting is the multitrack producer. None of those properties apply to it.