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 17th April 2019, 08:38   #1  |  Link
SilSinn9801
Chiptuner & VapourSynther
 
SilSinn9801's Avatar
 
Join Date: Mar 2019
Location: Scarlet Devil Mansion, Gensōkyō
Posts: 52
Fade-in, fade-out, crossfade/transition, and video overlay on VapourSynth?

How do I implement these video effects on VapourSynth?
  1. 100-frame-long fade-in (from solid black) of a frame-repeated still image (or a video clip)
  2. 15-frame-long fade-out (to solid black) of the same still image (or video clip) above
  3. 45-frame-long crossfade (or transition) from one still image to another (or from one video clip to another)
  4. Overlaying a video clip (or repeated image, possibly with the fade-in above first applied to it) onto another video clip (or repeated image)
Thankee!
SilSinn9801 is offline   Reply With Quote
Old 17th April 2019, 09:20   #2  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
A good start would be checking these out
- FadeEachFrame, FadeOut/In: https://github.com/jeremypoulter/vsutils
- crossfade: https://github.com/Irrational-Encodi...ardry/kagefunc
- colorfade: https://github.com/tormaid/colorfade
- transition https://forum.doom9.org/showthread.php?t=172594
- Overlay https://github.com/HomeOfVapourSynth...sfunc.py#L5072
Can't provide a sample right now.
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database

Last edited by ChaosKing; 17th April 2019 at 09:22.
ChaosKing is offline   Reply With Quote
Old 17th April 2019, 17:29   #3  |  Link
SilSinn9801
Chiptuner & VapourSynther
 
SilSinn9801's Avatar
 
Join Date: Mar 2019
Location: Scarlet Devil Mansion, Gensōkyō
Posts: 52
So they're Python-script libraries of functions which I would need to import into my script (with the import command?) before using them.

Thankee! This is a good start for now for a project of my own.

As for other types of clip-to-clip (or image-to-image) transitions (like blinds, dissolve, shutter, etc.) usually offered by payware video editors (like CyberLink PowerDirector), any idea if some sort of genius managed to implement them in VS?

I am also interested in some type of legacy crossfade technique used on some MS-DOS-era PC games (both IBM-PC/AT and NEC PC-9801 classes); an example of such crossfade can be found in the opening sequence of ZUN's 5th Toho game (Mystic Square), when a simple purple background (with a yin-yang orb) slowly transitions to a full artwork with the game title and a sitting miko to the left of the orb.
SilSinn9801 is offline   Reply With Quote
Old 17th April 2019, 19:12   #4  |  Link
Tormaid
Registered User
 
Tormaid's Avatar
 
Join Date: Dec 2011
Posts: 24
Have a look at the internal dissolve function in my colorfade script (linked above). It would work with static images looped over a range or a moving clip. Other implementations of this that I've looked at don't seem to align the input clips correctly so that the fade is linear across the entire transition (i.e. the first frame of the transition is 100% clip A and the last is 100% clip B).
Tormaid is offline   Reply With Quote
Old 29th April 2019, 21:12   #5  |  Link
SilSinn9801
Chiptuner & VapourSynther
 
SilSinn9801's Avatar
 
Join Date: Mar 2019
Location: Scarlet Devil Mansion, Gensōkyō
Posts: 52
Quote:
Originally Posted by ChaosKing View Post
A good start would be checking these out
- FadeEachFrame, FadeOut/In: https://github.com/jeremypoulter/vsutils
- crossfade: https://github.com/Irrational-Encodi...ardry/kagefunc
- colorfade: https://github.com/tormaid/colorfade
- transition https://forum.doom9.org/showthread.php?t=172594
- Overlay https://github.com/HomeOfVapourSynth...sfunc.py#L5072
Can't provide a sample right now.
Hello again, I am having troubles importing such Python scripts (I am first trying vsutils.py) into my main script. Here is what I have:
Code:
from vapoursynth import core
import vsutils as vsu
import functools
# 24-bit RGB (RGB888); using most recent version of FFMS2 to open PNG image
TSArawlogo = core.ffms2.Source(r'TeamShanghaiAlice.png')
TSArawlogoseq = TSArawlogo.std.AssumeFPS(fpsnum=60000,fpsden=1001)*339
TSAfadeinlogo = vsu.FadeIn(TSArawlogoseq,1.685)
TSAfadeoutlogo = vsu.FadeOut(TSAfadeinlogo,0.25)
# Simulate 12-bit RGB (RGB444) by integer-dividing all RGB values by 16 (#10h)
# then multiplying them by 17 (#11h)
rgb444logo = TSAfadeinlogo.std.Expr(expr=["x 16 /", "x 16 /", "x 16 /"])
rgb888logo = rgb444logo.std.Expr(expr=["x 17 *", "x 17 *", "x 17 *"])

rgb888logo.set_output()
I get this error when opening the script (which I provisionally named Danmaku.vpy) with VirtualDub2:
Quote:
Avisynth open failure:
Python exception: No module named 'vsutils'

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)\Danmaku.vpy", line 2, in <module>
import vsutils as vsu
ModuleNotFoundError: No module named 'vsutils'
I have vsutils.py stored in the same folder as all the user plugins (C:\Program Files (x86)\VapourSynth\plugins64 for x64 machines like mine). Should I load vsutils.vs from a different path? Thankee!

Last edited by SilSinn9801; 29th April 2019 at 21:33. Reason: After studying the HAvsFunc example by HolyWu (https://forum.doom9.org/showthread.php?t=166582), I revert the prior edit.
SilSinn9801 is offline   Reply With Quote
Old 29th April 2019, 21:27   #6  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
Quote:
Originally Posted by SilSinn9801 View Post
How do I implement these video effects on VapourSynth?
  1. 100-frame-long fade-in (from solid black) of a frame-repeated still image (or a video clip)
  2. 15-frame-long fade-out (to solid black) of the same still image (or video clip) above
  3. 45-frame-long crossfade (or transition) from one still image to another (or from one video clip to another)
  4. Overlaying a video clip (or repeated image, possibly with the fade-in above first applied to it) onto another video clip (or repeated image)
Thankee!
I would use the right tool for the right job.
I think what you need is an NLE.
Cary Knoop is offline   Reply With Quote
Old 30th April 2019, 00:46   #7  |  Link
SilSinn9801
Chiptuner & VapourSynther
 
SilSinn9801's Avatar
 
Join Date: Mar 2019
Location: Scarlet Devil Mansion, Gensōkyō
Posts: 52
Quote:
Originally Posted by Cary Knoop View Post
I would use the right tool for the right job.
I think what you need is an NLE.
What kind of NLE are you talking about? Because if it doesn’t let me do vintage-PC-style transitions (or restrict colors to an archaic 12-bit RGB colorspace), then it is useless to me. I have been using CyberLink PowerDirector 15 for a few years and for one project in particular I don’t want to use it (because its transitions look way too modern to me)

Last edited by SilSinn9801; 30th April 2019 at 00:46. Reason: missing pronoun
SilSinn9801 is offline   Reply With Quote
Old 30th April 2019, 00:51   #8  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
Quote:
Originally Posted by SilSinn9801 View Post

I have vsutils.py stored in the same folder as all the user plugins (C:\Program Files (x86)\VapourSynth\plugins64 for x64 machines like mine). Should I load vsutils.vs from a different path?
put it in the python => lib => site-packages folder
poisondeathray is offline   Reply With Quote
Old 30th April 2019, 03:52   #9  |  Link
SilSinn9801
Chiptuner & VapourSynther
 
SilSinn9801's Avatar
 
Join Date: Mar 2019
Location: Scarlet Devil Mansion, Gensōkyō
Posts: 52
Quote:
Originally Posted by poisondeathray View Post
put it in the python => lib => site-packages folder
I think HolyWu mentioned this on his havsfunc.py readme. I’ll give it a try and see if it works for me.
SilSinn9801 is offline   Reply With Quote
Old 1st May 2019, 00:39   #10  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 321
Quote:
Originally Posted by SilSinn9801 View Post
I think HolyWu mentioned this on his havsfunc.py readme. I’ll give it a try and see if it works for me.
This is a Python thing, not Vapoursynth. Dll's on the other hand belong to Vapoursynth. When importing a modul it is searched by Python in directories that are stored in sys.path. You can try yourself, run this something.py script:
import sys
print(sys.path)
it could be current directory and bunch of others.
After you install Vapoursynth you have also Vapoursynth directory in site-packages directory, so it might be a good idea to always put those py moduls into that directory.
On linux, like Ubuntu, you search for site-packages, it can be behind your home/username, down the path.
_Al_ is offline   Reply With Quote
Old 2nd May 2019, 01:50   #11  |  Link
SilSinn9801
Chiptuner & VapourSynther
 
SilSinn9801's Avatar
 
Join Date: Mar 2019
Location: Scarlet Devil Mansion, Gensōkyō
Posts: 52
Quote:
Originally Posted by _Al_ View Post
This is a Python thing, not Vapoursynth. Dll's on the other hand belong to Vapoursynth. When importing a modul it is searched by Python in directories that are stored in sys.path. You can try yourself, run this something.py script:
import sys
print(sys.path)
it could be current directory and bunch of others.
After you install Vapoursynth you have also Vapoursynth directory in site-packages directory, so it might be a good idea to always put those py moduls into that directory.
On linux, like Ubuntu, you search for site-packages, it can be behind your home/username, down the path.
What about .VPY scripts (like YoloCR.vpy, etc.)? Shall they go into the same path as the .PY scripts?
SilSinn9801 is offline   Reply With Quote
Old 2nd May 2019, 02:18   #12  |  Link
SilSinn9801
Chiptuner & VapourSynther
 
SilSinn9801's Avatar
 
Join Date: Mar 2019
Location: Scarlet Devil Mansion, Gensōkyō
Posts: 52
Quote:
Originally Posted by poisondeathray View Post
put it in the python => lib => site-packages folder
I put vsutils.py into the folder you told me. Now I get this new error:
Quote:
Avisynth open failure:
Python exception: module 'vsutils' has no attribute 'FadeIn'

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)\Danmaku.vpy", line 7, in <module>
TSAfadeinlogo = vsu.FadeIn(TSArawlogoseq,1.685)
ModuleNotFoundError: module 'vsutils' has no attribute 'FadeIn'
What am I doing wrong now?
SilSinn9801 is offline   Reply With Quote
Old 2nd May 2019, 03:45   #13  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 321
Quote:
Originally Posted by SilSinn9801 View Post
What about .VPY scripts (like YoloCR.vpy, etc.)? Shall they go into the same path as the .PY scripts?
.vpy is just vapoursynth script, not Python script, but you can name them .py and using them as a modul , importing them, but then you'd need to follow other python "stuff" to get output or use its functions, attributes. The key is to learn Python and then it just comes together.
But .py is not understood by VirtualDub2 for example, only .vpy . vspipe has no problem with .py

Quote:
import vsutils as vsu
TSAfadeinlogo = vsu.FadeIn(TSArawlogoseq,1.685)

ModuleNotFoundError: module 'vsutils' has no attribute 'FadeIn'
in Python it means, that vsutils.py have to have function FadeIn:
def FadeIn(....):
is it in there? It is also case sensitive.

edit: I just downloaded vsutils.py and that has a Class vsutils, so try to instantiate that Class first and then call it:
my_edits = vsu.vsutils()
TSAfadeinlogo = my_edits.FadeIn(TSArawlogoseq,1.685)

Last edited by _Al_; 2nd May 2019 at 03:58.
_Al_ is offline   Reply With Quote
Old 2nd May 2019, 04:58   #14  |  Link
SilSinn9801
Chiptuner & VapourSynther
 
SilSinn9801's Avatar
 
Join Date: Mar 2019
Location: Scarlet Devil Mansion, Gensōkyō
Posts: 52
Quote:
Originally Posted by _Al_ View Post
in Python it means, that vsutils.py have to have function FadeIn:
def FadeIn(....):
is it in there? It is also case sensitive.

edit: I just downloaded vsutils.py and that has a Class vsutils, so try to instantiate that Class first and then call it:
my_edits = vsu.vsutils()
TSAfadeinlogo = my_edits.FadeIn(TSArawlogoseq,1.685)
Just did your suggestion and now it works! Thankee! Now I can finish my secret project for Reitaisai!
SilSinn9801 is offline   Reply With Quote
Reply

Tags
crossfade, fade-in, fade-out, overlay, transition

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 22:27.


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