Copy link to clipboard
Copied
I'm currently working on a PPro Panel that will cut the last second off of a clip and extend that clipped second duration out the next clip. I'm currently stuck on how to perform a clip cut from the script. This will be used to supply extending the visual in case the above-placed title is longer than the below clip. It'll pause the video while the title continues to finish out it's duration.
These are the notes I have so far:
app.project.activeSequence.getSelection()
this will be used to get the end seconds of a clip
app.project.activeSequence.setPlayerPosition()
this will be used to set the player position -1 second from end of selection.
I have PropertyExplorer installed and have exploring properties for a bit and haven't found the appropriate method/property to perform a cut. Help, please?
There's no cut function; you'd need to change the end point of the trackItem (clip).
var myClip = app.project.sequences[0].videoTracks[0].clips[0]; // grabs first trackItem in first track in first sequence
if (myClip){
var oldEnd = myClip.end;
if (oldEnd){
oldEnd.seconds = oldEnd.seconds + 3; // arbitrary new value
myClip.end = oldEnd;
}
}
Copy link to clipboard
Copied
There's no cut function; you'd need to change the end point of the trackItem (clip).
Copy link to clipboard
Copied
Can this be done through a different method? I'm currently working on this as a panel using HTML and ExtendScript/Javascript. Can another develop method provide this kind of automation? i.e. via the SDK
Copy link to clipboard
Copied
> Can this be done through a different method?
Yes; changing the end point of the trackItem. 🙂
> Can another develop method provide this kind of automation?
You don't need another method; you can use ExtendScript.
Copy link to clipboard
Copied
I tried updating the end point with
app.project.activeSequence.getSelection()[0].end.seconds = 20
and
app.project.activeSequence.getSelection()[0].end = {"seconds":20, "tick":existingTick};
and have had no success. I appreciate your information henceforth. Could you help me further this process?
Copy link to clipboard
Copied
Reaching out directly.
Copy link to clipboard
Copied
Hi!
did you find the proper way to cut part of tacks or clips ??
Thanks
Copy link to clipboard
Copied
The proper way remains adjusting the end point.
Copy link to clipboard
Copied
Thanks!
actualy I solved my problem)
we can use this:
app.project.rootItem.children[index].createSubClip(name, startTime, endTime,
hasHardBoundaries, takeAudio, takeVideo);
and than insert this clipped project item to sequence track
app.project.sequences[index].videoTracks[index].insertClip(projectItem, time);
Copy link to clipboard
Copied
What is the code snippet to adjust the end point?
There have been multiple responses from employees saying 'adjust the end point' without saying how to adjust the end point via script.
Wouldn't have commented about it but Google has led me back here like a dozen times.
Copy link to clipboard
Copied
var myClip = app.project.sequences[0].videoTracks[0].clips[0]; // grabs first trackItem in first track in first sequence
if (myClip){
var oldEnd = myClip.end;
if (oldEnd){
oldEnd.seconds = oldEnd.seconds + 3; // arbitrary new value
myClip.end = oldEnd;
}
}
Copy link to clipboard
Copied
You're the best, thanks!
Copy link to clipboard
Copied
There's no cut function in extendscript API. QE DOM has razor(string, bool, bool) method on sequence and track objects but I failed to get it to work.
As a workaround you can use overwriteClip() with one-frame media and then delete that new media immediately, so you will have two desired cutted clips BBBBUT with one frame gap.
Another workaround is adjusting inPoint, outPoint, start and end, but it is a bit tricky: clip's inPoint and outPoint work in a strange nonobvious way, so make tests first.