Markers like label track in Audacity

Ok.

Thanks for this helpful new feature in this terrific software.

Audacity has the capacity to import labels from a csv, and then export individual mp3s based on the label. I use this very frequently, for example to get mp3s of individual songs from a two-hour practice session that is recorded as a single file. I would like to be able to do something similar in Shotcut.

Is this an available or planned feature for markers in Shotcut?

I want to note the marker in and out times in an external file, import them, and then export each marked clip. As of now, it looks like the only way I can do this is to set a marker range for the clip I want, and then export from that named marker, rather than having a batch process that would export all marked ranges.

Thanks in advance

Richard Males
Cincinnati, Ohio USA

1 Like

Not available, and not currently planned. But something could be implemented if there is enough demand.

I am not sure why this workflow would have to use markers. If you have a file that lists in/out points, it could just be implemented as a batch export feature. Or maybe there is some reason it would need to use the markers?

Thanks for the rapid response. Although I have used shotcut very happily previously, I don’t have experience with the particular issue I am trying to solve.

No, I do not specifically need markers, it just appeared to be a helpful way of getting at things. I was not aware of the batch export feature, looked at it and it will absolutely do the job.

The question I have - you mention that ‘if you have a file that lists in/out points’. Where/how do I import that file and what format is needed? I did a search but couldn’t find anything.

My intended workflow is to view the video and externally mark the individual clip start and end times. I would then import these times, do whatever process is needed to get these as separate clips, and check that I have all the clips identified as I wish. I could certainly develop the clips directly in shotcut, and then use procedures as outlined in

but I would like a repeatable batch process to fine tune as I need. I am not wedded to any particular approach, so if you have something else to suggest, I will pursue it.

See Export > From = Each Playlist Item. That implies using the Playlist instead of Timeline. However, the export file name is not very controllable. Basically, you give it a name, and Shotcut adds a number into it, and they all get named the same but with a number. You can rename them afterwards. Now, let’s say you want to automate or like import something. The way to do that is XML - MLT XML specifically, which is Shotcut’s project file format. The easiest way to get going is by example. Open Shotcut, set your Video Mode, add some files to the playlist, save, look at the project file in a text editor, and study it. Maybe you can use a tool to craft it. Or, maybe you can make some templates where you find and replace with your data. Alternatively, if you want to go deeper, you can use the melt command line, and there are docs for the XML, and even the API and scripting languages here:
https://www.mltframework.org/docs/

Thanks for the suggestion, getting there but not there yet.

I created a Python program that reads an Excel file of start/end points and range labels, it creates xml in the format needed for the markers portion of the xlt to create named marker ranges. I cut and paste that into my mlt, all the markers now appear. Each is listed individually on the export from timeline. I was expecting the export to use the marker name, it does not do so, just uses the mlt filename prefix.
So:

  1. suggestions as to easiest way to get my exports with the least manual work, now that I have every range marked and labeled? Now that I have everything labeled, I could manually fairly easily create a clip for each range, get it into the playlist, but as I have 50 ranges, still a fair amount of work.

  2. way to get the export to use the marker name if I have to manually export each marker range from the export from range ?

Thanks, happy to share my hacked together code and spreadsheet if anyone is interested (first time working with xml)

If you can do all that you can just write a script to export whatever you want from a project and renders to a file name of your own choosing without involving the Shotuct UI. It would simply call the melt executable from the Shotcut install (same as Shotcut does, see its log). You simply need to learn more about putting encoding options on the command line instead of into XML as Shotcut does. Even the export from each playlist item does not let you control the full name. Maybe eventually we will have some more file naming options, but it is very low priority. Yet another solution is to rename the files after exporting.

Thanks. I spent some time looking into melt, the command line options, and what shows up in the temporary mlt (whuch, on my Windows 10 machine, disappears as soon as I close shotcut). In the end, building a batch file with all the required information looks to be too much effort for now. Using the export marker in the UI for each individual marker range and naming the file to be consistent with the marker name, even though it is a manual process, solves my problem for now. I will look further into the melt command line options at some future time. I am quite happy with the process I developed to import marker ranges, which ultimately simplified the effort sufficient for my needs.

I did see that the in and out points are in frames where I have been using the time code. I did not find a direct transformation from the time code to the frame number, it did not seem to work exactly assuming 25 fps, as compared with what I see in the shotcut log for the in and out points for the marker range.

So the net of it all is that I have learned a good deal about shotcut, built a useful tool, and have a procedure in place the next time I need to do something similar. I appreciate all the help.

quick hint:
/path/to/melt /path/to/project.mlt in=<start> out=<end> -consumer avformat:/path/to/output.mp4
followed by additional encoding options as space-delimited name=value pairs at the end of the command line. You can get these options by exporting something in Shotcut, right-click the export job, view the XML, and look at the <consumer line near the top.

Thank you, that is a very useful example, much appreciated.

IMPORTANT: it appears that exporting a marker uses the next marker range. That is, if I have Marker1 and Marker2 in my export marker list and select Marker1, it exports the range associated with Marker2. I have checked this a couple of times and have verified that the label and range for each marker on the timeline are correct. Is this a known problem? This would, I think, explain the problem I was having in verifying the in and out frame numbers to the timecodes.

Yes in a bug report you can find here and fixed for next version.

ok, thanks to your help I am getting very close.

When I execute the following command line, I consistently get the messages below, but get the desired output file. Running a bunch of these in a single batch file (changing the in and out and the target only) seems to hang after processing a few files.

What should I do to avoid the error messages, or are they not really an issue?

C:\Projects\CSDP\TrainingVideo>“C:\Program Files\Shotcut\melt” “C:\Projects\CSDP\TrainingVideo\tv1\tv1working4.mlt” in=85359 out=91415 -consumer avformat:“C:\Projects\CSDP\TrainingVideo\Exports3\RoleOfCurrentRoundOfProjects2.mp4” vcodec=“libx264” preset=“fast” channels=“2” mlt_service=“avformat” f=“mp4” threads=“0”
±----+ ±----+ ±----+ ±----+ ±----+ ±----+ ±----+ ±----+ ±----+
|1=-10| |2= -5| |3= -2| |4= -1| |5= 0| |6= 1| |7= 2| |8= 5| |9= 10|
±----+ ±----+ ±----+ ±----+ ±----+ ±----+ ±----+ ±----+ ±----+
±--------------------------------------------------------------------+
| H = back 1 minute, L = forward 1 minute |
| h = previous frame, l = next frame |
| g = start of clip, j = next clip, k = previous clip |
| 0 = restart, q = quit, space = play |
±--------------------------------------------------------------------+
[mp4 @ 000002a6c8ae2800] Timestamps are unset in a packet for stream 1. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[mp4 @ 000002a6c8ae2800] Encoder did not produce proper pts, making some up.
[mp4 @ 000002a6c8ae2800] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 11628544 >= 11628544

Learn, try, experiment please

Thank you. I absolutely understand the culture of forums, I only turn to the forum when I can’t find an answer online or in documentation, and I only ask a question after exploration. I am not trying to get anybody to do my homework for me. Your quick hint in a previous response was very helpful to me and I spent a good deal of time researching and experimenting with the command line options once you sent me in a direction with that hint.

I have tried a number of different options, everything I tried gave the same error. The messages are not clear to me, I don’t think they come directly from melt.

In any case, I will proceed as you suggest, so thank you for your prior help and the excellent Shotcut program.

They are probably not a problem. As an experiment, you can make a similar export in Shotcut and then right click the export job to see the log. You might see the same messages. As long as the operation creates an output file and the file works for you then the messages are not a problem.

Docs are here
https://mltframework.org/docs/

There are command line options to reduce messages including -silent and the recently added -quiet show in melt -h usage output.

Thank you, I appreciate your suggestion. I checked the export log, the same error appears,

This was very helpful. Thanks to you and Brian, the batch file using melt ran to completion, slicing up the original 3.5 hour video into 48 labeled mp4s. I very much appreciate the assistance you have provided.

To recap for those who might be interested:

  1. I developed a Python script to read the start and end times (hh:mm:ss:frame count) for the clips of the source videos and create a text file of xml for markers in the mlt format
  2. I then manually pasted that xml into the appropriate section of the mlt file for the project
  3. This generated appropriately labeled markers at each in/out point
  4. I attempted to individually export the markers from the UI, but this required re-entering the names and also encountered the ‘off by one’ issue that will be fixed in the next release.
  5. Based on suggestions here, I developed a batch file for each clip using melt. This required converting the start and end times to in and out points (measured in frames), I did that in Excel.
  6. Here is an example of a couple of lines from the final batch file that runs to completion:

“C:\Program Files\Shotcut\melt” “C:\Projects\CSDP\TrainingVideo\tv1\tv1working4.mlt” -quiet in=0 out=7164 -consumer avformat:“C:\Projects\CSDP\TrainingVideo\Exports5\Intro.mp4” vcodec=“libx264” preset=“fast” rescale=“bilinear” g=“125” bf=“3” ab=“384k” acodec=“aac” channels=“2” mlt_service=“avformat” ar=“48000” top_field_first=“2” deinterlace_method=“yadif” movflags="+faststart" real_time="-1" crf=“23” f=“mp4” threads=“0”

“C:\Program Files\Shotcut\melt” “C:\Projects\CSDP\TrainingVideo\tv1\tv1working4.mlt” -quiet in=18775 out=24609 -consumer avformat:“C:\Projects\CSDP\TrainingVideo\Exports5\BackgroundAndVision.mp4” vcodec=“libx264” preset=“fast” rescale=“bilinear” g=“125” bf=“3” ab=“384k” acodec=“aac” channels=“2” mlt_service=“avformat” ar=“48000” top_field_first=“2” deinterlace_method=“yadif” movflags="+faststart" real_time="-1" crf=“23” f=“mp4” threads=“0”

  1. I do feel that a batch export of marker clips that preserves the marker name in the exported file name wouldt be a useful enhancement for the future.

Would the two suggestions I made in my thread for markers overlap with your suggestion here?

Yes, that would exactly do it, states it better, I should have referenced that.

I should also have noted above that in the procedure I used in the end, markers are not needed, basically you go from the Excel timing file to the melt batch file after converting timestamps to frames, but it is still nice to have the markers in Shotcut for general navigation.