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 29th November 2012, 19:49   #1  |  Link
HolyWu
Registered User
 
HolyWu's Avatar
 
Join Date: Aug 2006
Location: Taiwan
Posts: 414
HAvsFunc

https://github.com/HomeOfVapourSynthEvolution/havsfunc

Here are my ported AviSynth scripts for VapourSynth. Now includes:
Since VapourSynth has no notion of field order internally, I have to add a mandatory parameter TFF to QTGMC for the script to work correctly. Setting TFF to true means top field first and false means bottom field first. You will get error if TFF is not set. The same thing applies to SMDegrain and ivtc_txt60mc. Since VapourSynth R27 the frame property _FieldBased can be set to indicate TFF or BFF. The filters will use the field order specified in the source frames and will only fall back to the specified order if not present.

BTW, Yadif seems can't be loaded in VapourSynth successfully, so I changed the default EdiMode of "Ultra Fast" preset to nnedi3 in QTGMC.

Usage Example:
Firstly, put havsfunc.py to Python\Lib\site-packages.
Code:
import vapoursynth as vs
import havsfunc as haf

core = vs.get_core()

clip = yourclip
clip = haf.QTGMC(clip, Preset='Medium', TFF=True)

Last edited by HolyWu; 23rd October 2017 at 15:02.
HolyWu is offline   Reply With Quote
Old 30th November 2012, 00:54   #2  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: UK
Posts: 2,188
What plugins are needed for QTGMC? It has to be massive list? Is it?
kolak is offline   Reply With Quote
Old 30th November 2012, 02:30   #3  |  Link
HolyWu
Registered User
 
HolyWu's Avatar
 
Join Date: Aug 2006
Location: Taiwan
Posts: 414
Quote:
Originally Posted by kolak View Post
What plugins are needed for QTGMC? It has to be massive list? Is it?
The core plugins are MVTools2, MaskTools v2, RemoveGrain and TemporalSoften, they must be loaded. Others depending on your settings. If you don't use them, they don't have to be loaded.

BTW, if encountering deadlock, try setting the number of threads to a bigger number, vs.Core(threads=x). But no guarantee it will always work. The perfeck solution is to wait for the fix of MVTools2.
HolyWu is offline   Reply With Quote
Old 30th November 2012, 02:38   #4  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: UK
Posts: 2,188
Is it more stable than avisynthMT, specially for HD sources?
kolak is offline   Reply With Quote
Old 30th November 2012, 02:44   #5  |  Link
Revgen
Registered User
 
Join Date: Sep 2004
Location: Near LA, California, USA
Posts: 1,544
QTGMC(clip, Preset='Medium', SubPel=2, TFF=True) constantly crashes VirtualDub for VapourSynth. Picture looks great though. I'll try to fiddle with it later.
__________________
Pirate: Now how would you like to die? Would you like to have your head chopped off or be burned at the stake?

Curly: Burned at the stake!

Moe: Why?

Curly: A hot steak is always better than a cold chop.
Revgen is offline   Reply With Quote
Old 30th November 2012, 02:55   #6  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: UK
Posts: 2,188
For HD you can use very fast or even ultrafast. Can you share vs script ?
kolak is offline   Reply With Quote
Old 30th November 2012, 04:03   #7  |  Link
HolyWu
Registered User
 
HolyWu's Avatar
 
Join Date: Aug 2006
Location: Taiwan
Posts: 414
Can't say if more stable than avisynthMT or not. Maybe it depends on your available threads or settings. I only tried encoding a 1440x1080 1m30s video with Medium preset without crash or deadlock. If you want to avoid the deadlock caused by MCompensate, try setting SLMode to 1 or 3(spatial sharpness limiting) for the time being. Be aware that activating NoiseProcess with some combination of settings will invoke MCompensate too.
HolyWu is offline   Reply With Quote
Old 30th November 2012, 06:51   #8  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 597
you should use 'if foo is None:' instead of 'if foo == None:'.
see this.
http://jaredgrubb.blogspot.jp/2009/0...e-vs-none.html
__________________
my repositories
Chikuzen is offline   Reply With Quote
Old 30th November 2012, 12:32   #9  |  Link
HolyWu
Registered User
 
HolyWu's Avatar
 
Join Date: Aug 2006
Location: Taiwan
Posts: 414
Quote:
Originally Posted by Chikuzen View Post
you should use 'if foo is None:' instead of 'if foo == None:'.
see this.
http://jaredgrubb.blogspot.jp/2009/0...e-vs-none.html
Thanks for the tip.
HolyWu is offline   Reply With Quote
Old 30th November 2012, 17:19   #10  |  Link
HolyWu
Registered User
 
HolyWu's Avatar
 
Join Date: Aug 2006
Location: Taiwan
Posts: 414
Updated r2. Worked around memory leak problem in Bob. The memory consumption of QTGMC should be much lesser now.
HolyWu is offline   Reply With Quote
Old 30th November 2012, 22:17   #11  |  Link
Revgen
Registered User
 
Join Date: Sep 2004
Location: Near LA, California, USA
Posts: 1,544
Memory hogging is still going on for me. Vdub still crashes with the new version.

Is it possible to implement fmtconv instead of Bob() as an alternative for those who have crashing issues? fmtconv is slower, but perhaps it could be more stable.
__________________
Pirate: Now how would you like to die? Would you like to have your head chopped off or be burned at the stake?

Curly: Burned at the stake!

Moe: Why?

Curly: A hot steak is always better than a cold chop.
Revgen is offline   Reply With Quote
Old 30th November 2012, 23:55   #12  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 1,634
Quote:
Originally Posted by HolyWu View Post
Updated r2. Worked around memory leak problem in Bob. The memory consumption of QTGMC should be much lesser now.
Uh, what is this memory leak problem in Bob? I know I did a quick and bad job of ripping it out of avisynth but it still shouldn't crash... that much.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 1st December 2012, 02:42   #13  |  Link
HolyWu
Registered User
 
HolyWu's Avatar
 
Join Date: Aug 2006
Location: Taiwan
Posts: 414
Quote:
Originally Posted by Revgen View Post
Memory hogging is still going on for me. Vdub still crashes with the new version.

Is it possible to implement fmtconv instead of Bob() as an alternative for those who have crashing issues? fmtconv is slower, but perhaps it could be more stable.
Did VirtualDub crash as soon as you loaded your vpy script, or after you seek/jump to another frame? I tried a 1440x1080 video with only haf.QTGMC(clip, TFF=True) in the script and then previewd it in both AvsPmod and VirtualDub. No matter how I seek/jump to random frames, AvsPmod and VirtualDub are still there without crash. The memory usage of both are always around 1GB. Is there any other function used besides QTGMC in your vpy script?

Quote:
Originally Posted by Myrsloik View Post
Uh, what is this memory leak problem in Bob? I know I did a quick and bad job of ripping it out of avisynth but it still shouldn't crash... that much.

Last edited by HolyWu; 1st December 2012 at 02:49.
HolyWu is offline   Reply With Quote
Old 1st December 2012, 03:14   #14  |  Link
Revgen
Registered User
 
Join Date: Sep 2004
Location: Near LA, California, USA
Posts: 1,544
I tried using fmtconv instead of BicubicResize for Bob(). Still crashes at the same place in the video. Strangely enough, fmtconv doesn't appear to be any slower than using BicubicResize. The crash occurs when the ram usage jumps from 1 gb to 1.5 gb in 2-3 secs in one particular spot in the video, then it crashes. I may have to upload the video itself help you solve the problem.

Here's the fmtconv method I tried.

Code:
def Bob(self, input, b, c, tff):
        return self.core.std.Interleave([self.core.fmtc.bitdepth(self.core.fmtc.resample(self.core.std.SelectEvery(self.core.std.SeparateFields(input, tff), cycle=2, offsets=0), w=input.width, h=input.height,kernel='bicubic', a1=b, a2=c, sx=0, sy=0.25, sw=input.width, sh=input.height/2, fulls=0, fulld=0)bits=8,fulls=0,fulld=0),
                                         self.core.fmtc.bitdepth(self.core.fmtc.resample(self.core.std.SelectEvery(self.core.std.SeparateFields(input, tff), cycle=2, offsets=1), w=input.width, h=input.height,kernel='bicubic', a1=b, a2=c, sx=0, sy=-0.25, sw=input.width, sh=input.height/2, fulls=0, fulld=0)bits=8,fulls=0,fulld=0)])
My script is.

Code:
import vapoursynth as vs
import sys
import havsfunc
core = vs.Core()
haf = havsfunc.HAvsFunc(core)
core.std.LoadPlugin(r'C:\Program Files\VapourSynth\filters\avisource.dll')
core.std.LoadPlugin(r'C:\Program Files\VapourSynth\fmtconv.dll')
core.std.LoadPlugin(r'C:\Program Files\VapourSynth\d2vsource_beta3_mingw.dll')
core.std.LoadPlugin(r'C:\Program Files\VapourSynth\nnedi3.dll')
core.std.LoadPlugin(r'C:\Program Files\VapourSynth\filters\eedi3.dll')
core.std.LoadPlugin(r'C:\Program Files\VapourSynth\filters\temporalsoften.dll')
core.avs.LoadPlugin('C:/Program Files/VapourSynth/avisynthfilters.dll')
core.avs.LoadPlugin(r'E:\QTGMC\AddGrainC.dll')
core.avs.LoadPlugin(r'E:\QTGMC\dfttest.dll')
core.avs.LoadPlugin(r'E:\QTGMC\EEDI2.dll')
core.avs.LoadPlugin(r'E:\QTGMC\FFT3DFilter.dll')
core.avs.LoadPlugin(r'E:\QTGMC\mvtools2.dll')
core.avs.LoadPlugin(r'E:\QTGMC\nnedi.dll')
core.avs.LoadPlugin(r'E:\QTGMC\nnedi2.dll')
core.avs.LoadPlugin(r'E:\QTGMC\RemoveGrainSSE2.dll')
core.avs.LoadPlugin(r'E:\QTGMC\RepairSSE2.dll')
core.avs.LoadPlugin(r'E:\QTGMC\TDeint.dll')
core.avs.LoadPlugin(r'E:\QTGMC\VerticalCleanerSSE2.dll')
core.avs.LoadPlugin(r'E:\QTGMC\mt_masktools-25.dll')
vid = core.avisource.AVISource(r'E:\test6.avi')
vid = haf.QTGMC(vid,Preset='Medium',SubPel=2, TFF=True)
last = vid
__________________
Pirate: Now how would you like to die? Would you like to have your head chopped off or be burned at the stake?

Curly: Burned at the stake!

Moe: Why?

Curly: A hot steak is always better than a cold chop.

Last edited by Revgen; 1st December 2012 at 04:13.
Revgen is offline   Reply With Quote
Old 2nd December 2012, 03:17   #15  |  Link
Revgen
Registered User
 
Join Date: Sep 2004
Location: Near LA, California, USA
Posts: 1,544
Here's my source. It's a lossless H264 MKV file.

http://depositfiles.com/files/brzkx20yo
__________________
Pirate: Now how would you like to die? Would you like to have your head chopped off or be burned at the stake?

Curly: Burned at the stake!

Moe: Why?

Curly: A hot steak is always better than a cold chop.
Revgen is offline   Reply With Quote
Old 2nd December 2012, 17:09   #16  |  Link
HolyWu
Registered User
 
HolyWu's Avatar
 
Join Date: Aug 2006
Location: Taiwan
Posts: 414
No, I can't reproduce crash in VirtualDub here, no matter by seeking to random frames or using "Run video analysis pass" under File menu. In your script you used AVISource to load avi file, but the file you provided is mkv, hence I used ffms2 to load it. I don't know whether this difference matters. Did you ever try vid.output(file) way to see if it crashes?

BTW, updated r3. Added DeHalo_alpha, YAHR, HQDering and FastLineDarkenMOD.

Last edited by HolyWu; 2nd December 2012 at 18:40.
HolyWu is offline   Reply With Quote
Old 2nd December 2012, 19:00   #17  |  Link
Revgen
Registered User
 
Join Date: Sep 2004
Location: Near LA, California, USA
Posts: 1,544
I used avisource on the huffyuv file. I encoded it to lossless h264 in order to decrease filesize for upload. Both files crash for me.

Looks like it's a problem on my end.
__________________
Pirate: Now how would you like to die? Would you like to have your head chopped off or be burned at the stake?

Curly: Burned at the stake!

Moe: Why?

Curly: A hot steak is always better than a cold chop.
Revgen is offline   Reply With Quote
Old 3rd December 2012, 18:38   #18  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: UK
Posts: 2,188
On my laptop anything different than ultra fast does not work at all. Which plugins are the best to use with vs- I use Vit's modified version (but not the one for avisynth 2.6).
kolak is offline   Reply With Quote
Old 3rd December 2012, 20:24   #19  |  Link
matfra
Registered User
 
Join Date: Jul 2009
Posts: 111
Can you post a picture to show what the output for this script plese. Im curious
matfra is offline   Reply With Quote
Old 3rd December 2012, 21:23   #20  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: UK
Posts: 2,188
What do you mean?
It looks the same as from avisynth version.
kolak is offline   Reply With Quote
Reply

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 17:06.


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