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. |
21st November 2018, 12:36 | #1 | Link |
Registered User
Join Date: Jul 2002
Posts: 241
|
Adding/using dither/ GradFun3 to VirtualDub2
So, Hello_Hello, in this thread:
https://forum.doom9.org/showthread.p...27#post1858027 suggested to use GradFun3 to try and improve an encode from another thread It seems to not be there by default: Code:
--------------------------- VirtualDub Error --------------------------- Avisynth open failure: Script error: there is no function named "GradFun3" (L:\Open_Filter_test.avs, line 4) --------------------------- OK --------------------------- http://ldesoras.free.fr/prod.html#src_ditheravsi any chance someone knows how to "install" or "use" this, within VirtualDub2 ? Inside are 2 dlls in win32/win64, as well as top level avsi scripts, but no clear indication how to "put this in the path" or have VD2 load them on startup or via a script? I do have other AVS scripts that work fine... this thing looks different than a plugin or an external encoder, so not sure where/how to use it Stormy. |
21st November 2018, 18:34 | #3 | Link |
Registered User
Join Date: Mar 2011
Posts: 4,829
|
Now I feel a bit obligated....
If you have Avisynth installed you can put plugins in the Avisynth/plugins folder and Avisynth will auto-load them each time it runs. 32 bit versions of plugins for 32 bit Avisynth and the 64 bit versions for 64 bit Avisynth. It's probably less hassle to use 32 bit versions of plugins and 32 bit Avisynth, at least for the moment, so here's 32 bit instructions..... You need dither.dll and avstp.dll from the win32 folder in the zip file. The included scripts also need to be in the plugins folder (dither.avis and mt_multi_expand.avis). If you open dither.avis with Notepad you'll see the GradFun3() function if you scroll down a bit, so you definitely need it. Avisynth scripts can include functions, and often they contain nothing but functions (give it a couple of days and you'll probably be experimenting with creating your own ). If a script has an avis extension and it's in the plugins folder, Avisynth will auto-load it too. The "dither package" requires additional plugins, and there's often many versions to ensure confusion, and plugins can have dependencies of their own, but I sense you're committed and can't turn back now..... AddGrainC needs to be in the Avisynth/plugins folder. It requires the Microsoft Visual C++ 2012 Redistributable Package. There's a link for it on the AddGrainC page in case you need to install it. Dfttest.dll should be in the Avisynth/plugins folder. For additional funkiness, Dfttest requires libfftw3f-3.dll, but it's not an Avisynth plugin. Download fftw-3.3.5-dll32.zip from here. libfftw3f-3.dll is inside. The 32 bit version needs to be in the Windows\SysWOW64 folder if you run a 64 bit flavour of Windows. For 32 bit Windows, it needs to be in the windows\system32 folder. There's a few plugins that require libfftw3f-3.dll, but sometimes with a different name, so make a copy of libfftw3f-3.dll and rename it fftw3.dll. Put fftw3.dll in the SysWOW64 or system32 folder as appropriate along with libfftw3f-3.dll. RgTools is a required plugin and needs to be in the Avisynth/plugins folder. RgTools requires Microsoft Visual C++ Redistributable for Visual Studio 2017. There's a link on the RGTools page if you don't have it already. mvtools2 is required. Download it here. Copy the x86 version of mvtools2.dll to the Avisynth/plugins folder. Don't be afraid to do the same for Depan.dll and DepanEstimate.dll. You don't need them now but you will sooner or later. Microsoft Visual C++ Redistributable 2015 Update 3 is a requirement for that flavour of mvtools2. Masktools2.dll should be in the Avisynth/plugins folder too. To be honest I'd forgotten the whole dither tools package required that much work, but I've done most of it, and all that's left is a bit of downloading for you to do. Don't be put off. Many Avisynth functions use the above plugins and once they're working they'll keep working. No doubt you'll need additional plugins down the road (my Avisynth/plugins folder contains around 80 avsi scripts and 50+ dlls), but you'll be off to a pretty good start once this is done, and relative to getting VD's external encoder option to work, it's fairly easy to do. Last edited by hello_hello; 22nd November 2018 at 11:25. |
23rd November 2018, 15:27 | #4 | Link |
Registered User
Join Date: Jul 2002
Posts: 241
|
Well, Hello^2...
Although I'm very determined overall, I think you've (grossly) over-estimated the "determination" going this route - in a fun way Trying to simplify things as much as possible however, since your nice/long/detailed response, decided to try it anyways, followed all steps.. I cannot believe if it's that complex why no1 zipped it all up but then possibly there are so many things that can go wrong, hence each one needs to dig their own hole even noticed broken download links on this: http://www.fftw.org/install/windows.html Tried something like this: Code:
Vid = DirectShowSource("Y:\test.MOV", audio=false) Vid = GradFun3(thr=0.25) Code:
--------------------------- VirtualDub Error --------------------------- Avisynth open failure: Script error: Invalid arguments to function "GradFun3" (Y:\open_Filter_test.avs, line 4) --------------------------- OK --------------------------- maybe one day, until then, I'll just take the default filters and live with it or expand the filesize to make it look better. Thanks so much! Stormy |
23rd November 2018, 16:44 | #5 | Link | |
Registered User
Join Date: Sep 2007
Posts: 5,377
|
Quote:
Code:
Vid = DirectShowSource("Y:\test.MOV", audio=false) Vid = GradFun3(Vid, thr=0.25) Because you have variable = something, you don't have an implied "last" This would work too, because now you have implied "last" Code:
DirectShowSource("Y:\test.MOV", audio=false) GradFun3( thr=0.25) Code:
DirectShowSource("Y:\test.MOV", audio=false) GradFun3(last, thr=0.25) Last edited by poisondeathray; 23rd November 2018 at 16:48. |
|
23rd November 2018, 17:16 | #6 | Link |
Registered User
Join Date: Jul 2002
Posts: 241
|
oohhh.... wow, thanks for that rather basic and embarrassing avisynth lesson it then fails with this:
Code:
--------------------------- VirtualDub Error --------------------------- Avisynth open failure: SmoothGrad: input must be planar. (dither.avsi, line 1704) (dither.avsi, line 1685) (dither.avsi, line 114) (L:\Open_Filter_test.avs, line 4) --------------------------- OK --------------------------- Thanks much for everyone's help! hopefully this will help other brave folks Stormy. |
23rd November 2018, 17:25 | #7 | Link |
Registered User
Join Date: Sep 2007
Posts: 5,377
|
What is your source MOV ? what does mediainfo say about it?
The problem with DirectShowSource() , is it relies on your system installed codecs . So computer A might return something different than computer B. It can be quite unreliable , and has all sorts of problems with seeking What does info() say about what DirectShowSource() is returning ? Code:
DirectShowSource("Y:\test.MOV", audio=false) Info() It might be as simple as adding ConvertToYV12(matrix="rec709") , but it might be the wrong thing to do depending on what the source is Code:
DirectShowSource("Y:\test.MOV", audio=false) ConvertToYV12(matrix="rec709") GradFun3( thr=0.25) |
23rd November 2018, 20:09 | #8 | Link | |
Registered User
Join Date: Mar 2011
Posts: 4,829
|
You're so close now you must be able to hear the fat lady warming up.
Quote:
It's partly because everything's in a constant state of flux. For example, QTGMC is a very good de-interlacing script that requires quite a few plugins (all of the plugins you just installed are either requirements or necessary for some of it's options) and there was a link to a plugin package in the opening post of the original QTGMC thread. I think it's still there, because someone new to QTGMC at VideoHelp used it not so long ago, but the plugins are quite old and the latest version of the script won't work with some of them. I created a new plugins package for it about a year ago, and despite the fact the link is buried in the middle of the QTGMC thread somewhere it's been download over 600 times, but the problem with plugin packages is they need to be maintained. Anyway... LSMASHSource.dll should be in the "MeGUI\tools\lsmash" folder, if you haven't deleted MeGUI. Make a copy and put it in your Avisynth plugins folder (assuming you have the 32 bit version of MeGUI). I don't think mov files need indexing as such, so try this first. LSmashVideoSource("Y:\test.MOV") Failing that.... It'll probably take several seconds to open because it'll index first. LWLibavVideoSource("Y:\test.MOV") Last edited by hello_hello; 24th November 2018 at 03:00. |
|
24th November 2018, 10:04 | #11 | Link |
Registered User
Join Date: Jul 2002
Posts: 241
|
wow, I deeply appreciate your replies to this thread, sounds like you're some sort of experts or created this maze yourself so as to trap us in this forever
Seems you are having so much fun, and I'm now on a road with no return.. follow the white rabbit, so: Info() shows: Code:
Colorspace: YUY2 1280x720 FPS: 59.9402 Code:
Colorspace: YV12 1280x720 FPS: 59.9401 Code:
LSmashVideoSource("Y:\test.MOV") Info() GradFun3() now, maybe that is expected, and even appears in the "fine print", that you cannot preview the magic before encoding, but really, impossible to edit in such a way, the preview is critical Using my very old and basic skills of avisyth, attempted to do PIP, b/c that always helped decide/understand how things/filters/operations really behave, if it was me, all examples would be like that, to show original video and processed, attempted something like: Code:
vid1 = LSmashVideoSource("Y:\test.MOV") vid2 = LSmashVideoSource("Y:\test.MOV") vid2 = GradFun3(vid2) vid2 = vid2.ReduceBy2() xpos = 0 ypos = 0 Overlay(vid1, vid2, mode="blend", opacity=100) Then replaced Lsmash with the direct show, and still things were super sluggish, and then noticed even older scripts are not working anymore (cannot seek, VD2 goes into cpu loop).. so possibly all these changes caused the system's codecs to change or something, or maybe that's how it was before and i just didn't notice??? I think i'll call it a day for this, since again, this is not my day job. will now focus on trying to get the original PIP scripts working again.. my use case is extremely limited in scope, just mux mov and mp3 I deeply appreciate your help, but not sure being on the cutting edge is for me, since I don't have the background (yet) for all these terms, etc. I think i need to reboot maybe it may clear things up, not sure... Cheers.... Stormy. |
25th November 2018, 11:40 | #12 | Link |
Registered User
Join Date: Mar 2011
Posts: 4,829
|
I'd be very surprised if LSmash converted the colorspace. It has an option for doing so but you have to specify it. It's far more likely DirectShow was converting it. If you uploaded a small sample somewhere it'd speed up the process of finding the problem considerably. It's just a guessing game otherwise.
Could I be so bold as to condense your script a bit? It shouldn't have anything to do with the problem displaying the overlayed video. I don't know why that's happening. Code:
vid1 = LSmashVideoSource("Y:\test.MOV") vid2 = Vid1.GradFun3().ReduceBy2() Overlay(vid1, vid2, x=0, y=0, mode="blend", opacity=100) Code:
vid1 = LSmashVideoSource("Y:\test.MOV").Spline36Resize(640,360) # any resizing optional vid2 = Vid1.GradFun3() StackVertical(vid1, vid2) # or StackHorizontal Last edited by hello_hello; 28th November 2018 at 09:26. |
26th November 2018, 11:08 | #13 | Link |
Registered User
Join Date: Jul 2002
Posts: 241
|
I have to admit, by this time almost forgot what GradFun3() is all about... but the "StackedVertical" got my attention, so, tried again, and new day, new luck!!!!
Rewrote the split to put the ORIGINAL smaller: Code:
vid1 = LSmashVideoSource("Y:\test.MOV") vid2 = vid1.GradFun3() vid1 = vid1.ReduceBy2().Info() Overlay(vid2, vid1, x=0, y=0, mode="blend", opacity=1) So, it DOES work, but... no fat lady was singing To be honest, without looking with a microscope, the two images look the same, so changed to Code:
GradFun3(thr=1000) anyways, Thanks for everyone's positive support and help... it was a journey, and now can mark checkbox been there, done that on GradFun3(), so I'm good until someone comes up with GradFun4() Stormy. |
26th November 2018, 12:18 | #14 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Something to play with, choose your own values for Thr and ThrC
Code:
LSmashVideoSource("Y:\test.MOV") # clip is assigned to special variable Last ####### Config ######## THR = 1.2 # Default 1.2 (pick your own after check) THRC = 1.2 # Default 1.2 DOSUB = True # True, put subtitles, else not ORIGSIZE = True # Reduce stacked size to same as input source ####### Result = GradFun3(Thr=THR , ThrC=THRC) # Calling GradFun3 with Special Last clip and assign result to Result #Return Result # return Result clip if uncommented d1 = ClipDelta(Result,Last,Amp=False) # Subtract Last clip from Result d2 = ClipDelta(Result,Last,Amp=True) # Subtract Last clip from Result, and amplify Last = (DOSUB) ? TSub(Last ,"Source" ,True,$0000AA) : Last # If DOSUB then Last is subtitled with FrameNumber on blueish bar, else no change Result = (DOSUB) ? TSub(Result ,"Result") : Result # If DOSUB then Result is subtitled else no change d1 = (DOSUB) ? TSub(d1 ,"Difference") : d1 # If DOSUB then d1 is subtitled else no change d2 = (DOSUB) ? TSub(d2 ,"Diff, AMP'ed") : d2 # If DOSUB then d2 is subtitled else no change Lft = Stackvertical(Last,Result) # Source Stacked above Result Rgt = Stackvertical(d1,d2) # d1 Stacked above d2 StackHorizontal(Lft,Rgt) # Stacked x 4, is assigned to Last clip W = Width # Width of Last clip (same as W=Last.Width) H = Height W = W / 2 # As for original source width H = H / 2 Last = (ORIGSIZE) ? Spline36Resize(W,H) : Last # If ORIGSIZE then downsize, else no change Return Last # End Of Script, returning Last clip ######################## # Return Clip Difference of input clips (amp==true = Amplified, show==true = show background) Function ClipDelta(clip clip1,clip clip2,bool "amp",bool "show") { amp=Default(amp,false) show=Default(show,false) c2=clip1.levels(128-32,1.0,128+32,128-32,128+32).greyscale() c1=clip1.subtract(clip2) c1=(amp)?c1.levels(127,1.0,129,0,255):c1 return (show)?c1.Merge(c2):c1 } # Stack Overhead Subtitle Text, with optional FrameNumber shown. Function TSub(clip c,string Tit,Bool "ShowFrameNo",Int "Col"){ c.BlankClip(height=20,Color=Default(Col,0)) (Default(ShowFrameNo,False))?ScriptClip("""Subtitle(String(current_frame,"%.f] """+Tit+""""))"""):Subtitle(Tit) Return StackVertical(c).AudioDubEx(c) }
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
26th November 2018, 12:47 | #15 | Link |
Registered User
Join Date: Jul 2002
Posts: 241
|
So much power floating unaccounted for.. Thanks StainlessS... Very impressive 4 split, I'll clearly need to study this topic/area a bit more.. very nice output!!!
Thanks Hello*2 for "insisting" and providing all the earlier setup details... Need to figure out what to do with this seemingly powerful tool |
26th November 2018, 13:47 | #16 | Link |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
I find flash3kyuu_deband much more effective than any of the GradFun implementations. Also, much better detail retention. Just my 2c.
__________________
Groucho's Avisynth Stuff |
26th November 2018, 14:52 | #17 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
I dont think I've every tried any debanding whotsit, but am quite sure that I have both script functions, maybe I'll givem a try one day.
Stormy, I'll leave it to you to mod this line with the flash3 thingy, "Result = GradFun3(Thr=THR , ThrC=THRC)", and to change config to whatever args it uses, and similarly supply in the flashy function call. Hope that the script function requirement dont differ too much from Gradfun3, but even if there are some additional plugs required, there will come a time when you have pretty much all the major plugs set up, and most things will become a lot easier. If you want a quick easy reference for avisynth, see Stainless@MediaFire below this post, in the DATA directory there is a compressed help file (*.chm), can put on a hot key for instant access. Study the entire docs set, and you will soon become quite proficient, good luck.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
26th November 2018, 15:08 | #18 | Link | |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
Quote:
Edit: Here's another good test clip
__________________
Groucho's Avisynth Stuff Last edited by Groucho2004; 26th November 2018 at 15:13. |
|
26th November 2018, 17:38 | #19 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Hey G2K4, you got dat dare f3kdb thing, seems to be bit AWOL, only the Github source seems available, and I dont really fancy trying to compile that lot.
Maybe someone should archive it somewhere, and post valid link on wiki. EDIT: OK, got the plugin, see end of post. Stormy, Take a peek here to whet your appetite, Some HanFrunz stuff (yep its nearly that time again everybody):- 2010:- https://forum.doom9.org/showthread.php?t=158676 2011:- https://forum.doom9.org/showthread.php?t=163597 2012:- https://forum.doom9.org/showthread.php?t=166752 2013:- https://forum.doom9.org/showthread.php?t=169943 2014:- https://forum.doom9.org/showthread.php?t=171573 2015:- https://forum.doom9.org/showthread.php?t=172979 2016:- https://forum.doom9.org/showthread.php?t=174134 2017:- https://forum.doom9.org/showthread.php?t=175126 2018:- Coming soon to a cinema near you. Gavino YUV demo as animated GIF:- https://forum.doom9.org/showthread.p...26#post1402326 (And see post 1 for the creation script) Some DavidHorman stuff, Quad:- https://forum.doom9.org/showthread.php?p=1595308 (And ~1MB demo by Martin53 using Davids plug):- http://www.mediafire.com/file/hyz3tl...rbars.mp4/file rgba_rpn0.1.zip https://forum.doom9.org/showthread.php?p=1738374 Visible Human Project, quite amazing stuff from David (he da man!). https://forum.doom9.org/showthread.p...02#post1792302 Think I'll go to bed, hard to keep my eyes open. (well after I finish my glass of perry). EDIT: From this thread:- https://forum.doom9.org/showthread.p...ncingBallMovie BouncingBallMovie(~198KB):- http://www.mediafire.com/file/nh8mze...Movie.mp4/file BouncingBallMovie2(~1MB):- http://www.mediafire.com/file/ijyrq5...ovie2.mp4/file James Bond style Intro(~2MB):- http://www.mediafire.com/file/tp7290...potExpose2.mp4 EDIT: ChaosKing to the rescue:- http://chaosking.de/repo/avsfilters/...ers/Debanding/ 5 versions of Flash3kyuu, including 2x x64 packages.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 26th November 2018 at 18:28. |
26th November 2018, 17:55 | #20 | Link |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
I have added it to my 'Stuff' page.
__________________
Groucho's Avisynth Stuff |
|
|