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 August 2022, 02:06   #1  |  Link
SilSinn9801
Chiptuner & VapourSynther
 
SilSinn9801's Avatar
 
Join Date: Mar 2019
Location: Scarlet Devil Mansion, Gensōkyō
Posts: 52
vapoursynth.VideoNode object does not support item assignment

Three years ago (or maybe more), HolyWu had written some helper function for looping still images with RGB & alpha layers:
Code:
# HolyWu's helper function for looping an RGB+alpha still image
def loop_vfx(c, times):
	c[0] = c[0] * times
	c[1] = c[1] * times
	return c
I used this code in four VapourSynth R45 projects & was now trying to use it in a R59 project when I now get these warnings & errors in VapourSynth Editor r19:
Code:
2022-08-16 20:45:59.749
setVideoInfo: Video filter Source has more than one output node but only the first one will be returned
setVideoInfo: Video filter Source has more than one output node but only the first one will be returned
2022-08-16 20:45:59.797
Failed to evaluate the script:
Python exception: 'vapoursynth.VideoNode' object does not support item assignment

Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 2890, in vapoursynth._vpy_evaluate
File "src\cython\vapoursynth.pyx", line 2891, in vapoursynth._vpy_evaluate
File "D:\fakepath\TH09_07.VPY", line 54, in 
ChanLabelLoop = loop_vfx(ChannelLabels,9156)
File "D:\fakepath\TH09_07.VPY", line 12, in loop_vfx
c[0] = c[0] * times
TypeError: 'vapoursynth.VideoNode' object does not support item assignment

2022-08-16 20:45:59.888
Core freed but 1 filter instance(s) still exist
Core freed but 1 filter instance(s) still exist
For context, this is part of the script I’m trying to run that uses HolyWu’s loop_vfx function:
Code:
import vapoursynth as vs
from vapoursynth import core
import vsutils as vsu
import havsfunc as haf
import functools
import sys
import math
vsufuncs = vsu.vsutils()

# HolyWu's helper function for looping an RGB+alpha still image
def loop_vfx(c, times):
	c[0] = c[0] * times
	c[1] = c[1] * times
	return c

# corrscope oscilloscope video
Corrscope     = core.ffms2.Source(r'E:\corrscope\TH09_07.MKV') # 60 fps, RGB
CorrscopeCrop = Corrscope[8626:17782] # total 9156 frames
# corrscope channel-label overlay (RGB+alpha)
ChannelLabels = core.ffms2.Source(r'E:\corrscope\5FM+3SSG+ADPCM+RHY.png',alpha=True)
ChanLabelLoop = loop_vfx(ChannelLabels,9156) #invoking here HolyWu’s function
ChanLabelRGB  = ChanLabelLoop[0].std.AssumeFPS(fpsnum=60,fpsden=1)
ChanLabelMask = ChanLabelLoop[1].std.AssumeFPS(fpsnum=60,fpsden=1) # match frame rate to corrscope video
# Overlay channel labels onto corrscope segment
Loop2 = haf.Overlay(CorrscopeCrop,ChanLabelRGB,mask=ChanLabelMask)
Loop2.set_output()
This code above would’ve worked fine under VapourSynth R45, but under R59 it refuses to work now.
__________________
SilSinn9801 a.k.a. Silent Sinner in Scarlet
Discord: silsinn9801
Matrix: silsinn9821:matrix.org
YouTube: https://youtube.com/SilentSinnerInScarlet
ニコニコ動画: https://nicovideo.jp/user/68029427

Last edited by SilSinn9801; 17th August 2022 at 09:38. Reason: linking back to the only surviving quote of HolyWu’s loop_vfx function (after he deleted all of his posts on this forum)
SilSinn9801 is offline   Reply With Quote
Old 17th August 2022, 03:14   #2  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 305
Quote:
ChannelLabels = core.ffms2.Source(r'E:\corrscope\5FM+3SSG+ADPCM+RHY.png',alpha=True)
ChanLabelLoop = loop_vfx(ChannelLabels,9156) #invoking here HolyWu’s function
loop_vfx() needs a tuple, that c variable. Looks like ffms2.Source returned a vs.VideoNode
_Al_ is offline   Reply With Quote
Old 17th August 2022, 09:13   #3  |  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
loop_vfx() needs a tuple, that c variable. Looks like ffms2.Source returned a vs.VideoNode
OK so how do I now fix this? If ffms2.Source originally returned a two-element tuple whenever alpha=True but now returns vs.VideoNode instead, how do I now turn that VideoNode into a tuple? Or, how do I now extract the RGB & alpha masks from it to loop them like individual images?

Google-searching both FFMS2 & VideoNode terms together doesn’t give me anything meaningful.

EDIT: Even the current GitHub documentation says nothing at all about Source putting out VideoNodes, it still says that an array of two clips is output with alpha=True.
__________________
SilSinn9801 a.k.a. Silent Sinner in Scarlet
Discord: silsinn9801
Matrix: silsinn9821:matrix.org
YouTube: https://youtube.com/SilentSinnerInScarlet
ニコニコ動画: https://nicovideo.jp/user/68029427

Last edited by SilSinn9801; 17th August 2022 at 09:30. Reason: EDIT: linking the GitHub FFMS2 documentation
SilSinn9801 is offline   Reply With Quote
Old 17th August 2022, 10:07   #4  |  Link
SilSinn9801
Chiptuner & VapourSynther
 
SilSinn9801's Avatar
 
Join Date: Mar 2019
Location: Scarlet Devil Mansion, Gensōkyō
Posts: 52
Quote:
setVideoInfo: Video filter Source has more than one output node but only the first one will be returned
setVideoInfo: Video filter Source has more than one output node but only the first one will be returned
This is probably key to this conundrum: it admits that Source is generating more than one output (the RGB output & the alpha output) but only the first output (RGB) is being returned to the variable ChannelLabels. Historically under R45, this ChannelLabels variable would become autodeclared a 2-element array (collecting both RGB & alpha outputs from Source) that could be indexed with [0] or [1] to get RGB or alpha, respectively. But now here under R59, the same variable is instead being forced to be declared as a single-element scalar storing only the RGB output, & the alpha is being mysteriously thrown away.
__________________
SilSinn9801 a.k.a. Silent Sinner in Scarlet
Discord: silsinn9801
Matrix: silsinn9821:matrix.org
YouTube: https://youtube.com/SilentSinnerInScarlet
ニコニコ動画: https://nicovideo.jp/user/68029427
SilSinn9801 is offline   Reply With Quote
Old 17th August 2022, 11:36   #5  |  Link
DJATOM
Registered User
 
DJATOM's Avatar
 
Join Date: Sep 2010
Location: Ukraine, Bohuslav
Posts: 377
Alpha plane is now stored as frame property (_Alpha), use PropToClip for access.
__________________
Me on GitHub
PC Specs: Ryzen 5950X, 64 GB RAM, RTX 2070
DJATOM is offline   Reply With Quote
Old 18th August 2022, 08:13   #6  |  Link
SilSinn9801
Chiptuner & VapourSynther
 
SilSinn9801's Avatar
 
Join Date: Mar 2019
Location: Scarlet Devil Mansion, Gensōkyō
Posts: 52
Quote:
Originally Posted by DJATOM View Post
Alpha plane is now stored as frame property (_Alpha), use PropToClip for access.
OK so I now rewrote the code as this (now discarding that obsoleted HolyWu helper function):
Code:
import vapoursynth as vs
from vapoursynth import core
import vsutils as vsu
import havsfunc as haf
import functools
import sys
import math
vsufuncs = vsu.vsutils()

# corrscope oscilloscope video (640×400p, 60 fps, FFV1, RGB)
Corrscope     = core.ffms2.Source(r'E:\corrscope\TH09_07.MKV')
CorrscopeCrop = Corrscope[8626:17782] # total 9156 frames
# corrscope channel-label overlay (640×400, PNG, RGB+alpha)
ChannelLabels = core.ffms2.Source(r'E:\corrscope\5FM+3SSG+ADPCM+RHY.png',fpsnum=60,fpsden=1,alpha=True)
ChanLabelRGB  = ChannelLabels.std.Loop(9156)
ChanLabelMask = ChannelLabels.std.PropToClip(prop='_Alpha').std.Loop(9156)
# Overlay channel text labels onto corrscope segment
Loop2 = haf.Overlay(CorrscopeCrop,ChanLabelRGB,mask=ChanLabelMask)
Loop2.set_output()
& now I get a different error message & still get the same warning about FFMS2.Source having two or more output nodes but only returning one:
Code:
2022-08-18 03:00:52.404
setVideoInfo: Video filter Source has more than one output node but only the first one will be returned
setVideoInfo: Video filter Source has more than one output node but only the first one will be returned
2022-08-18 03:00:52.409
Failed to evaluate the script:
Python exception: PropToClip: no frame stored in property: _Alpha

Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 2890, in vapoursynth._vpy_evaluate
File "src\cython\vapoursynth.pyx", line 2891, in vapoursynth._vpy_evaluate
File "D:\fakepath\TH09_07.VPY", line 58, in 
ChanLabelMask = ChannelLabels.std.PropToClip(prop='_Alpha').std.Loop(9156)
File "src\cython\vapoursynth.pyx", line 2636, in vapoursynth.Function.__call__
vapoursynth.Error: PropToClip: no frame stored in property: _Alpha

2022-08-18 03:00:52.430
Core freed but 1 filter instance(s) still exist
Core freed but 1 filter instance(s) still exist
Core freed but 768192 bytes still allocated in framebuffers
Core freed but 768192 bytes still allocated in framebuffers
What should I do now about this? I am now using PropToClip to get the alpha out of that transparent PNG image being read by FFMS2.Source (& I made sure the PNG –which is attached to this reply for reference– is saved in full RGB mode & not in palette-indexed mode) yet apparently the output from FFMS2.Source has no _Alpha property at all, & also for the record I am using the most recent version of FFMS2 found on its GitHub page (version 2.40 released almost two years ago).
Attached Images
 
__________________
SilSinn9801 a.k.a. Silent Sinner in Scarlet
Discord: silsinn9801
Matrix: silsinn9821:matrix.org
YouTube: https://youtube.com/SilentSinnerInScarlet
ニコニコ動画: https://nicovideo.jp/user/68029427

Last edited by SilSinn9801; 18th August 2022 at 08:53. Reason: clarify that I’m trying to get the alpha out of the PNG with PropToClip but instead it says the clip has no _Alpha property
SilSinn9801 is offline   Reply With Quote
Old 18th August 2022, 09:11   #7  |  Link
SilSinn9801
Chiptuner & VapourSynther
 
SilSinn9801's Avatar
 
Join Date: Mar 2019
Location: Scarlet Devil Mansion, Gensōkyō
Posts: 52
OK so now I found this:
https://www.vapoursynth.com/2021/09/...d-performance/
Quote:
Compatibility and breaking changes
  • The alpha handling has changed and attaching the alpha as an additional frame is now the preferred method.
What this means in practice is that 99% of all plugins works properly. The only known ones that don’t work well are FFMS2 and IMWRI when outputting alpha. Update your plugins and there shouldn’t be any surprises.
So the big change in how alpha is handled happened in R55 (September 2021) while the last published version of FFMS2 dates to August 2020. So, if FFMS2 is now useless to me for RGB+alpha PNG sources, then what should I use now in its place?
__________________
SilSinn9801 a.k.a. Silent Sinner in Scarlet
Discord: silsinn9801
Matrix: silsinn9821:matrix.org
YouTube: https://youtube.com/SilentSinnerInScarlet
ニコニコ動画: https://nicovideo.jp/user/68029427
SilSinn9801 is offline   Reply With Quote
Old 18th August 2022, 09:49   #8  |  Link
SilSinn9801
Chiptuner & VapourSynther
 
SilSinn9801's Avatar
 
Join Date: Mar 2019
Location: Scarlet Devil Mansion, Gensōkyō
Posts: 52
OK, nevermind, there was a newer, unofficial build dated April 2022:
https://forum.doom9.org/showthread.p...96#post1967796
This one does send alpha to the _Alpha property instead of making cliptuple. So my code above now works.
__________________
SilSinn9801 a.k.a. Silent Sinner in Scarlet
Discord: silsinn9801
Matrix: silsinn9821:matrix.org
YouTube: https://youtube.com/SilentSinnerInScarlet
ニコニコ動画: https://nicovideo.jp/user/68029427
SilSinn9801 is offline   Reply With Quote
Reply

Tags
holywu, item assignment, loop_vfx, vapoursynth r59, videonode

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 00:42.


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