Copy link to clipboard
Copied
Hello,
I really need some help.
I have this code below which sends all the markers to media encoder.
The code below allows me to ignore everything except for comment markers.
current_marker !== undefined && current_marker.type == "Comment";
the problem is I need to read the time location of chapter markers.
so I was wondering someone could help me to modify the code. Instead of only looking for comic markers. How about processing the markers if they get in and get out is more than one second.
The chapter marker will only be a marker with no get in and get out.
if there is a better way please let me know
var mySeq = app.project.activeSequence;
if (mySeq) {
var markers = mySeq.markers;
if (markers) {
var numMarkers = markers.numMarkers;
if (numMarkers > 0) {
var marker_index = 1;
var count = 0;
for(var current_marker = markers.getFirstMarker();
current_marker !== undefined && current_marker.type == "Comment";
current_marker = markers.getNextMarker(current_marker)){
count++;
var selectIn = current_marker.start.seconds;
mySeq.setInPoint(selectIn);
var getIn = mySeq.getInPoint();
//$.writeln("In: "+marker_index+" -> "+getIn);
var selectOut = current_marker.end.seconds;
mySeq.setOutPoint(selectOut);
var getOut = mySeq.getOutPoint();
Copy link to clipboard
Copied
if ((current_marker.end.seconds - current_marker.start.seconds) > 1.0){
...
}
Copy link to clipboard
Copied
first of all thank you very much for your quick reply.
I have tried to implement what you wrote above but I am not quite sure if I have done it correctly.
I have put the entire block of code below.
And I have also included a screenshot of the markers.
if ((current_marker.end.seconds - current_marker.start.seconds) > 1.0){
var encode1 = startQ;
var mySeq = app.project.activeSequence;
if (mySeq) {
var markers = mySeq.markers;
if (markers) {
var numMarkers = markers.numMarkers;
if (numMarkers > 0) {
var marker_index = 1;
var count = 0;
for(var current_marker = markers.getFirstMarker();
current_marker !== undefined && current_marker.type == "Comment";
current_marker = markers.getNextMarker(current_marker)){
count++;
var selectIn = current_marker.start.seconds;
mySeq.setInPoint(selectIn);
var getIn = mySeq.getInPoint();
//$.writeln("In: "+marker_index+" -> "+getIn);
var selectOut = current_marker.end.seconds;
mySeq.setOutPoint(selectOut);
var getOut = mySeq.getOutPoint();
//var marker_Colour = current_marker.getColorByIndex(index);
var marker_Type = current_marker.type;
var marker_Name = current_marker.name;
var marker_Comments = current_marker.comments;
// Creates a text file with all the comments (keywords) or the video
logInfo((new Date).toString());
function logInfo(Txt){
//var file = new File(Folder.desktop + "/" +marker_Name+".txt");
var file = new File(path1+sep1+"VID"+sequenceName+"MID"+count+"__"+marker_Name+".txt");
//file.open("e", "TEXT", "????"); adds to text file
//file.seek(0,2); adds to text file
file.open("w");
file.writeln(marker_Comments);
file.close();
//alert(file);
alert('Info \n \n' + marker_Type + '\n' + sequenceName + '\n selectIn: ' + selectIn + '\n selectOut: ' + selectOut + '\n getIn: ' + getIn + '\n getOut: ' + getOut + '\n file: ' + file + '\n markers: ' + markers + '\n mySeq: ' + mySeq + '');
};
//$.writeln("Out: "+marker_index+" -> "+getOut);
app.encoder.encodeSequence(mySeq,path1+sep1+"VID"+sequenceName+"MID"+count+"__"+marker_Name+".mp4",
epr1, app.encoder.ENCODE_IN_TO_OUT, 1);
//alert();
}
}
}
}
if(encode1 == "true") {
//alert("encode is: " + encode1);
app.encoder.startBatch();
}
//app.encoder.startBatch()
}
},
Effectively the script should exportthe two green marker blocks to media encoder which it does.
But I wanted to ignore any marker which is zero seconds.
however. I want to use the red marker a little bit later on in my code. that was better to have a solution if the marker is less than one second ignore it
by using this command: alert (marker_Type)
it should display three pop-ups, 1. Comment 2. Comment 3. Chapter. 1
I know I am very close and I could really do with your help.
thank you very much
Copy link to clipboard
Copied
Just to let you know,
This is wrong: current_marker !== undefined && current_marker.type == "Comment";
It should be: current_marker !== undefined";
Thank you
Copy link to clipboard
Copied
I propose that, after you iterate across all markers to find those > 1.0 seconds long, you either 1. iterate across all markers again, or 2. build a list of < 1.0 second markers during the first iteration, then iterate across the short ones.
Copy link to clipboard
Copied
hello. Okay. I understand exactly what you mean.
Is there anyway I can get some help with this please is there anyway I can get some help with this.
I should point out what the red marker is for.
Imagine the following scenario:
Marker in green: 00:01:20
Red Makrer (Chapter) 00:01:35
Marker in green: 00:01:50
the red marker would be outputted to a text file. Marker in green - Red Makrer (Chapter) = 15
so there would be a text file which is named as the sequence name. And inside it has 15.
Unfortunately I'm not a hardcore programmer. however I am willing to hire someone who somebody could really help me.
Thank you
Copy link to clipboard
Copied
would you be able to help the code with the easier solution.
Thank you
Copy link to clipboard
Copied
I'm happy to help guide another programmer's efforts, but I can't write the code for them.
My dog runs a software consultancy, but his rates are prohibitive. 😉
Copy link to clipboard
Copied
Thank you...
Great dog by the way. I can give 10k up front and a doggy treat. LOL