I am trying to automate a workflow with my client’s subtitles.
I have tried many things! Here the history (which you can skip if you want as my main query is further down)
STEP 1
I receive a SRT file (which is just a text document, in this format https://en.wikipedia.org/wiki/SubRip) from a transcriber and bring it into AE using this script:
https://github.com/908video/DCSubToAE
This creates a single text layer with markers for each of the captions
STEP 2 (not necessarily needed but I like to see the cuts visually, and to help with my potential STEP 4)
I use this plugin to split that single layer into lots of text layers based on the markers
http://aescripts.com/pt_layermarkers/
STEP 3
I make some adjustments to the in and out points as the transcriber has slightly misjudged some of the timings. I then get this signed off and this becomes my master subtitle set.
Now here are where my issues with this are:
ISSUE 1
I would like to have a STEP 4 where I export the layers as a new SRT to be sent off for versioning into other languages so that when I bring it back in it all matches my signed off tweaks - rather than the versioning being based on the original SRT that I received. I used this script to export:
viewtopic.php?f=3&t=2116
However the problem seems to be that because the text is based on Markers, it doesn't read this and therefore gives me the timecodes with nothing in it.
Really I want to be able to just use the timecode instead of the SRT format because not many players actually show milliseconds so the transcriber has to have a certain one.
ISSUE 2
As the text is based on the marker copy I am not able to highlight certain words (my work around at the moment is using the fill and setting the range to be word based and moving the offset). Is it possible to make the text live again or due to the expression it can only be edited within the marker?
SO this brings me onto here as I posted that question a while ago on a forum and got no answers so decided to give up on that route entirely and simplify the process with some scripts.
To begin with I typed in 3 text layers manually (no markers involved)
I then modified the export script to give me a file that looks like this:
Code: Select all
00:00:01:23
00:00:02:14
Hello! My name is Test Subject.
I am here to talk about subtitles
00:00:02:14
00:00:04:05
I love subtitles. I wish I could
have all the subtitles ever.
00:00:04:05
00:00:05:21
I mean, who doesn’t love subtitles.
I then want to be able to import that back in (with updated language version)
I have used this script from Motion Scripts:
Code: Select all
{
// create undo group
app.beginUndoGroup("Create Text Layers From File");
// Prompt user to select text file
var myFile = File.openDialog("Please select input text file.");
if (myFile != null){
// open file
var fileOK = myFile.open("r");
if (fileOK){
// create project if necessary
var proj = app.project;
if(!proj) proj = app.newProject();
// create new comp named 'my text comp'
var compW = 1920; // comp width
var compH = 1080; // comp height
var compL = 30; // comp length (seconds)
var compRate = 25; // comp frame rate
var compBG = [0/255,0/255,0/255] // comp background color
var myItemCollection = app.project.items;
var myComp = myItemCollection.addComp('my text comp',compW,compH,1,compL,compRate);
myComp.bgColor = compBG;
// read text lines and create text layer for each
// until end-of-file is reached
var text;
while (!myFile.eof){
text = myFile.readln();layer
if (text == "") text = "\r" ;
myComp.layers.addText(text);
}
// close the file before exiting
myFile.close();
}else{
alert("File open failed!");
}
}else{
alert("No text file selected.");
}
app.endUndoGroup();
}
Though doesn’t quite do what I want it to.
Ultimately I want to look at this bit:
Code: Select all
[size=100][/size]
var text;
while (!myFile.eof){
text = myFile.readln();layer
if (text == "") text = "\r" ;
myComp.layers.addText(text);
}
Read first line. This is timecode in of layer 1
Read second line. This is timecode out of layer 1
Read third line. This is first line of text layer 1
Read fourth line. This is second line of text layer 1
Read fifth line. This is a break. Stop process but repeat until end of file.
Is this possible at all or have I gone completely down a rabbit hole? Any help would be much appreciated! My coding is very basic so I just wanted to check if it was even possible before spending too much more time on it.
Cheers,
Mel