ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Automate subtitles with a csv

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Diego ⚡ Ramírez
Automate subtitles with a csv
on Oct 28, 2019 at 9:30:10 pm

Hi!

I'm working with a client that will often need subtitles made for 30+ minutes videos. All the text for the subtitles is given to me as a PPTX file with no timecode. I managed to convert the PPTX into a .CSV file that contains all lines of text, and I already have an expression in use to have a background for all text and resize it automatically.

What I would like to do now, is being able to create keyframes for each iteration of the loop that read the text lines, so that I would get 956 keyframes with 956 different SourceText.

Is there a way to do this? I've searched everywhere but haven't been able to find anything related to this.

var csv = footage("AllText.CSV");
for (var i = 0; i &lt; 955; i++) {
var value = csv.dataValue([0, i]);
//And here a new keyframe would be created for each iteration
}
value


Return to posts index

Dan Ebberts
Re: Automate subtitles with a csv
on Oct 28, 2019 at 9:42:37 pm

An expression can't create keyframes (well, you can convert an expression to keyframes, but that's different). It would be fairly straightforward though to create a small script to read your csv file and create keyframes from it. Where does the timing information come from though?

Dan



Return to posts index

Diego ⚡ Ramírez
Re: Automate subtitles with a csv
on Oct 28, 2019 at 9:44:38 pm

That's the problem, there's no time code information.

What I was planning on doing was to be able to link this in Premiere Pro where the whole edit is being done and use time remapping on premiere pro to change the text.


Return to posts index


Dan Ebberts
Re: Automate subtitles with a csv
on Oct 28, 2019 at 9:54:22 pm

So you would just want some arbitrary, constant amount of time between the keyframes?

Dan



Return to posts index

Diego ⚡ Ramírez
Re: Automate subtitles with a csv
on Oct 28, 2019 at 9:57:19 pm

Exactly.

If I took the time to manually create the 900+ keyframes, would there be a way of assigning to each one of those keyframes a different SourceText value based on the For loop?


Return to posts index

Dan Ebberts
Re: Automate subtitles with a csv
on Oct 28, 2019 at 10:02:56 pm

You mean with an expression? You wouldn't use a for loop. You'd use the index of the most recent, previous keyframe to retrieve the corresponding text from the CSV data.

Dan



Return to posts index


Diego ⚡ Ramírez
Re: Automate subtitles with a csv
on Oct 28, 2019 at 10:06:47 pm

Could you give me an example of that? or point in a direction where I could find more about that?

THANK YOU SO MUCH


Return to posts index

Dan Ebberts
Re: Automate subtitles with a csv
on Oct 28, 2019 at 10:09:52 pm

Give me an snippet of your CSV data to test with and I'll hook you up.

Dan



Return to posts index

Dan Ebberts
Re: Automate subtitles with a csv
on Oct 28, 2019 at 10:28:38 pm

Once you have the keyframes established, it will look like this:


csv = footage("AllText.CSV");
n = 0;
if(numKeys > 0){
n = nearestKey(time).index;
if (time < key(n).time) n--;
}
if (n > 0){
csv.dataValue([0,n-1]);
}else
""



Dan



Return to posts index


Diego ⚡ Ramírez
Re: Automate subtitles with a csv
on Oct 28, 2019 at 10:45:50 pm

YOU ARE MY SAVIOR!

Thank you so much!


Return to posts index

Diego ⚡ Ramírez
Re: Automate subtitles with a csv
on Oct 28, 2019 at 10:35:25 pm

The text is formatted as cells in a single column Excel. Here you go:

TEXT
Trust me; you will be surprised.
I'll also share with you the single
most important fat burning secret
that I teach my clients
here in Carmel; Indiana.
I know your time is valuable;
so; let's go ahead and jump right in.

Also, as comma separated values:

TEXT, Trust me; you will be surprised., I'll also share with you the single, most important fat burning secret, that I teach my clients, here in Carmel; Indiana., I know your time is valuable;, so; let's go ahead and jump right in.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]