SSA Subtitle Importer

Moderator: Paul Tuersley

Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

NOTE: SSA_Import is no longer available. Check out my newer pt_SSA Karaoke Animator script which lets you create your own unique text animation styles for your karaoke subtitles. See the pt_SSA Karaoke Animator post on aenhancers.com

Watch the tutorial video and download pt_SSAKaraokeAnimator from aescripts.com

Image

This script will import .ssa or .ass files from subtitling apps such as Substation Alpha. (requested by Hiji)

Any text that is found will be converted into After Effects text layers, along with any karaoke timing information. Currently the script ignores all other information such as layout and text styles.

How to use it:
1. Create a new text layer with your chosen text style. Make sure it's centered text if that's what you want and make it paragraph text (by click-dragging when creating the text layer) if you want long lines to word wrap.

2. With the text layer selected, run this script and choose a .ssa/.ass file to import. A new text layer is created for each line of text and keyframes are added to control word/syllable highlighting if there is any karaoke data.

NOTE: I've written this script with only a few .ssa files to test it on. So it's likely that some .ssa files won't import so well, especially if they include advanced subtitling features. Let me know if this happens to you and I'll see if I can make it more robust.

Hope you like it Hiji.

Paul T


How to change highlighting style for karaoke subtitles:
Two text animators are created, a Default Animator with a white Fill Color and a Highlight Animator (for Karaoke highlighting) with a red fill. Delete the default Fill Color if you want your original text color. By adding/removing properties from these text animators, you can create all kinds of different karaoke highlighting styles.

This is the default style:

Image

In the next example I've removed the Fill Colors and added two Opacity properties. The main text is 50% opacity, while highlighted text is 100%.

Image

Here I've used a Postion property on the Highlight Animator with a y-axis offset, so highlighted text jumps above the rest.

Image

Finally, this example uses both Scale and Tracking properties to make the highlighted text bigger.

Image[/url]
Last edited by Paul Tuersley on November 4th, 2006, 4:36 am, edited 5 times in total.
Hiji
Posts: 9
Joined: July 13th, 2005, 5:06 pm

woohoo XD thanks for the hard work paul
i'll test this out when i get back from work
it look like how i want it to be :D
/me is excited

will give u feedback once i play with it for a while.
great job
Shinjipierre
Posts: 36
Joined: December 4th, 2004, 10:10 am

Funny, I did the same script 6-12 (I don't remember) months ago :D

It's not exactly the same since mine is more dedicated to karaokes ;)

Goof work ^^
Hiji
Posts: 9
Joined: July 13th, 2005, 5:06 pm

Why dont you share ur script like Paul did? ^_^
Shinjipierre
Posts: 36
Joined: December 4th, 2004, 10:10 am

It's not really user-friendly enough for me.

I'll release it if they add the needed fucntions in after effects scripting.

Edited :
http://naru.easynetonline.net/yaoithrow ... xample.avi
I did an example of that karaoke script here.
finest
Posts: 10
Joined: August 30th, 2005, 5:18 pm

Hi, being a fansubber this script is of great interest for me. I was going to request it, until I saw it had already been done. I tested it out and it loads the text fine, but it always fails to include the karaoke data. For example when I use this SSA script

Code: Select all

[Script Info]

;--------------------------------------------
;|  This is a Sub Station Alpha v4 script   |
;|                                          |
;| Created with MEDUSA - Subtitling Station |
;--------------------------------------------

Title: 
Original Script: 
Original Translation: 
Original Editing: 
Original Timing: 
Synch Point: 
Script Updated By: 
Update Details: 
ScriptType: v4.00
Collisions: Normal
PlayResX: 640
PlayResY: 480
PlayDepth: 0
Timer: 100.0000

[V4 Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding
Style: Default,Arial,25,255,16777215,0,0,0,0,1,2,2,2,20,20,30,0,0

[Events]
Format: Marked, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
Dialogue: Marked=0,0:00:00.00,0:00:02.00,Default,,0000,0000,0000,,{\k25}A{\k25}B {\k25}C{\k25}D {\k25}E{\k25}F{\k25}G{\k25}H
It doesn't do anything. The Karaoke part fails. Any help would be greatly appreciated.

edit: I am using Adobe After Effects 6.5 Pro [6.5.0.97]

Thank you.
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

hi finest

It's not really surprising your .ssa file didn't work. As I mentioned in my first post, I've only had a few .ssa files to test the script on. The problem in this case is that the script is looking for a 'karaoke' effect type in each 'dialogue' line to decide whether to treat it as karaoke or as a normal subtitle.

If I change the line in your posted example:
Dialogue: Marked=0,0:00:00.00,0:00:02.00,Default,,0000,0000,0000,,{\k25}A{\k25}B {\k25}C{\k25}D {\k25}E{\k25}F{\k25}G{\k25}H

To this: (inserted "Karaoke")
Dialogue: Marked=0,0:00:00.00,0:00:02.00,Default,,0000,0000,0000,Karaoke,{\k25}A{\k25}B {\k25}C{\k25}D {\k25}E{\k25}F{\k25}G{\k25}H

Then when I run the script it properly adds the text with the karaoke effect.

As I get more examples of .ssa files, I'll get a better understanding of the file format and will be able to improve the script. It may be a while before I have the time to update it, but meanwhile you could try this:
1. Make a copy of the SSA_Import_1.0.jsx script.
2. In the copy of the script, locate the line createSubtitle(startTime, endTime, theText);
3. Replace that line with createKaraoke(startTime, endTime, theText);

Then you'll have a copy of the script that always tries to interpret the data as karaoke.
finest
Posts: 10
Joined: August 30th, 2005, 5:18 pm

Thanks Paul, I'll look into it once more.

If you want to know more about SSA and ASS(sort of updated SSA) you can consult these two files. [the difference in ASS is marked in red afaik]
http://www.fansubbing.org/files/index.p ... 7e7f87c944
http://www.fansubbing.org/files/index.p ... 7e7f87c944

The format of ASS and SSA generally differ a bit, but they have many similarities. Hope it helps.

edit: This thread also gives a good insight how karaoke effects are implemented in SSA/ASS http://forums.animesuki.com/showthread.php?t=13795

edit2: Also is it possible to use any of the text animation presets for the karaoke highlight?

edit3: Whenever I change the keyframe interpolation from hold to something like Beizer or Linear for smooth fill-in etc, at the end of the line the range selector seems to move backwards relatively quickly and highlighting the words. Is there any way to avoid/bypass this?
Hiji
Posts: 9
Joined: July 13th, 2005, 5:06 pm

Im glad someone else try it as well.
I was gonna ask about the fill thing like you do with \K in ssa
glad you've ask for me :D

Also paul if you've time could you please look into letting it allow to import
an SSA/ASS file which has unicode in it such as japanaese characters.

if you need example let me know i'll email it to you.
philspitler
Posts: 39
Joined: November 2nd, 2005, 10:20 am
Contact:

Hi Paul,
I would like to usee your script, it looks like a real time saver.

I generated my test .ssa file but get a script error when I select it.

My .ssa is below.

Any ideas?

Thanks.

Phil





[Script Info]
;
; Script generated by SubCreator
;
Title: <unknown>
Original Script: <unknown>
Original Translation:
Original Editing:
Original Timing:
Synch Point:
Script Updated By:
Update Details:
ScriptType: V4.00
Collisions: Normal
PlayResY: 0
PlayResX: 0
PlayDepth: 0
Timer: 100.0000

[v4 Styles]
Format: Name,Fontname,Fontsize,PrimaryColour,SecondaryColour,TertiaryColour,BackColour,Bold,Italic,BorderStyle,Outline,Shadow,Alignment,MarginL,MarginR,MarginV,Encoding
Style: Default,Arial,16,16777215,65535,65280,0,0,0,1,1,0,2,30,30,30,0

[Events]
Format: Marked,Start,End,Style,Name,MarginL,MarginR,MarginV,Effect,Text
Dialogue: Marked=0,0:00:00.00,0:00:04.00,*Default,NTP,0000,0000,0000,,Train comes
Dialogue: Marked=0,0:00:04.60,0:00:06.20,*Default,NTP,0000,0000,0000,,test
Dialogue: Marked=0,0:00:06.20,0:00:07.70,*Default,NTP,0000,0000,0000,,posts
Dialogue: Marked=0,0:00:07.70,0:00:07.80,*Default,NTP,0000,0000,0000,,rpost
Dialogue: Marked=0,0:00:07.80,0:00:10.00,*Default,NTP,0000,0000,0000,,yellow
Dialogue: Marked=0,0:00:10.00,0:00:13.30,*Default,NTP,0000,0000,0000,,wide
Dialogue: Marked=0,0:00:13.30,0:00:16.10,*Default,NTP,0000,0000,0000,,single yellow
Dialogue: Marked=0,0:00:16.10,0:00:20.10,*Default,NTP,0000,0000,0000,,red
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

I'm going to try and find some time to work on the script. I'll start with some of the easier problems and gradually work my way through the feedback.

finest,
I'd say it's unlikely that just applying a text animation preset will give you your desired effect. Can you create and send me an example AE project of what you'd like it to do?

Also maybe you or Hiji could send an example of what this 'smooth fill-in' thing would look like. The Range Selector needs a Hold keyframe at the end of each line because the script currently places all the lines of text on a single text layer and the start/end values need to return to zero for the beginning of each new line, I'm planning on breaking it up into multiple layers which should be a step in the right direction.

hiji,
Please do send me an example of a script which includes unicode/japanese characters. But I'm guessing this will be one of the harder things to implement so don't expect it any time soon.

phil,
The first thing on my to do list is to rework the script to make it a bit more robust and adaptable, so hopefully I'll be able to get it working with your script pretty soon.

In general, the most helpful thing for me would be if you could all send me a few example scripts <paul.tuersley@btinternet.com> that cover the things that you'd like to be able to do, along with examples or descriptions of what you see when these script are open in your fansub application.

Paul T
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

phil,

I've just tried importing that .ssa example you posted and it works fine for me.

My first thought, are you using After Effects 6.5? Most, if not all of the scripts on this site won't work in 6.0. If that's not the reason, what is the error message you get?
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

I've changed the url in my original post, it now links to an updated version of the script.

Changes in SSA_Import_v1.1:
1. A new text layer is created for each line of text. This means it should behave better if you want to change the Hold interpolation on the keyframes. Also, you can apply different styles or effects to each line of text if you wish.

2. The script should be able to handle a wider range of .ssa and .ass files. Basically it's better at dealing with the small differences found in files exported from different subtitling apps. For example, the script that finest was having problems with now imports properly.

3. A readout in the Info palette displays the text as it is imported.

4. Text layers are named to match their content.

I'm sure there are still occasions when the script will break, the most likely being those that contain {/kf...} style modifiers. As always, send me a copy of any files you have trouble importing.

Unicode character support:
Regarding Hiji's request for supporting unicode characters, now when I importing one of your example files I get extra lines that look like this íNLJímÇÁǻǢåæótÇ?. Are they unicode characters by any chance? Anyway, I think there must be a bug in AE when dealing with these characters because I've found they only import if I reorder the lines in the .ssa file so these are the first dialogue lines.
finest
Posts: 10
Joined: August 30th, 2005, 5:18 pm

Thanks for the updated script. I'll try it out in a bit.

about what I asked before, is there a way to use the effects such as blur etc for the highlight animation. So when the syllable starts there is no blur, but as it gets sung the syllable gets blurred to a specific point and maybe goes back to original. Similar with the text animation presets.

edit: I guess one way to do that would be to duplicate the line. set highlight and default animator to 0% opacity respectively. Apply blur to the highlight animation text layer with keyframes duplicated from the highlight animator range and with appropriate values to the effect applied. Altough I don't know how one would go about doing that. If you just set blur without keyframes then you get a static blur for the sung syllables. I am looking to do is increasing the blur as the syllable is sung.

edit2: You script does not seem to be inserting keyframes for silences. But it's not a major issue. Also please check your pm for an example of what I was talking about in the first edit.
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

finest,

I would apply an effect to the highlighted text in just the way you described. After running the import script, duplicate one of the text layers and on one of the layers, use the 'Add' pulldown beside the Highlight Animator to add an Opacity property which you set to 0%. On the other layer, add a 0% Opacity property to the Default Animator and a 100% Opacity property to the Highlight Animator, then add a blur effect to this layer. I'll have a think about ways to vary amounts of effects like blur.

Unfortunately, now the script generates multiple text layers, you'll have to do this for each one. It would be pretty simple for me to get the script to do all this automatically. The only question is whether to make this a separate script, or create a UI that gives various choices like this when you run the script.

Regarding your comments about silences, do you mean that words wouldn't be highlighted, one straight after another, but there would be gaps when nothing is highlighted? Presumably this would need a .ssa file that contained {/k35} type duration modifers that were followed by no text data. I'm not sure I have any examples that do this, but I can imagine why my script may not deal with these cases properly.
Locked