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. |
|
|
Thread Tools | Search this Thread | Display Modes |
9th May 2020, 10:28 | #1 | Link |
Pig on the wing
Join Date: Mar 2002
Location: Finland
Posts: 5,718
|
Semi-automatic way to tweak thscd1 and thscd2 in mvtools?
As the VS version of mvtools does not have the MShow functionality to visualize the motion vectors, I'm having problems tweaking the scene change threshold parameters. Noisy or material having a lot of fast movement is troublesome as they usually require raising the thresholds, otherwise they detect a lot of scene changes in places where it's not true.
I came up with an idea to do the degraining with a range of values for thscd1 or thscd2, maybe with 10 point steps or so. Use MakeDiff to extract the difference between the original and degrained clip. Display the different results along with the original in the same frame (downscaled or simply just cut a small part of the frame to show because you can easily see if no noise is removed). Could someone help me with scripting this visualization, please? Or port MShow
__________________
And if the band you're in starts playing different tunes I'll see you on the dark side of the Moon... |
9th May 2020, 13:03 | #3 | Link |
Pig on the wing
Join Date: Mar 2002
Location: Finland
Posts: 5,718
|
Cheers, didn't remember/know that there's a function in the pack to provide this info
__________________
And if the band you're in starts playing different tunes I'll see you on the dark side of the Moon... |
9th May 2020, 17:15 | #4 | Link |
Pig on the wing
Join Date: Mar 2002
Location: Finland
Posts: 5,718
|
I've worked it over like this, getting the property value for different thscd values. But I'm stumped with the current frame number, which is needed in get_frame. How do I get that one?
Code:
thscd = 100 sc = [] while thscd < 400 : finalclip = core.mv.SCDetection(src, fv1, thscd1=thscd, thscd2=80) scframe = finalclip.get_frame(n) sc.append(scframe.props['_SceneChangePrev']) thscd += 10
__________________
And if the band you're in starts playing different tunes I'll see you on the dark side of the Moon... |
9th May 2020, 17:45 | #5 | Link |
I'm Siri
Join Date: Oct 2012
Location: void
Posts: 2,633
|
why don't you print frame properties directly on your video clip?
you can then check them in the preview window of vsedit |
9th May 2020, 18:01 | #6 | Link |
Pig on the wing
Join Date: Mar 2002
Location: Finland
Posts: 5,718
|
I was thinking of printing the result of all tests in the same frame along with the corresponding thscd value. Or is it possible with FrameProps?
__________________
And if the band you're in starts playing different tunes I'll see you on the dark side of the Moon... |
9th May 2020, 18:43 | #8 | Link |
Pig on the wing
Join Date: Mar 2002
Location: Finland
Posts: 5,718
|
The problem is printing all values in the same frame. In that example, I would check thscd between 100-400 in steps of 10 and print the result of each of them in the same frame. In a real case, I'd probably have a range over 240-350 or something like that.
__________________
And if the band you're in starts playing different tunes I'll see you on the dark side of the Moon... |
9th May 2020, 18:50 | #10 | Link | |
Registered User
Join Date: Dec 2005
Location: Germany
Posts: 1,795
|
Quote:
Simple example for detecting a blinking clock. (n is your current frame number) https://forum.doom9.org/showthread.p...19#post1906719 http://www.vapoursynth.com/doc/functions/frameeval.html or if you just want to "scan" the whole video before filtering Code:
for i in range(clip.num_frames): clip.get_frame(i)
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth VapourSynth Portable FATPACK || VapourSynth Database |
|
9th May 2020, 19:02 | #11 | Link |
I'm Siri
Join Date: Oct 2012
Location: void
Posts: 2,633
|
I don't wanna write the code cuz it's boring, but basically you do the following
1. let n = 0 2. evaluate the clip with mv.SCDetection 3. attach scd1_n, scd2_n as frame props 4. let _SceneChangePrev_n = _SceneChangePrev, _SceneChangeNext_n = _SceneChangeNext 5. attach _SceneChangePrev_n, _SceneChangeNext_n as frame props 6. erase _SceneChangePrev, _SceneChangeNext from frame props 7. n = n + 1 8. repeat 2. ~ 7. with different scd1 and scd2 9. print all frame props |
9th May 2020, 19:21 | #12 | Link |
Registered User
Join Date: May 2011
Posts: 321
|
Do you want to print frame value together with all possible props['_SceneChangePrev'] values in one frame from that loop?
then put those values directly in that sc list right away, text.Text() accepts new lines to generate n for each frame it is up to you as Chaos King says, if using FrameEval and put you loop thing in it, where n is passed for your convenience Code:
def using_eval(n, clip): thscd = 100 sc = [] while thscd < 400 : finalclip = core.mv.SCDetection(clip, fv1, thscd1=thscd, thscd2=80) scframe = finalclip.get_frame(n) sc.append( str(thscd) + ' , ' + str(scframe.props['_SceneChangePrev']) ) thscd += 10 return core.text.Text( clip, '\n'.join(sc), alignment=7) src = core.text.FrameNum(src, alignment=8) out = core.std.FrameEval(src, functools.partial(using_eval, clip=src)) Last edited by _Al_; 10th May 2020 at 03:52. |
9th May 2020, 21:18 | #13 | Link |
Pig on the wing
Join Date: Mar 2002
Location: Finland
Posts: 5,718
|
Thanks everyone, I'll do some testing tomorrow when I have more time.
It would be easy if the current frame number could be extracted like clip width or height but looks like it needs some more complex ways.
__________________
And if the band you're in starts playing different tunes I'll see you on the dark side of the Moon... |
10th May 2020, 10:38 | #14 | Link | |
Pig on the wing
Join Date: Mar 2002
Location: Finland
Posts: 5,718
|
Quote:
Need to test some more, I think I should try to find a nice baseline for my needs.
__________________
And if the band you're in starts playing different tunes I'll see you on the dark side of the Moon... |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|