Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 29th December 2017, 18:28   #1  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,345
premultiply (alpha channel) for avisynth ?

Is there an avisynth equivalent of premultiply ? I can find an unpremultiply plugin

Background: certain programs might not have the ability to interpret certain types of alpha channel or premultiply on the fly - in those cases you can apply the filter externally

eg . ffmpeg has it
https://ffmpeg.org/ffmpeg-filters.html#premultiply

eg. vapoursynth has it
http://www.vapoursynth.com/doc/funct...emultiply.html

Both work in my tests
poisondeathray is offline   Reply With Quote
Old 29th December 2017, 19:52   #2  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,493
I think you can use Layer onto a blankclip (might have to merge the alpha back in afterwards).
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 29th December 2017, 20:14   #3  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,345
Quote:
Originally Posted by davidhorman View Post
I think you can use Layer onto a blankclip (might have to merge the alpha back in afterwards).

Thanks David.

I tried some layer() combos, op="mul" , etc..., no luck and my google and avisynth kung fu isn't that great . I think I'm missing something simple


Perhaps a test example - Here is simple animation exported from aviutl (lagarith, RGBA, 3.2MB)
http://www.mediafire.com/file/9pjqh8...9sq/aviutl.avi

Programs like vdub, avspmod , a handful of others may interpret the alpha channel incorrectly, as a result you get "ratty", aliased edges. There are no other export options for the alpha in aviutl

On import, other programs like AE can interpret with premultipled black, or ffmpeg or vapoursynth can apply the premultiply so it can be interpreted correctly and look correct

eg.
ffmpeg premultiply
Code:
ffmpeg -i aviutl.avi -vf premultiply=inplace=1 -an -c:v png ffmpeg_premultiply_png.mov
vpy premultiply
Code:
import vapoursynth as vs
core = vs.get_core()
video = core.avisource.AVISource(r'F:\aviutl.avi', alpha=True)
p =  core.std.PreMultiply(video[0], video[1])
p.set_output()
poisondeathray is offline   Reply With Quote
Old 29th December 2017, 20:24   #4  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,493
Code:
avisource("aviutl.avi")

layer(blankclip(last),last,op="add")
Looks like it preserves alpha.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 29th December 2017, 20:27   #5  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,345
^ ahhh it's "add". Yes it works . Thanks
poisondeathray is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:13.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.