AnimeSuki.com Forum

AnimeSuki Forum (http://forums.animesuki.com/index.php)
-   Fansub Groups (http://forums.animesuki.com/forumdisplay.php?f=17)
-   -   LVS - my personal Overlua follower (http://forums.animesuki.com/showthread.php?t=119053)

Youkakun 2013-04-19 20:43

LVS - my personal Overlua follower
 
For those who didn't discovered it in Aegisub forum already, i present my personal follower of Overlua here: LVS.

Personally i use it for typesetting, karaoke effects, image creation and some video effects.
Opening AvsPMod -> writing the Avisynth script for video & LVS loading -> writing the LVS input script while refreshing AvsPMod to see the results -> encode Avisynth script.
It's some Lua programming with a graphics kit, but all-in-all easier and more powerful than Overlua (and active).
In comparison, some advantages:
  • More up-to-date Lua (v5.2) with utf-8 support on windows
  • Simpler and larger API
  • Better text support (with windows fonts)
  • Advanced ASS parser
  • Fast image convolution with arbitrary kernels
  • PNG im- & export
  • Autoload folder for standard included scripts
  • Mesh gradient
  • ...

I've already thought about writing a GUI, but using it with AvsP is comfortable enough. Maybe it could be the core of NyuFX 2... i don't know.
Other plugin interfaces shouldn't be a problem and i've already implented a ffmpeg demuxer [1][2] in NyuFX 1.6, so this project could have a future :)

I tried to write a lot of documentation, like easy usage examples, html documents and many comments in source code.
Feedback would be nice and contributors are welcome.

fgghjjkll 2013-05-01 01:43

Interesting project. I will probably look into this soon.
Though it is easier than OverLua, do you still need to be a masochist to use it effectively?

Youkakun 2013-05-01 02:13

Not really.
A big set of functions, good documentations and lot of commented examples should make it much much easier to learn and use than Overlua. A folder for autoloading scripts serves as external library place, so users can extend the environment and share this way their LVS extensions.

Youkakun 2013-10-06 19:24

LVS took his way to version v1.3, became more powerful + fast, bugs were fixed and tests made by creating typesets and karaoke effects.

One script for a simple karaoke effect could look like this:
Code:

-- Parse ASS file and fill global tables
ass.load("my_ktime.ass")

-- Roumaji & Kanji
local function roumaji_kanji(ctx, ms, line)
        -- Iterate through sylables
        for _, syl in ipairs(line.styleref.alignment < 7 and line.chars or line.syls) do        -- Use characters in case of kanjis
                -- Set color dependent on sylable activity
                ctx:set_source(ms >= syl.start_time and ms < syl.end_time and g2du.red or g2du.yellow)
                -- Draw sylable text
                ctx:path_add_text(syl.x, syl.y, syl.text, ass.unpack_font(line.styleref))
                ctx:fill()
                ctx:path_clear()
        end
end

-- Subtitle
local function subtitle(ctx, line)
        -- Draw line text
        ctx:path_add_text(line.x, line.y, line.text, ass.unpack_font(line.styleref))
        ctx:set_source(g2du.yellow)
        ctx:fill()
        ctx:path_clear()
end

-- Process frames
function GetFrame(frame, frame_i)
        -- Create drawing context for frame
        local ctx = frame:get_context()
        -- Get frame time
        local ms = frame_i / VIDEO_FPS * 1000
        -- Look for frame-related ASS lines
        for _, line in ipairs(lines) do
                if ms >= line.start_time and ms < line.end_time then
                        -- Draw ASS line
                        if line.styleref.alignment > 3 then
                                roumaji_kanji(ctx, ms, line)
                        else
                                subtitle(ctx, line)
                        end
                end
        end
end

It's just a color change of active sylables, but imagine to use gradients and pictures, invert frame colors, deform text like clay, use various convolution filters, work with audio data, etc.

More informations:
Online docs
Samples


All times are GMT -5. The time now is 00:01.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2015, vBulletin Solutions, Inc.