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 > VapourSynth

Reply
 
Thread Tools Search this Thread Display Modes
Old 3rd May 2019, 05:11   #21  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,921
Quote:
Originally Posted by SilSinn9801 View Post
The two-test script worked fine, with vfx[0] giving me the normal image and vfx[1] giving me the alpha represented as black.
vfx[1] should be black and white

Quote:
I now get this new error:
If you're loading as an array of RGB + alpha, you need to specify if it's using [0] or [1] . Those newer versions require alpha = True to load the alpha. So just omit that for the RGB background

If you're loading both (it will be a "dummy" alpha) . Since you want the RGB background, it should be [0]

rawlogoframe = core.std.AssumeFPS(rawlogo[0],fpsnum=60000,fpsden=1001)
poisondeathray is offline   Reply With Quote
Old 3rd May 2019, 05:28   #22  |  Link
SilSinn9801
Chiptuner & VapourSynther
 
SilSinn9801's Avatar
 
Join Date: Mar 2019
Location: Scarlet Devil Mansion, Gensōkyō
Posts: 31
Quote:
Originally Posted by poisondeathray View Post
vfx[1] should be black and white
Yes, it was binary black and white (monochrome).

Quote:
Originally Posted by poisondeathray View Post
If you're loading as an array of RGB + alpha, you need to specify if it's using [0] or [1] . Those newer versions require alpha = True to load the alpha. So just omit that for the RGB background

If you're loading both (it will be a "dummy" alpha) . Since you want the RGB background, it should be [0]

rawlogoframe = core.std.AssumeFPS(rawlogo[0],fpsnum=60000,fpsden=1001)
I now get a new, different error when applying HolyWus Overlay:
Quote:
Avisynth open failure:
Python exception: List index out of bounds

Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 1927, in vapoursynth.vpy_evaluateScript
File "src\cython\vapoursynth.pyx", line 1928, in vapoursynth.vpy_evaluateScript
File "C:\(fakepath)\Script.vpy", line 134, in <module>
finallogo = haf.Overlay(logo,vfx[0],mask=vfx[1])
File "src\cython\vapoursynth.pyx", line 1402, in vapoursynth.VideoNode.__getitem__
IndexError: List index out of bounds
SilSinn9801 is offline   Reply With Quote
Old 3rd May 2019, 05:32   #23  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,921
Quote:
Originally Posted by SilSinn9801 View Post

I now get a new, different error when applying HolyWu’s Overlay:

Avisynth open failure:
Python exception: List index out of bounds

Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 1927, in vapoursynth.vpy_evaluateScript
File "src\cython\vapoursynth.pyx", line 1928, in vapoursynth.vpy_evaluateScript
File "C:\(fakepath)\Script.vpy", line 134, in <module>
finallogo = haf.Overlay(logo,vfx[0],mask=vfx[1])
File "src\cython\vapoursynth.pyx", line 1402, in vapoursynth.VideoNode.__getitem__
IndexError: List index out of bounds
If you're loading the alpha for "logo" you need to specify [0] or [1] . You want [0] for RGB

finallogo = haf.Overlay(logo[0],vfx[0],mask=vfx[1])
poisondeathray is offline   Reply With Quote
Old 3rd May 2019, 05:35   #24  |  Link
SilSinn9801
Chiptuner & VapourSynther
 
SilSinn9801's Avatar
 
Join Date: Mar 2019
Location: Scarlet Devil Mansion, Gensōkyō
Posts: 31
Quote:
Originally Posted by poisondeathray View Post
If you're loading the alpha for "logo" you need to specify [0] or [1] . You want [0] for RGB

finallogo = haf.Overlay(logo[0],vfx[0],mask=vfx[1])
I am not using alpha for logo.
SilSinn9801 is offline   Reply With Quote
Old 3rd May 2019, 05:36   #25  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,921
Quote:
Originally Posted by SilSinn9801 View Post
I am not using alpha for logo.
Then don't load it. Use alpha=False or omit it for ffms2 for the logo

Use alpha=True for vfx ffms2 loading
poisondeathray is offline   Reply With Quote
Old 3rd May 2019, 05:49   #26  |  Link
SilSinn9801
Chiptuner & VapourSynther
 
SilSinn9801's Avatar
 
Join Date: Mar 2019
Location: Scarlet Devil Mansion, Gensōkyō
Posts: 31
Quote:
Originally Posted by poisondeathray View Post
Then don't load it. Use alpha=False or omit it for ffms2 for the logo

Use alpha=True for vfx ffms2 loading
Even with alpha=False for logo and alpha=True for each vfx image, I get the same error, and I am suspecting why:

Did you see above on my original script that I was repeating each VFX frame by either 2, 3, or 4 (using the * operator) and then concatenating all repeated frames together (with the + operator)? When trying separately vfx00[0].set_output(), vfx01[0].set_output(), vfx02[0].set_output(), … and vfx00[1].set_output(), vfx01[1].set_output(), vfx02[1].set_output(), …, I am not getting repeated frames, but rather single frames at the output. Is there some other way to repeat a frame without using the * operator?

Last edited by SilSinn9801; 3rd May 2019 at 05:50. Reason: alpha=True for each vfx on original script at the start of the thread
SilSinn9801 is offline   Reply With Quote
Old 3rd May 2019, 05:59   #27  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,921
Quote:
Originally Posted by SilSinn9801 View Post
Is there some other way to repeat a frame without using the * operator?
Loop
http://www.vapoursynth.com/doc/functions/loop.html

Last edited by poisondeathray; 3rd May 2019 at 06:05.
poisondeathray is offline   Reply With Quote
Old 3rd May 2019, 06:08   #28  |  Link
SilSinn9801
Chiptuner & VapourSynther
 
SilSinn9801's Avatar
 
Join Date: Mar 2019
Location: Scarlet Devil Mansion, Gensōkyō
Posts: 31
Quote:
Originally Posted by poisondeathray View Post
Using Loop:
Code:
vfx00 = core.std.Loop(vfx00, times=118)
I get error:
Quote:
Python exception: Loop: argument clip is not of array type but more than one value was supplied
SilSinn9801 is offline   Reply With Quote
Old 3rd May 2019, 06:15   #29  |  Link
SilSinn9801
Chiptuner & VapourSynther
 
SilSinn9801's Avatar
 
Join Date: Mar 2019
Location: Scarlet Devil Mansion, Gensōkyō
Posts: 31
Apparently, for Loop not to crash, I have to issue the Loop command individually for both [0] and [1]:
Code:
vfx00[0] = core.std.Loop(vfx00[0], times=118)
vfx00[1] = core.std.Loop(vfx00[1], times=118)
So my code will get more tedious since I have to deal with 88 different VFX frames.
SilSinn9801 is offline   Reply With Quote
Old 3rd May 2019, 06:16   #30  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,921
You have to divide up the RGB, and alpha

eg.

Code:
clip = core.ffms2.Source(r'VFX__172.PNG', alpha=True)
clip2rgb = clip[0] * 30
clip2alpha = clip[1] * 30

clip2rgb.set_output()
#clip2alpha.set_output()
poisondeathray is offline   Reply With Quote
Old 3rd May 2019, 06:18   #31  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,921
Quote:
Originally Posted by SilSinn9801 View Post
So my code will get more tedious since I have to deal with 88 different VFX frames.
I must say that avisynth handles it much better from a user standpoint...

There might be some 'python magic' that can simplify this
poisondeathray is offline   Reply With Quote
Old 3rd May 2019, 06:23   #32  |  Link
SilSinn9801
Chiptuner & VapourSynther
 
SilSinn9801's Avatar
 
Join Date: Mar 2019
Location: Scarlet Devil Mansion, Gensōkyō
Posts: 31
Quote:
Originally Posted by poisondeathray View Post
I must say that avisynth handles it much better from a user standpoint...

There might be some 'python magic' that can simplify this
Yes, I was originally an avisynth user, but got tired of it being non-Unicode-aware (and tired of having to either rename my sources to ASCII only or move them to ASCII-only filepaths).
SilSinn9801 is offline   Reply With Quote
Old 3rd May 2019, 06:52   #33  |  Link
HolyWu
Registered User
 
HolyWu's Avatar
 
Join Date: Aug 2006
Location: Taiwan
Posts: 639
Since we are in python scripting, you can simply define a helper function for convenience.

Code:
def loop_vfx(c, times):
    c[0] = c[0] * times
    c[1] = c[1] * times
    return c

vfx00 = loop_vfx(core.ffms2.Source('VFX__000.png', alpha=True), 118)
vfx01 = loop_vfx(core.ffms2.Source('VFX__118.png', alpha=True), 8)
vfx02 = loop_vfx(core.ffms2.Source('VFX__126.png', alpha=True), 18)
HolyWu is offline   Reply With Quote
Old 3rd May 2019, 07:01   #34  |  Link
SilSinn9801
Chiptuner & VapourSynther
 
SilSinn9801's Avatar
 
Join Date: Mar 2019
Location: Scarlet Devil Mansion, Gensōkyō
Posts: 31
Quote:
Originally Posted by HolyWu View Post
Since we are in python scripting, you can simply define a helper function for convenience.

Code:
def loop_vfx(c, times):
    c[0] = c[0] * times
    c[1] = c[1] * times
    return c

vfx00 = loop_vfx(core.ffms2.Source('VFX__000.png', alpha=True), 118)
vfx01 = loop_vfx(core.ffms2.Source('VFX__118.png', alpha=True), 8)
vfx02 = loop_vfx(core.ffms2.Source('VFX__126.png', alpha=True), 18)
Thanks. And I imagine I would have to do something similar for concatenating the various vfx## clips together with the + operator.

Finally got the result I desired. Thankee for all your support.
SilSinn9801 is offline   Reply With Quote
Reply

Tags
overlay, transparency, transparent, vapoursynth, vsutils

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 11:09.


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