Log in

View Full Version : Subtitling w/ SSA and AviSynth


Hoagie
4th August 2002, 19:54
Some time ago I was able to accomplish this, but took a long break from the method and have forgotten how I went about it.

I am trying to load a SSA script into AviSynth to subtitle the output. If memory serves, I imported the VirtualDub plugin... so I have the following line my AVS file:

LoadVirtualDubPlugin("D:\VirtualDub 1.4d\plugins\Subtitler.vdf", "VDubSubtitler")

I then put this file in:

VDubSubtitler("D:\scripts\mac7_credits.ssa")

But the resulting AVI tells me I have invalid arguments to 'VDubSubtitler'. Ok, so I am missing something... I'm clueless as to what arguments I should be sending this thing! :(

Can anyone help me in sending the right arguments so I can get subtitles to show up?

Many thanks for any help!!

Hoag

--- the whole script, if needed ---
LoadPlugin("D:\AVISynth DLLs\mpeg2dec.dll")
LoadPlugin("D:\AVISynth DLLs\tprivtc.dll")
LoadVirtualDubPlugin("D:\VirtualDub 1.4d\plugins\Subtitler.vdf", "VDubSubtitler")

mpeg2source("E:\Macross 7 - Disk 6\Chapter 08.d2v")
resampleaudio(44100)

VDubSubtitler("D:\scripts\mac7_credits.ssa")

DoubleWeave().tprivtc("Chapter 08.tpr")

dividee
4th August 2002, 21:01
Use TextSub, the plugin that comes with VobSub. It's easier since it's a native avisynth plugin, and works in YUY2.

Faceman101
5th August 2002, 07:40
LoadPlugin("c:\Program Files\VobSub\TextSub.vdf")
AVIsource("d:\Hard Boiled CD1\1.avi")
TextSub("d:\Hard Boiled CD1\1.srt")

Just read up on this 2min ago, looks and works great. Looking into now dealing with an AVI with dual audio tracks.

stickboy
5th August 2002, 08:35
If you don't need hard subs, you also can keep the SSA file separate and use DirectVobSub to display them at runtime.

zjlcy
7th August 2002, 14:05
@ Hoagie
The script may like this:
----------------------------------------------
LoadPlugin("D:\AVISynth DLLs\mpeg2dec.dll")
LoadPlugin("D:\AVISynth DLLs\tprivtc.dll")
LoadVirtualDubPlugin("D:\VirtualDub 1.4d\plugins\Subtitler.vdf", "_VD_Subtitler")

clip=mpeg2source("E:\Macross 7 - Disk 6\Chapter 08.d2v")

return clip.ConvertToRGB()._VD_Subtitler(2,"D:\scripts\mac7_credits.ssa")
----------------------------------------------
and if needed, insert some IVTC plugin like Decomb.
D2V project doesn't contain any audio infomation, so I don't know why do you use resampleaudio in the script.

@ Faceman101

I also noticed that new TextSub function for avisynth&VD is included in Vobsub2.10 and above. But is it really great? At least I don't think so. I can't choose font sytle with this fuction, even for a SSA format subtitil. I have read this:
http://forum.vcdhelp.com/userguides/87065.php
But I can't get the result follow those steps.
I tested with VOBSUB 2.16.

Sorry for my poor English. It's not my native language, but I think you'd unstand me anymore. ;)

manono
8th August 2002, 20:39
Hi zjlcy and welcome to the forums-

The earlier posters are correct. TextSub is the way to go. After you have converted to SSA format, load the SSA file into Sub Station Alpha (ftp://anime.jyu.fi/pub/SSA/SSAinstall.exe) And then you can choose font, size, colors, position and just about anything else you want. Save the improved file and then insert it into the .avs. It takes awhile to learn, but it's worth it.

Edit: Or if you don't want to go through the trouble, just open the SSA file with Notepad and where it says V4 Styles near the top, change the font (default is Ariel I believe) to whatever you want.

Schultz
9th August 2002, 00:34
Originally posted by zjlcy

@ Faceman101

I also noticed that new TextSub function for avisynth&VD is included in Vobsub2.10 and above. But is it really great? At least I don't think so. I can't choose font sytle with this fuction, even for a SSA format subtitil. I have read this:
http://forum.vcdhelp.com/userguides/87065.php
But I can't get the result follow those steps.
I tested with VOBSUB 2.16.

Sorry for my poor English. It's not my native language, but I think you'd unstand me anymore. ;)

Also if you want to specify a font for Srt format subs you have to add a style file next to eh srt with a SSA style header only in this file.. so it looks like
subfile.srt
subfile.srt.style

The easiest way to do this is open them in subresync and change the fonts to what you want then save it again in srt and it will write out the style file for you.. then use the TextSub in Avisynth and you will have the font/color that you want. but i would recommend SSA over Srt anyways since you have more options to do things..

zjlcy
9th August 2002, 19:37
@manono
thank you.:)
But I'v tried SSA fotmat subtitle before my above reply.
I know how to use Sub Station Alpha or simply edit the SSA subtitle in the text editor. At the first time I use TextSub with a SSA file, it show the correct font style in the picture, but the line break sign "\n" is also showed as the normal character. I thought that it would be some parameters like in TextSub for Vdub would be helpful. When I read the document of textsub, I found out the syntax of TextSub is TextSub(file,a,b) which "a" is the language code and "b" is frame rate, no other information could be described there. So I guessed that it might be adjusted when the VobSub for directshow filter is working, and I played a movie with SSA subtitle file. After I did that, I losed all format in TextSub for avisynth, even the font describ in SSA file!

@Schultz
Follow the above steps, I tried to do as you said and got the .style file. But it's my .style file:
==========================================================
ScriptType: v4.00+
PlayResX: 384
PlayResY: 288

[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: Default,
==============================================================
Nothing after "Default,".
I also tyied to fill the value according the SSA file, it still couldn't work correctly. May be when I use this at the time when SSA font style can be showed, it would working.

At last, I use SSA subtitle for Vdub pluging, and it worked well.

May be my far east language WinXP system caused this problem?

However, VOBSUB 2.09 is the best version for me. The text subtitle not wrap if I use any abov version when I play the movie, and when use 2.16 in win98se, it show some character in the wrong language set.

gabest
9th August 2002, 22:24
What was the name for the font originally?

zjlcy
10th August 2002, 05:58
It's my pleasure to feed back.:)
There are large amount of people around me using your program. Many thanks for your great job.

You meant the "wrong language set"?

I found I was wrong when I went back to my Win98se system. It may not only be the "wrong character set",but aldo seems like got the wrong resource.

There are 3 place display the wrong result. Fisrt at the "Language" menu of Windows Media Player 6.4, 2nd at the VOBSUB's tray icon, the same contents as in "Language" menu, last at the tab information of the VOBSUB's properties Dialog box.

all of them display like ?¡À?¡Â??, seems like lost the DBCS information, even I use English interface and not install the language pack.

I noticed there were some non-English string in your resource file, so I think maybe the language of character at the Tab may depends on the SYSTEM language, not the choosed.

And I promise that not only me got the result, because it was reported in our forums before and all of us agree.

Under Win2k or WinXP, everything is ok except it can't auto wrap the subviwer&subrip format text subtitle--cause display out of screen if the subtitle line is too long.

May be under a English based system, everything is ok, But I have any.

Hope for 3 upgrade: right menu&dialog play under far win98se, auto-wrap enable for pure text subtitle, and the TextSub for Avisynth working for me(.style file?). May be all of them only wrong under a far east system.

Many thanks again.

gabest
10th August 2002, 11:39
Originally posted by zjlcy
There are 3 place display the wrong result. Fisrt at the "Language" menu of Windows Media Player 6.4, 2nd at the VOBSUB's tray icon, the same contents as in "Language" menu, last at the tab information of the VOBSUB's properties Dialog box.

all of them display like ?¡À?¡Â??, seems like lost the DBCS information, even I use English interface and not install the language pack.

I noticed there were some non-English string in your resource file, so I think maybe the language of character at the Tab may depends on the SYSTEM language, not the choosed.Under win9x I could never display any non-latin1/2 characters on any windows I saw in my life :) But the problem with truncating after "Default," is not because of this. Everything except the dialog's text must be in ANSI, including the font's name, too. You could look up the english names for your fonts here: http://www.trigeminal.com/samples/font_choices.html .Under Win2k or WinXP, everything is ok except it can't auto wrap the subviwer&subrip format text subtitle--cause display out of screen if the subtitle line is too long.Wrapping can be done where there are spaces between the words. Maybe your language just doesn't use any spaces. Would it be possible?

zjlcy
10th August 2002, 16:13
Originally posted by gabest
Under win9x I could never display any non-latin1/2 characters on any windows I saw in my life :) But the problem with truncating after "Default," is not because of this. Everything except the dialog's text must be in ANSI, including the font's name, too. You could look up the english names for your fonts here: http://www.trigeminal.com/samples/font_choices.html .I came back to my win98se platform and tyied agaig.
Sorry for my wrong memory: All menu and dialog displayed correctly without language pack. But when I install the language pack, it displayed as in my attachment. And it would display correctly under win2k/XP system with the same language pack. [/B]Wrapping can be done where there are spaces between the words. Maybe your language just doesn't use any spaces. Would it be possible? [/B]Yes, My language doesn't use any spaces. But with VOBSUB 2.09, auto-wrapping function worked very well. Why the above version lost this function?

gabest
10th August 2002, 16:29
Originally posted by zjlcy
I came back to my win98se platform and tyied agaig.
Sorry for my wrong memory: All menu and dialog displayed correctly without language pack. But when I install the language pack, it displayed as in my attachment. And it would display correctly under win2k/XP system with the same language pack.Well, I have no idea. Localizing with MFC was a bad idea anyway. I takes a lot of time to manage the resources, I don't think I will continue doing it... Yes, My language doesn't use any spaces. But with VOBSUB 2.09, auto-wrapping function worked very well. Why the above version lost this function? In 2.09 windows was drawing the text and it somehow knew where to wrap asian words. If you turn off advanced renderer in the options of 2.10+, you will get back the old renderer from 2.09.

zjlcy
10th August 2002, 17:33
Originally posted by gabest
...In 2.09 windows was drawing the text and it somehow knew where to wrap asian words. If you turn off advanced renderer in the options of 2.10+, you will get back the old renderer from 2.09.
Thanks, it works very well as you said.

Any suggestion for me about TextSub for avisynth? If it could work like TextSub for VirtualDub(although the same plugin, but not the same result), I'd like it very much because it work at YUY2 mode.

I almost use 2.16 instead of 2.09 when you tell me it can do wrapping same as 2.09. But I remember the other trouble(may not be a bug) for me with using 2.16. when I use subrip format subtitle file with the wrong leading number, VOBSUB 2.16 does not work as I wish.
For example:
-========================================-
1
00:00:32,500 --> 00:00:34,750
[Dramatic instrumental music]


00:01:13,917 --> 00:01:15,125
BOY: Whoa!


00:01:19,042 --> 00:01:20,667
[Children giggle]

3
00:01:21,667 --> 00:01:25,250
BOBBY EARL: You want my money,
best throw some elbow into that.
-====================================
this SRT file would not work as I wish.

But 2.09 is well.

gabest
10th August 2002, 17:42
I think this was only a problem in 2.15, now it should work again. That was the first version which allowed empty lines in the text and that's why correct numbering was needed to separate subtitle entries following eachother.

zjlcy
10th August 2002, 17:50
Sorry I edit the last post.

It seem only the empty leading number would cause empty result.

Anyway, many thanks for your reply, and so many thanks for your great job.