SilSinn9801
3rd May 2019, 03:29
I am using vsutils.py to try to overlay a sequence of transparent-background PNG visual effects on top of an opaque PNG logo screen:
from vapoursynth import core
import vsutils as vsu
import functools
import sys
vsufuncs = vsu.vsutils()
# Background logo
# 24-bit RGB (RGB888); using most recent version of FFMS2 to open PNG image
rawlogo = core.ffms2.Source(r'logo.png')
rawlogoframe = rawlogo.std.AssumeFPS(fpsnum=60000,fpsden=1001)
blackframe = rawlogoframe.std.BlankClip()
blackframeseq1 = blackframe*150
rawlogoseq = rawlogoframe*339
blackframeseq2 = blackframe*20
fadeinlogo = vsufuncs.FadeIn(rawlogoseq,1.685)
fadeoutlogo = vsufuncs.FadeOut(fadeinlogo,0.25)
logo = blackframeseq1+fadeoutlogo+blackframeseq2
# Overlaid VFX; 32-bit RGB+alpha (ARGB8888)
vfx00 = core.ffms2.Source(r'VFX__000.PNG')*118
vfx01 = core.ffms2.Source(r'VFX__118.PNG')*8
vfx02 = core.ffms2.Source(r'VFX__126.PNG')*18
vfx03 = core.ffms2.Source(r'VFX__144.PNG')*2
vfx04 = core.ffms2.Source(r'VFX__146.PNG')*2
vfx05 = core.ffms2.Source(r'VFX__148.PNG')*2
vfx06 = core.ffms2.Source(r'VFX__150.PNG')*2
vfx07 = core.ffms2.Source(r'VFX__152.PNG')*2
vfx08 = core.ffms2.Source(r'VFX__154.PNG')*2
vfx09 = core.ffms2.Source(r'VFX__156.PNG')*2
vfx10 = core.ffms2.Source(r'VFX__158.PNG')*2
vfx11 = core.ffms2.Source(r'VFX__160.PNG')*4
vfx12 = core.ffms2.Source(r'VFX__164.PNG')*2
vfx13 = core.ffms2.Source(r'VFX__166.PNG')*2
vfx14 = core.ffms2.Source(r'VFX__168.PNG')*2
vfx15 = core.ffms2.Source(r'VFX__170.PNG')*2
vfx16 = core.ffms2.Source(r'VFX__172.PNG')*2
vfx17 = core.ffms2.Source(r'VFX__174.PNG')*2
vfx18 = core.ffms2.Source(r'VFX__176.PNG')*2
vfx19 = core.ffms2.Source(r'VFX__178.PNG')*2
vfx20 = core.ffms2.Source(r'VFX__180.PNG')*2
vfx21 = core.ffms2.Source(r'VFX__182.PNG')*2
vfx22 = core.ffms2.Source(r'VFX__184.PNG')*2
vfx23 = core.ffms2.Source(r'VFX__186.PNG')*2
vfx24 = core.ffms2.Source(r'VFX__188.PNG')*2
vfx25 = core.ffms2.Source(r'VFX__190.PNG')*2
vfx26 = core.ffms2.Source(r'VFX__192.PNG')*4
vfx27 = core.ffms2.Source(r'VFX__196.PNG')*2
vfx28 = core.ffms2.Source(r'VFX__198.PNG')*2
vfx29 = core.ffms2.Source(r'VFX__200.PNG')*2
vfx30 = core.ffms2.Source(r'VFX__202.PNG')*2
vfx31 = core.ffms2.Source(r'VFX__204.PNG')*2
vfx32 = core.ffms2.Source(r'VFX__206.PNG')*3
vfx33 = core.ffms2.Source(r'VFX__210.PNG')*2
vfx34 = core.ffms2.Source(r'VFX__211.PNG')*2
vfx35 = core.ffms2.Source(r'VFX__213.PNG')*2
vfx36 = core.ffms2.Source(r'VFX__215.PNG')*4
vfx37 = core.ffms2.Source(r'VFX__219.PNG')*2
vfx38 = core.ffms2.Source(r'VFX__221.PNG')*4
vfx39 = core.ffms2.Source(r'VFX__225.PNG')*2
vfx40 = core.ffms2.Source(r'VFX__227.PNG')*2
vfx41 = core.ffms2.Source(r'VFX__229.PNG')*2
vfx42 = core.ffms2.Source(r'VFX__231.PNG')*2
vfx43 = core.ffms2.Source(r'VFX__233.PNG')*4
vfx44 = core.ffms2.Source(r'VFX__237.PNG')*2
vfx45 = core.ffms2.Source(r'VFX__239.PNG')*2
vfx46 = core.ffms2.Source(r'VFX__242.PNG')*2
vfx47 = core.ffms2.Source(r'VFX__243.PNG')*2
vfx48 = core.ffms2.Source(r'VFX__245.PNG')*2
vfx49 = core.ffms2.Source(r'VFX__247.PNG')*4
vfx50 = core.ffms2.Source(r'VFX__251.PNG')*2
vfx51 = core.ffms2.Source(r'VFX__253.PNG')*2
vfx52 = core.ffms2.Source(r'VFX__255.PNG')*2
vfx53 = core.ffms2.Source(r'VFX__257.PNG')*2
vfx54 = core.ffms2.Source(r'VFX__259.PNG')*2
vfx55 = core.ffms2.Source(r'VFX__261.PNG')*2
vfx56 = core.ffms2.Source(r'VFX__263.PNG')*4
vfx57 = core.ffms2.Source(r'VFX__267.PNG')*2
vfx58 = core.ffms2.Source(r'VFX__269.PNG')*2
vfx59 = core.ffms2.Source(r'VFX__271.PNG')*2
vfx60 = core.ffms2.Source(r'VFX__273.PNG')*2
vfx61 = core.ffms2.Source(r'VFX__275.PNG')*2
vfx62 = core.ffms2.Source(r'VFX__277.PNG')*2
vfx63 = core.ffms2.Source(r'VFX__279.PNG')*4
vfx64 = core.ffms2.Source(r'VFX__283.PNG')*4
vfx65 = core.ffms2.Source(r'VFX__287.PNG')*2
vfx66 = core.ffms2.Source(r'VFX__289.PNG')*2
vfx67 = core.ffms2.Source(r'VFX__291.PNG')*2
vfx68 = core.ffms2.Source(r'VFX__293.PNG')*2
vfx69 = core.ffms2.Source(r'VFX__295.PNG')*2
vfx70 = core.ffms2.Source(r'VFX__297.PNG')*2
vfx71 = core.ffms2.Source(r'VFX__299.PNG')*3
vfx72 = core.ffms2.Source(r'VFX__302.PNG')*3
vfx73 = core.ffms2.Source(r'VFX__305.PNG')*2
vfx74 = core.ffms2.Source(r'VFX__307.PNG')*3
vfx75 = core.ffms2.Source(r'VFX__310.PNG')*2
vfx76 = core.ffms2.Source(r'VFX__312.PNG')*2
vfx77 = core.ffms2.Source(r'VFX__314.PNG')*2
vfx78 = core.ffms2.Source(r'VFX__316.PNG')*2
vfx79 = core.ffms2.Source(r'VFX__318.PNG')*4
vfx80 = core.ffms2.Source(r'VFX__322.PNG')*2
vfx81 = core.ffms2.Source(r'VFX__324.PNG')*2
vfx82 = core.ffms2.Source(r'VFX__326.PNG')*4
vfx83 = core.ffms2.Source(r'VFX__330.PNG')*2
vfx84 = core.ffms2.Source(r'VFX__332.PNG')*2
vfx85 = core.ffms2.Source(r'VFX__334.PNG')*4
vfx86 = core.ffms2.Source(r'VFX__338.PNG')*2
vfx87 = core.ffms2.Source(r'VFX__000.PNG')*169
vfxseq = vfx00+vfx01+vfx02+vfx03+vfx04+vfx05+vfx06+vfx07+vfx08+vfx09+ \
vfx10+vfx11+vfx12+vfx13+vfx14+vfx15+vfx16+vfx17+vfx18+vfx19+ \
vfx20+vfx21+vfx22+vfx23+vfx24+vfx25+vfx26+vfx27+vfx28+vfx29+ \
vfx30+vfx31+vfx32+vfx33+vfx34+vfx35+vfx36+vfx37+vfx38+vfx39+ \
vfx40+vfx41+vfx42+vfx43+vfx44+vfx45+vfx46+vfx47+vfx48+vfx49+ \
vfx50+vfx51+vfx52+vfx53+vfx54+vfx55+vfx56+vfx57+vfx58+vfx59+ \
vfx60+vfx61+vfx62+vfx63+vfx64+vfx65+vfx66+vfx67+vfx68+vfx69+ \
vfx70+vfx71+vfx72+vfx73+vfx74+vfx75+vfx76+vfx77+vfx78+vfx79+ \
vfx80+vfx81+vfx82+vfx83+vfx84+vfx85+vfx86+vfx87
vfx = vfxseq.std.AssumeFPS(fpsnum=60000,fpsden=1001)
# Overlay VFX on top of background logo
finallogo = vsufuncs.Overlay(logo,vfx,0,0)
finallogo.set_output()
But rather than seeing the logo behind the VFX, I only see the VFX alone, as if the VFX’s transparent background were converted to black.
Any insights on this? Maybe shall I use raw code rather than Overlay() and extract different mask data for the VFX overlay?
from vapoursynth import core
import vsutils as vsu
import functools
import sys
vsufuncs = vsu.vsutils()
# Background logo
# 24-bit RGB (RGB888); using most recent version of FFMS2 to open PNG image
rawlogo = core.ffms2.Source(r'logo.png')
rawlogoframe = rawlogo.std.AssumeFPS(fpsnum=60000,fpsden=1001)
blackframe = rawlogoframe.std.BlankClip()
blackframeseq1 = blackframe*150
rawlogoseq = rawlogoframe*339
blackframeseq2 = blackframe*20
fadeinlogo = vsufuncs.FadeIn(rawlogoseq,1.685)
fadeoutlogo = vsufuncs.FadeOut(fadeinlogo,0.25)
logo = blackframeseq1+fadeoutlogo+blackframeseq2
# Overlaid VFX; 32-bit RGB+alpha (ARGB8888)
vfx00 = core.ffms2.Source(r'VFX__000.PNG')*118
vfx01 = core.ffms2.Source(r'VFX__118.PNG')*8
vfx02 = core.ffms2.Source(r'VFX__126.PNG')*18
vfx03 = core.ffms2.Source(r'VFX__144.PNG')*2
vfx04 = core.ffms2.Source(r'VFX__146.PNG')*2
vfx05 = core.ffms2.Source(r'VFX__148.PNG')*2
vfx06 = core.ffms2.Source(r'VFX__150.PNG')*2
vfx07 = core.ffms2.Source(r'VFX__152.PNG')*2
vfx08 = core.ffms2.Source(r'VFX__154.PNG')*2
vfx09 = core.ffms2.Source(r'VFX__156.PNG')*2
vfx10 = core.ffms2.Source(r'VFX__158.PNG')*2
vfx11 = core.ffms2.Source(r'VFX__160.PNG')*4
vfx12 = core.ffms2.Source(r'VFX__164.PNG')*2
vfx13 = core.ffms2.Source(r'VFX__166.PNG')*2
vfx14 = core.ffms2.Source(r'VFX__168.PNG')*2
vfx15 = core.ffms2.Source(r'VFX__170.PNG')*2
vfx16 = core.ffms2.Source(r'VFX__172.PNG')*2
vfx17 = core.ffms2.Source(r'VFX__174.PNG')*2
vfx18 = core.ffms2.Source(r'VFX__176.PNG')*2
vfx19 = core.ffms2.Source(r'VFX__178.PNG')*2
vfx20 = core.ffms2.Source(r'VFX__180.PNG')*2
vfx21 = core.ffms2.Source(r'VFX__182.PNG')*2
vfx22 = core.ffms2.Source(r'VFX__184.PNG')*2
vfx23 = core.ffms2.Source(r'VFX__186.PNG')*2
vfx24 = core.ffms2.Source(r'VFX__188.PNG')*2
vfx25 = core.ffms2.Source(r'VFX__190.PNG')*2
vfx26 = core.ffms2.Source(r'VFX__192.PNG')*4
vfx27 = core.ffms2.Source(r'VFX__196.PNG')*2
vfx28 = core.ffms2.Source(r'VFX__198.PNG')*2
vfx29 = core.ffms2.Source(r'VFX__200.PNG')*2
vfx30 = core.ffms2.Source(r'VFX__202.PNG')*2
vfx31 = core.ffms2.Source(r'VFX__204.PNG')*2
vfx32 = core.ffms2.Source(r'VFX__206.PNG')*3
vfx33 = core.ffms2.Source(r'VFX__210.PNG')*2
vfx34 = core.ffms2.Source(r'VFX__211.PNG')*2
vfx35 = core.ffms2.Source(r'VFX__213.PNG')*2
vfx36 = core.ffms2.Source(r'VFX__215.PNG')*4
vfx37 = core.ffms2.Source(r'VFX__219.PNG')*2
vfx38 = core.ffms2.Source(r'VFX__221.PNG')*4
vfx39 = core.ffms2.Source(r'VFX__225.PNG')*2
vfx40 = core.ffms2.Source(r'VFX__227.PNG')*2
vfx41 = core.ffms2.Source(r'VFX__229.PNG')*2
vfx42 = core.ffms2.Source(r'VFX__231.PNG')*2
vfx43 = core.ffms2.Source(r'VFX__233.PNG')*4
vfx44 = core.ffms2.Source(r'VFX__237.PNG')*2
vfx45 = core.ffms2.Source(r'VFX__239.PNG')*2
vfx46 = core.ffms2.Source(r'VFX__242.PNG')*2
vfx47 = core.ffms2.Source(r'VFX__243.PNG')*2
vfx48 = core.ffms2.Source(r'VFX__245.PNG')*2
vfx49 = core.ffms2.Source(r'VFX__247.PNG')*4
vfx50 = core.ffms2.Source(r'VFX__251.PNG')*2
vfx51 = core.ffms2.Source(r'VFX__253.PNG')*2
vfx52 = core.ffms2.Source(r'VFX__255.PNG')*2
vfx53 = core.ffms2.Source(r'VFX__257.PNG')*2
vfx54 = core.ffms2.Source(r'VFX__259.PNG')*2
vfx55 = core.ffms2.Source(r'VFX__261.PNG')*2
vfx56 = core.ffms2.Source(r'VFX__263.PNG')*4
vfx57 = core.ffms2.Source(r'VFX__267.PNG')*2
vfx58 = core.ffms2.Source(r'VFX__269.PNG')*2
vfx59 = core.ffms2.Source(r'VFX__271.PNG')*2
vfx60 = core.ffms2.Source(r'VFX__273.PNG')*2
vfx61 = core.ffms2.Source(r'VFX__275.PNG')*2
vfx62 = core.ffms2.Source(r'VFX__277.PNG')*2
vfx63 = core.ffms2.Source(r'VFX__279.PNG')*4
vfx64 = core.ffms2.Source(r'VFX__283.PNG')*4
vfx65 = core.ffms2.Source(r'VFX__287.PNG')*2
vfx66 = core.ffms2.Source(r'VFX__289.PNG')*2
vfx67 = core.ffms2.Source(r'VFX__291.PNG')*2
vfx68 = core.ffms2.Source(r'VFX__293.PNG')*2
vfx69 = core.ffms2.Source(r'VFX__295.PNG')*2
vfx70 = core.ffms2.Source(r'VFX__297.PNG')*2
vfx71 = core.ffms2.Source(r'VFX__299.PNG')*3
vfx72 = core.ffms2.Source(r'VFX__302.PNG')*3
vfx73 = core.ffms2.Source(r'VFX__305.PNG')*2
vfx74 = core.ffms2.Source(r'VFX__307.PNG')*3
vfx75 = core.ffms2.Source(r'VFX__310.PNG')*2
vfx76 = core.ffms2.Source(r'VFX__312.PNG')*2
vfx77 = core.ffms2.Source(r'VFX__314.PNG')*2
vfx78 = core.ffms2.Source(r'VFX__316.PNG')*2
vfx79 = core.ffms2.Source(r'VFX__318.PNG')*4
vfx80 = core.ffms2.Source(r'VFX__322.PNG')*2
vfx81 = core.ffms2.Source(r'VFX__324.PNG')*2
vfx82 = core.ffms2.Source(r'VFX__326.PNG')*4
vfx83 = core.ffms2.Source(r'VFX__330.PNG')*2
vfx84 = core.ffms2.Source(r'VFX__332.PNG')*2
vfx85 = core.ffms2.Source(r'VFX__334.PNG')*4
vfx86 = core.ffms2.Source(r'VFX__338.PNG')*2
vfx87 = core.ffms2.Source(r'VFX__000.PNG')*169
vfxseq = vfx00+vfx01+vfx02+vfx03+vfx04+vfx05+vfx06+vfx07+vfx08+vfx09+ \
vfx10+vfx11+vfx12+vfx13+vfx14+vfx15+vfx16+vfx17+vfx18+vfx19+ \
vfx20+vfx21+vfx22+vfx23+vfx24+vfx25+vfx26+vfx27+vfx28+vfx29+ \
vfx30+vfx31+vfx32+vfx33+vfx34+vfx35+vfx36+vfx37+vfx38+vfx39+ \
vfx40+vfx41+vfx42+vfx43+vfx44+vfx45+vfx46+vfx47+vfx48+vfx49+ \
vfx50+vfx51+vfx52+vfx53+vfx54+vfx55+vfx56+vfx57+vfx58+vfx59+ \
vfx60+vfx61+vfx62+vfx63+vfx64+vfx65+vfx66+vfx67+vfx68+vfx69+ \
vfx70+vfx71+vfx72+vfx73+vfx74+vfx75+vfx76+vfx77+vfx78+vfx79+ \
vfx80+vfx81+vfx82+vfx83+vfx84+vfx85+vfx86+vfx87
vfx = vfxseq.std.AssumeFPS(fpsnum=60000,fpsden=1001)
# Overlay VFX on top of background logo
finallogo = vsufuncs.Overlay(logo,vfx,0,0)
finallogo.set_output()
But rather than seeing the logo behind the VFX, I only see the VFX alone, as if the VFX’s transparent background were converted to black.
Any insights on this? Maybe shall I use raw code rather than Overlay() and extract different mask data for the VFX overlay?