How can I export speech analysis text with imbedded timecodes for the creation of subtitle files?
i found script allows export text layers time codes .srt subtitle file. however, instead of multiple text layers, have one: meta data premiere speech analysis aid of different script, being used @ "subtitle layer". essentially, i'm trying use data create .srt file can create actual subtitles, not hybrid animation/text layer.
here script used export text layer .srt:
/*
subtitle exporter v01
script philipp grolle
www.display-artists.de
instructions:
select text layers want export, run script, , save file .srt
attention: script has not been debugged or testet. try on own risk!
*/
// selected layers
var thecomp = app.project.activeitem;
var allelayer = thecomp.selectedlayers;
// count how many layers selected
var anzahllayer = allelayer.length;
// enable line below if want change order of text (ascending / descending)
/* allelayer.reverse(); */
// prompt save file
var thefile = file.savedialog("save text file.", "untitled.txt", "text txt");
// if user didn't cancel...
if (thefile != null) {
// open file "w"riting,
thefile.open("w","text","????");
// selected layers
(x = 0; x < anzahllayer; x++)
{
// in- , outpoint of current layer , convert timecode (00:00:00:00)
var timecodein = timetocurrentformat(allelayer[x].inpoint, 25);
var timecodeout = timetocurrentformat(allelayer[x].outpoint, 25);
// split value of inpoint; converting last 2 characters (frames) milliseconds, , join again comma instead of colon
var str_in= timecodein;
var timecodeanfang_in=str_in.slice(0,8);
var timecodeende_in=str_in.slice(9,11);
var millisek_in = timecodeende_in*40; // 1000 milliseconds divided 25 fps = 40
var zusammen_in = timecodeanfang_in +"," + millisek_in;
//split value of outpoint; converting last 2 characters (frames) milliseconds, , join again comma instead of colon
var str_out= timecodeout;
var timecodeanfang_out=str_out.slice(0,8);
var timecodeende_out=str_out.slice(9,11);
var millisek_out = timecodeende_out*40;
var zusammen_out = timecodeanfang_out +"," + millisek_out;
//counter number above timecode (in results)
var zaehler = x+1;
//writing results file
thefile.write(zaehler);
thefile.write("\r\n");
thefile.write(zusammen_in);
thefile.write(" --> ");
thefile.write(zusammen_out);
thefile.write("\r\n");
thefile.write(allelayer[x].property("source text").value);
thefile.write("\r\n\n");
}
// close text file
thefile.close();
// open text file in default app
thefile.execute();
}
as using 1 text layer, shows me 1 continious subtitle in .srt file. have suggestions?
i should add myself not particularly familiar scripts or scripting, i'm merely trying possible solutions problem , seems approach. appreciated.
More discussions in After Effects Scripting
adobe
Comments
Post a Comment