zorr
3rd March 2019, 22:44
I need to perform per frame brightness adjustments so that every frame has different adjustment settings. In Avisynth this can be done with ScriptClip.
I tried this code (as a proof-of-concept) but it doesn't change the output.
def adjust_brightness(n, f):
fout = f.copy()
fout = core.std.Expr(clips=[fout], expr=['x 2 *', ''])
return fout
core.std.ModifyFrame(clip=v1, clips=v1, selector=adjust_brightness)
Is that kind of code supposed to work? I think comes down to whether you can call filters within ModifyFrame and have them return the modified frame.
If it's not supported what is a good workaround? Do I have to split the clip into len(clip) one frame length clips and process them individually without ModifyFrame?
[EDIT] I just noticed that there was an error:
Expr: argument clips was passed an unsupported type (expected clip[] compatible type but got VideoFrame)
So that can't work because f is a VideoFrame and not a clip. Is it possible to create a clip out of a VideoFrame?
I tried this code (as a proof-of-concept) but it doesn't change the output.
def adjust_brightness(n, f):
fout = f.copy()
fout = core.std.Expr(clips=[fout], expr=['x 2 *', ''])
return fout
core.std.ModifyFrame(clip=v1, clips=v1, selector=adjust_brightness)
Is that kind of code supposed to work? I think comes down to whether you can call filters within ModifyFrame and have them return the modified frame.
If it's not supported what is a good workaround? Do I have to split the clip into len(clip) one frame length clips and process them individually without ModifyFrame?
[EDIT] I just noticed that there was an error:
Expr: argument clips was passed an unsupported type (expected clip[] compatible type but got VideoFrame)
So that can't work because f is a VideoFrame and not a clip. Is it possible to create a clip out of a VideoFrame?