Created
April 13, 2022 21:09
-
-
Save vyuh/13e251fcc17298bd26632e1da78b86f3 to your computer and use it in GitHub Desktop.
Adobe Premier Pro Transcript Automation
This file contains 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
function print_sequences() { | |
var i = app.project.sequences; | |
for (var x = 0; x < i.numSequences; x++) { | |
$.writeln(x + " " + i[x].name); | |
} | |
} | |
function print_activesequence_videotracks() { | |
var i = app.project.activeSequence.videoTracks; | |
for (var x = 0; x < i.numTracks; x++) { | |
$.writeln(x + " " + i[x].name); | |
} | |
} | |
function print_stuff_deep_upto_source_text() { | |
var i = app.project.activeSequence.videoTracks[1]; | |
$.writeln(i.clips.numItems) | |
var out = [] | |
for (var x = 0; x < i.clips.numItems; x++) { | |
$.writeln(x + " " + i.clips[x].name); | |
for (var y = 0, clip = i.clips[x]; y < clip.components.numItems; y++) { | |
$.writeln(x + " " + y + " " + clip.components[y].displayName) | |
for (var z = 0, comp = clip.components[y]; z < comp.properties.numItems; z++) { | |
$.writeln(x + " " + y + " " + z + " " + comp.properties[z].displayName) | |
out.push(comp.properties[z]) | |
} | |
} | |
} | |
return out | |
} | |
function print_only_source_text() { | |
if (JSON === undefined) createJSON(); | |
var i = app.project.activeSequence.videoTracks[1]; | |
var out = [] | |
for (var x = 0; x < i.clips.numItems; x++) { | |
for (var y = 0, clip = i.clips[x]; y < clip.components.numItems; y++) { | |
if (clip.components[y].displayName === "Text") | |
for (var z = 0, comp = clip.components[y]; z < comp.properties.numItems; z++) { | |
if (comp.properties[z].displayName === "Source Text") { | |
var jsonVal = comp.properties[z].getValue(); | |
var prefix = jsonVal.substring(0, 4); | |
var jsonObj = JSON.parse(jsonVal.substring(4)); | |
$.writeln([x, y, z, | |
clip.start.seconds.toFixed(2), | |
clip.end.seconds.toFixed(2), | |
clip.duration.seconds.toFixed(2), | |
jsonObj.mTextParam.mStyleSheet.mText].join("\t")); | |
// https://community.adobe.com/t5/premiere-pro-discussions/mogrt-getvalue-returns-json-in-extendscript/m-p/11086332#M266798 | |
out.push([x, y, z, jsonObj.mTextParam.mStyleSheet.mText]) | |
} | |
} | |
} | |
} | |
return out | |
} | |
var yo = print_only_source_text() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment