logo Sign In

Need help making custom AviSynth DLL

Author
Time

So here's what I'm trying to do.  I'm using a GUI utility (easySUP) which uses AviSynth's TextSub function (vsfilter.dll) to render text subtitles.

My problem is that all of the rendered subs are center-aligned.  I would like the ability to include markup in my text subtitles which tells TextSub to render the subs left-aligned.  Not left-aligned within the entire movie frame, just align all text so that they line up with the longest line of text along their left side.  (This would be used for double-dialog, so the hyphens at the start would line up, for example--but the subtitles would still be toward the center-ish of the movie frame)

This change wouldn't be relevant for single lines of text, and I have no plans for more than two lines of text, so the logic would go something like this:
1) If there are two lines of text AND
2) Markup is detected at the beginning of both lines, THEN
3) Calculate the position of the longer line as normal, and
4) Calculate the position of the shorter line as normal, except the the leftmost X coordinate should match the X coordinate of the longer line.

The markup could be anything, even just a single non-frequently-used ASCII character like a pipe character, I don't care really.  The markup would be stripped out before rendering naturally.

Any ideas how I should get started on this?  I feel this is outside the range of my technical abilities, but I could probably make it with some hand-holding (or a generous spirit willing to write and compile it).  I know some members of the community have compiled custom AviSynth DLLs before, so I'm hoping this is doable!

Project Threepio (Star Wars OOT subtitles)

Author
Time

There are people here who know a lot about avisynth but I imagine you would be better off by searching for the avisynth development forum and asking them. 

Luke threw twice…maybe.

Author
Time

Well I don't think there is anything official about avisynth.  It's just a bunch of guys that work together on the program and it's filters.  If you go to the avisynth development forum the guy that made vsfilter probably is there and they all exchange information freely so it shouldn't be a problem.

I don't think you need a custom dll made though you could probably accomplish this with a script or a function in avisynth. I've never used vsfilter but i'll take a look at it.  If I see a way to do it i'll let you know.  I'd still go to the development forum and see what they've got to say about it though.

Luke threw twice…maybe.

Author
Time

Yes, only the filter "Subtitle" is contained in the AviSynth DLL; "TextSub", as you've identified, is part of the VSFilter plugin DLL.

Before you look into developing your own plugin, maybe you could check some of the other subtitling filters here:
http://avisynth.org/mediawiki/External_filters#Subtitling 

Guidelines for post content and general behaviour: read announcement here

Max. allowable image sizes in signatures: reminder here

Author
Time

OK, good to know.  I managed to get what I think is the source code for vsfilter.  I think I'm bound to this particular DLL for my functionality because easySUP solves a lot of my other problems, and I'm trying to make a simple(ish) solution for the masses and easySUP gets me 98% of the way there...

I'll see what I can do.  The code looks ... not simple ;)  Hopefully the forums may yield something.

Project Threepio (Star Wars OOT subtitles)

Author
Time

Just to update everyone with the resolution of this issue: I've managed to modify and compile vsfilter.dll on my own and it actually works (and I am feeling like SUCH a bad-ass right now)!  Thanks to everyone for their pointers.  This DLL will be included as part of my upcoming subtitle project.

Project Threepio (Star Wars OOT subtitles)