Hello Selur,
good news! I found an effective way to stabilize the clip's colors by using the filter
AverageFrames.
Unfortunately I cannot add it in my filter because in not working if called inside a vpy filter.
So this filter must be managed directly in Hybrid's GUI.
This filter act as a temporal filter since the average is performed both on past and future frames.
The type of average can be controlled using the weights, the max number of weights is 31, and must be used a (integer) odd number of weights because it is used a central average.
It is better add this filter as a
post process filter in the "
Coloring" page.
The options to be added are:
1) Number of frames (integer, max 31)
2) The type of average: Central Average, Left Average (only past frames), Right Average (only future frames)
3) Scene Change detection (boolean): if true in the case of change scene detection the future frames are not used
Weight computation:
Given N the number of frames detected [if N%2==0: N+=1, N=min(N,31)]
The
lateral weights can be calculated as: Wi=trunc(100/N)
Then the
central weight can be calculated as: Wc=100-(N-1)*Wi
Supposing N=11, we have:
Wi=trunc(100/11)=9
Wc=100-9*10=10.
Example of "Central Average" with 11 frames
Code:
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="709", range_s="limited", dither_type="error_diffusion")
clip = core.misc.AverageFrames(clip, [9, 9, 9, 9, 9, 10, 9, 9, 9, 9, 9], scale=100, scenechange = True, planes=[1,2])
Example of "Left Average" with 11 frames
Code:
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="709", range_s="limited", dither_type="error_diffusion")
clip = core.misc.AverageFrames(clip, [17, 17, 17, 17, 17, 15, 0, 0, 0, 0, 0], scale=100, scenechange = True, planes=[1,2])
Example of "Right Average" with 11 frames
Code:
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="709", range_s="limited", dither_type="error_diffusion")
clip = core.misc.AverageFrames(clip, [0, 0, 0, 0, 0, 15, 7, 17, 17, 17, 17], scale=100, scenechange = True, planes=[1,2])
The Average must be performed on
YUV color-space, using only the plans "U","V", because we are interested in stabilize the
chroma components.
The attached file
VideoTest_small1_DV+DD_AF31C.zip is an example of result obtained using a "Central Average" with 31 frames and scenechange =False, using the code
Code:
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="709", range_s="limited", dither_type="error_diffusion")
clip = core.misc.AverageFrames(clip, [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 10, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3], scale=100, scenechange = False, planes=[1,2])
As reference I attached also the file
VideoTest_small1_DV+DD.zip that was obtained using the default settings
Code:
from vsdeoldify import ddeoldify
clip = ddeoldify(clip=clip)
I hope that you will include this filter Hybrid.
Thanks,
Dan