Created
April 28, 2018 14:06
-
-
Save fk128/eda19f201cf7ecbe2b57aee3338a56d5 to your computer and use it in GitHub Desktop.
re-splice video file in after effects given time stamps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// create an undo group | |
app.beginUndoGroup("respliceScript"); | |
var curItem = app.project.activeItem; | |
var selectedLayers = curItem.selectedLayers; | |
var times = ["00.10-00.24", "00.34-01.03", "01.25-01.37"]; | |
// check if comp is selected | |
if (curItem == null || !(curItem instanceof CompItem)){ | |
// if no comp selected, display an alert | |
alert("Please establish a comp as the active item and run the script again"); | |
} else { | |
var ip = 0; | |
var op = 0; | |
for (var i = 0; i < times.length; i++) { | |
var time = times[i].split('-'); | |
var start = time[0].split('.'); | |
var end = time[1].split('.'); | |
var s_minutes = parseInt(start[0]); | |
var s_secs = parseInt(start[1]); | |
var e_minutes = parseInt(end[0]); | |
var e_secs = parseInt(end[1]); | |
var newLayer = curItem.selectedLayers[0].duplicate(); | |
newLayer.inPoint = s_minutes*60+s_secs; | |
newLayer.outPoint = e_minutes*60+e_secs; | |
var duration = e_minutes*60+e_secs-(s_minutes*60+s_secs); | |
newLayer.startTime = - newLayer.inPoint + ip; | |
// newLayer.inPoint = ip; | |
// if (i == 0) | |
// op = e_minutes*60+e_secs-(s_minutes*60+s_secs); | |
// newLayer.outPoint = op; | |
ip = ip + duration; | |
// op = op + e_minutes*60+e_secs-(s_minutes*60+s_secs); | |
} | |
} | |
// close the undo group | |
app.endUndoGroup(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment