Log in

View Full Version : HAvsFunc


Pages : 1 2 3 4 [5] 6 7 8 9 10 11 12 13

speedyrazor
24th January 2016, 14:11
All good, thanks, working now.
Just checking, but using QTGMC, it is going to be staying in 10 bit?

Myrsloik
24th January 2016, 19:24
All good, thanks, working now.
Just checking, but using QTGMC, it is going to be staying in 10 bit?

Yes, it should stay in 10bit. I would however recommend doing all processing in 16bit. You're wasting a lot of intermediate precision by not using it.

speedyrazor
24th January 2016, 20:49
Yes, it should stay in 10bit. I would however recommend doing all processing in 16bit. You're wasting a lot of intermediate precision by not using it.

Hi Myrsloik, thanks for the suggestion, and sorry to ask, but using the below script as a 'typical' example, what commands would I need to add / change to process everything in 16 bit?

import vapoursynth as vs
core = vs.get_core()
ret = core.lsmas.LibavSMASHSource(source=r"F:/Interlaced_Test.mov")
ret = core.yadifmod.Yadifmod(ret, edeint=core.nnedi3.nnedi3(ret, field=1), order=1)
ret = core.fmtc.resample (clip=ret, w=720, h=576, css="444", kernel="spline36")
ret = core.fmtc.matrix (clip=ret, mats="709", matd="601")
ret = core.fmtc.resample (clip=ret, css="422")
ret = core.fmtc.bitdepth (clip=ret, bits=10)
ret.set_output()

Kind regards.

HolyWu
25th January 2016, 03:11
Simply insert ret = core.fmtc.bitdepth(clip=ret, bits=16) below LibavSMASHSource.

speedyrazor
25th January 2016, 07:26
Simply insert ret = core.fmtc.bitdepth(clip=ret, bits=16) below LibavSMASHSource.
So it would look like this:
import vapoursynth as vs
core = vs.get_core()
ret = core.lsmas.LibavSMASHSource(source=r"F:/Interlaced_Test.mov")
ret = core.fmtc.bitdepth (clip=ret, bits=16)
ret = core.yadifmod.Yadifmod(ret, edeint=core.nnedi3.nnedi3(ret, field=1), order=1)
ret = core.fmtc.resample (clip=ret, w=720, h=576, css="444", kernel="spline36")
ret = core.fmtc.matrix (clip=ret, mats="709", matd="601")
ret = core.fmtc.resample (clip=ret, css="422")
ret = core.fmtc.bitdepth (clip=ret, bits=10)
ret.set_output()

So convert to 16 bit, do the processing and force it back down to 10?
Does this have much processing / speed implications?

Kind regards.

Boulder
25th January 2016, 07:32
No need to go back to 10 bits so you can remove the "ret = core.fmtc.bitdepth (clip=ret, bits=10)" line. Depending on the encoder you are using to produce the final result, you may need to tell it that you are inputting a 16-bit source.

speedyrazor
25th January 2016, 07:53
No need to go back to 10 bits so you can remove the "ret = core.fmtc.bitdepth (clip=ret, bits=10)" line. Depending on the encoder you are using to produce the final result, you may need to tell it that you are inputting a 16-bit source.
I am piping into ffmpeg, is it better for ffmpeg to do the convert, or VapourSynth?

Boulder
25th January 2016, 19:21
What codec do you use inside ffmpeg?

speedyrazor
25th January 2016, 21:22
What codec do you use inside ffmpeg?
Mainly Prores HQ, but also H.264 and Mpeg2.

Boulder
25th January 2016, 21:43
At least h.264 (x264) should have the input depth parameter, don't know about the others.

sneaker_ger
25th January 2016, 21:48
x264cli has automatic dithering, that's different from the libx264 integration of ffmpeg. Either way, I don't see any reason to favor ffmpeg's/x264cli's dithering over the one of fmtconv.

speedyrazor
25th January 2016, 22:50
x264cli has automatic dithering, that's different from the libx264 integration of ffmpeg. Either way, I don't see any reason to favor ffmpeg's/x264cli's dithering over the one of fmtconv.
Thanks for the advice.

sl1pkn07
5th February 2016, 16:31
only for history record, anyone have the r1, r2 and r3 zips/.py?

greetings

Myrsloik
5th February 2016, 19:29
Speaking about history. Is there any chance I could convince you to use github for hosting and history too?

sl1pkn07
5th February 2016, 20:13
the history is here https://www.nmm-hd.org/newbbs/viewtopic.php?f=23&t=941

HolyWu
9th February 2016, 16:22
Speaking about history. Is there any chance I could convince you to use github for hosting and history too?
Done.

Could you consider porting SRestore to Vapoursynth? It's a monster of a function but quite slow in Avisynth as it doesn't like multithreading much.
Could you or anyone provide a small sample clip with blending problem? I need to do some experiments and make sure the result is correct.

sl1pkn07
9th February 2016, 16:26
i have zips since r4, if you want add in the history

http://sl1pkn07.wtf/havsfunc

Boulder
9th February 2016, 17:17
Could you or anyone provide a small sample clip with blending problem? I need to do some experiments and make sure the result is correct.Sure, I'll try to find something for you off my HDDs. I have at least one concert video readily available but it's tricky to get a good scene for testing.

Boulder
9th February 2016, 17:59
Here you go: https://drive.google.com/file/d/0BzeF_1syecQwLXJfVXhxdE1XMWs/view?usp=sharing

The original frame rate is 25 fps.

BakaProxy
17th February 2016, 19:11
Do you actually intend on implementing the different prefilters from the avisynth version of smdegrain? prefilter 3 and 4 that is.

Thanks in advance.

Tima
24th February 2016, 11:06
Here's another useful script: http://avisynth.nl/index.php/FixChromaBleedingMod

Could you please port it to VS as well (or suggest some better already-ported alternatives)?

HolyWu
26th February 2016, 17:46
Update r22.


Add functions FixChromaBleedingMod(requires adjust (https://github.com/dubhater/vapoursynth-adjust)), InterFrame, srestore and Toon.
Delete utility function LimitDiff, use LimitFilter from mvsfunc (https://github.com/HomeOfVapourSynthEvolution/mvsfunc) instead.
LSFmod: Use "min/max" kernel for edgemaskHQ=False.
SMDegrain: Use DFTTest for prefilter=3 again.
KNLMeansCL: Add the newly added wref parameter in v0.7.5.

HolyWu
26th February 2016, 17:50
Also I made an Anti-Aliasing script of my own.

I don't think it's special enough to make a whole new script for it so I'd like to ask if you want to take it into HAvsFunc.

Sorry, I won't add it. But thanks for your share anyway. :)

Elegant
27th February 2016, 08:24
Any chance on MCTD? I'ts pretty much the only reason I still use AviSynth. I'm not sure prerequisites are still missing.

I should probably learn VapourSynth I find myself porting some of the newer plugins to AviSynth XD

HolyWu
27th February 2016, 09:49
Any chance on MCTD? I'ts pretty much the only reason I still use AviSynth. I'm not sure prerequisites are still missing.

I should probably learn VapourSynth I find myself porting some of the newer plugins to AviSynth XD

MCTD is a script like Swiss army knife. Its main core, denoising, is IMO no better than SMDegrain. Regarding its lot of post-processings, some of the functionality can be achieved by existing functions or individual filters. The only missing two functionality are probably "star & bright points protection" and "stabilize". However I also don't find them really useful though, especially "stabilize" needs a plugin that doesn't have native porting yet.

Boulder
27th February 2016, 10:21
Were you able to use the blended field clip I posted earlier? If not (as it was not a perfect example), I could try finding out a better sample from my DVD collection.

HolyWu
27th February 2016, 14:11
Were you able to use the blended field clip I posted earlier? If not (as it was not a perfect example), I could try finding out a better sample from my DVD collection.

Yes. Thanks for your sample video so I can confirm whether the result is correct. Although I simply test it with the default settings and haven't tried to change any parameter so far.

NailBomber
28th February 2016, 13:10
Update r22.


Add functions FixChromaBleedingMod(requires adjust (https://github.com/dubhater/vapoursynth-adjust)), InterFrame, srestore and Toon.
Delete utility function LimitDiff, use LimitFilter from mvsfunc (https://github.com/HomeOfVapourSynthEvolution/mvsfunc) instead.
LSFmod: Use "min/max" kernel for edgemaskHQ=False.
SMDegrain: Use DFTTest for prefilter=3 again.
KNLMeansCL: Add the newly added wref parameter in v0.7.5.


Does InterFrame work? I can't seem to load an AviSynth plugins (svpflow1.dll and svpflow2.dll).

Simple script gives me an error:

import vapoursynth as vs
import havsfunc as hf

core = vs.get_core()
core.avs.LoadPlugin( path="C:\\Apps\\VapourSynth\\avsplugins\\svpflow1.dll" )
core.avs.LoadPlugin( path="C:\\Apps\\VapourSynth\\avsplugins\\svpflow2.dll" )

clip = core.lsmas.LWLibavSource( "before_interframe.mp4" )
clip = hf.InterFrame( clip )

clip.set_output()

Are_
28th February 2016, 13:51
As far as I understand it svp has native plugins for vapoursynth and this script uses them. Put that plugins in the autoload folder and don't try to manually load anything.

Mystery Keeper
28th February 2016, 15:59
Suggestion, if you haven't done it yet. To process float point clips I did this in my script:
mv = core.mv
if clip.format.sample_type == vs.FLOAT:
mv = core.mvsfThen I used mv instead of core.mv. It worked for TempLinearApproximateMC. You could try it with your functions and see if they can process floating point scripts. Maybe adjust some things if they can't so they could.

HolyWu
28th February 2016, 18:24
Does InterFrame work? I can't seem to load an AviSynth plugins (svpflow1.dll and svpflow2.dll).

As Are_ said, You need to use the native DLLs for VapourSynth instead of AviSynth ones. See http://forum.doom9.org/showthread.php?p=1758187#post1758187.

NailBomber
28th February 2016, 20:23
Are_, HolyWu, thanks!

TalasNetrag
1st March 2016, 13:59
Any plans on porting AnimeIVTC, YAHRmod, abcxyz, WarpDeRing and SSSharp?

aegisofrime
4th March 2016, 22:58
Yay, InterFrame, thanks! That was one of the few reasons I was still on Avisynth. Thanks HolyWu!

asarian
5th April 2016, 10:30
Hmm, QTGMC is supposed to be a native part of the hav tools, right?! Cuz I'm getting some error about the name scd not existing:

Script evaluation failed:
Python exception: No attribute with the name scd exists. Did you mistype a plugin namespace?
Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 1489, in vapoursynth.vpy_evaluateScript (src\cython\vapoursynth.c:26885)
File "f:\jobs\neela.vpy", line 10, in <module>
vid = haf.QTGMC (vid, InputType=0, Preset="Very Slow", TR2=3, TFF=True)
File "C:\Program Files\Python35\lib\site-packages\havsfunc.py", line 978, in QTGMC
if TR0 > 0: ts1 = TemporalSoften(bobbed, 1, 255 << shift, CMts << shift, 28 << shift, 2) # 0.00 0.33 0.33 0.33 0.00
File "C:\Program Files\Python35\lib\site-packages\havsfunc.py", line 4287, in TemporalSoften
clip = set_scenechange(clip, scenechange)
File "C:\Program Files\Python35\lib\site-packages\havsfunc.py", line 4319, in set_scenechange
sc = core.scd.Detect(sc, thresh)
File "src\cython\vapoursynth.pyx", line 1103, in vapoursynth.Core.__getattr__ (src\cython\vapoursynth.c:20711)
AttributeError: No attribute with the name scd exists. Did you mistype a plugin namespace?

Mystery Keeper
5th April 2016, 13:08
Looks like you're missing the scene detection plugin.

asarian
5th April 2016, 13:12
Looks like you're missing the scene detection plugin.

Indeed. I got the 64-bit version now. :) Thx.

asarian
5th April 2016, 19:08
After much fumbling in obscurity, on my end, I finally got QTGMC to work. :) YAY! And, to my surprise, not only does it not crash immediately, it's 'lightning' fast too, relatively, of course. I had hoped the VS implementation would distribute things much better over all my cores, and it does! :) Nearly 100% CPU load.

Great stuff, people! Looks like VS will be my new video rendering environment! :)

asarian
9th April 2016, 11:23
Using 'vid = haf.Deblock_QED (vid)', I'm getting the following error:


Script evaluation failed:
Python exception: No attribute with the name deblock exists. Did you mistype a plugin namespace?
Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 1491, in vapoursynth.vpy_evaluateScript (src\cython\vapoursynth.c:26897)
File "f:\jobs\uit1.vpy", line 10, in <module>
vid = haf.Deblock_QED (vid)
File "C:\Program Files\Python35\lib\site-packages\havsfunc.py", line 341, in Deblock_QED
normal = core.deblock.Deblock(clp, quant=quant1, aoffset=aOff1, boffset=bOff1, planes=[0, 1, 2] if uv != 2 and not isGray else [0])
File "src\cython\vapoursynth.pyx", line 1105, in vapoursynth.Core.__getattr__ (src\cython\vapoursynth.c:20791)
AttributeError: No attribute with the name deblock exists. Did you mistype a plugin namespace?

Boulder
9th April 2016, 12:13
You need the deblock plugin: https://github.com/HomeOfVapourSynthEvolution/VapourSynth-Deblock

asarian
9th April 2016, 14:57
^^ Thx. Silly me. I got the same error, thereafter, about 'dct', but this time I got the message. :)

Mystery Keeper
16th April 2016, 22:27
Is it possible to add float support to QTGMC?

HolyWu
17th April 2016, 00:41
Is it possible to add float support to QTGMC?

Probably not. Some core functions don't support 32-bit input yet.

asarian
17th April 2016, 09:38
SmoothLevels now points to SmoothAdjust. Haven't had my coffee yet, but not seeing a VapourSynth port for it. Does it still exist?

HolyWu
17th April 2016, 12:45
SmoothLevels now points to SmoothAdjust. Haven't had my coffee yet, but not seeing a VapourSynth port for it. Does it still exist?

The SmoothLevels function in haf is ported from the old scripted version. The new dll version SmoothAdjust is closed source.

asarian
17th April 2016, 13:02
Okay, thank you.

HolyWu
13th May 2016, 14:47
Update r23.


Add Stab function.
Now uses core.resize where applicable.
Now uses simple rounding when invoking the Resize wrapper.
srestore: Remove unnecessary invoking of std.Cache.
YAHR: Add the blur and depth parameters.
DeHalo_alpha, LSFmod: Remove the noring parameter.
ContraSharpening: Add the radius and rep parameters.
InterFrame: Remove the invoking of std.Cache. The cache issue has been fixed in VS R32.
HQDeringmod: Process the ring mask in the original color family. It's more convenient for interleaving with the source to tune the mask when show=True.
KNLMeansCL: Use color distance to process chroma planes. The quality is better than processing each chroma plane using gray intensities.
logoNR: Use KNLMeansCL instead of Bilateral+FluxSmooth for smoothing.
Overlay: Process in formats without subsampling to avoid messed result.
QTGMC: The TFF parameter is not required for InputType=1.

Boulder
13th May 2016, 16:46
Thanks a lot for the new version :)

hydra3333
19th June 2016, 05:40
Yes, thank you.

As a VS newbie yet to try to install then run a script using the embedded version of VS/Python, I'm still confused about the dependencies for QTGMC which is the main filter I need, along with deblock_qed and mdegrain1/2/3 and LSFmod.

http://forum.doom9.org/showthread.php?p=1603176#post1603176 from 2012 says
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 perfect solution is to wait for the fix of MVTools2.

However I'm not sure what's already included in the embedded version of VS or not.

I've found useful stuff in "mvsfunc-r7" and downloaded "vapoursynth-mvtools-v13-win32" and "vapoursynth-temporalsoften-v1.0-win32" and been told
Also RemoveGrain and Repair already come included with VapourSynth. If you're looking for anything else take a look at this list here: http://www.vapoursynth.com/doc/pluginlist.html

... but what to do about "MaskTools v2" for vapoursynth, to provide for QTGMC, currently eludes me. Can some kind soul please provide clarification ?

If you are feeling in an especially kind mood, any links to sample scripts which use
QTGMC , deblock_qed , mdegrain1/2/3 , LSFmod , deinterlacing and re-interlacing.

VS for a newbie appears a tad confusing since I read that something like this apparently should re-interlace
def convert_50p_to_50i_tff(c):
# http://forum.doom9.org/showthread.php?t=173163
core = vs.get_core()
if not isinstance(c, vs.VideoNode):
raise TypeError('convert_50p_to_50i_tff: input is not a clip')
#cx = c
#cx = core.std.SeparateFields(cx,tff=True)
cx = core.std.SeparateFields(c,tff=True)
cx = core.std.SelectEvery(cx,cycle=4,offsets=[0, 3])
cx = core.std.DoubleWeave(cx,tff=True)
cx = core.std.SelectEvery(cx,cycle=2, offsets=0)
return cx
which looks quite different to avisynth's equivalent
assumeTFF().Blur(0,0.25).SeparateFields().SelectEvery(4,0,3).Weave() #reinterlace - ASSUMED TFF HERE # BLUR(0,1) per http://forum.doom9.org/showthread.php?p=1488308#post1488308

Selur
9th July 2016, 12:34
using the portable Vapoursynth version I tried to get QTGMC running using:
# Imports
import ctypes
import sys
import os
import vapoursynth as vs
core = vs.get_core()
# Loading Support Files
Dllref = ctypes.windll.LoadLibrary("G:/Hybrid/Vapoursynth/vapoursynth64/plugins/support/libfftw3f-3.dll")
# Import Scripts Folder
scriptPath = 'G:/Hybrid/Vapoursynth/scripts'
sys.path.append(os.path.abspath(scriptPath))
# Import havsfunc # https://github.com/HomeOfVapourSynthEvolution/havsfunc/archive/r23.zip
import havsfunc as havsfunc
# Loading Plugins
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/Support/libnnedi3.dll") # https://github.com/dubhater/vapoursynth-nnedi3/releases/download/v8/vapoursynth-nnedi3-v8-win64.7z
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/Support/libmvtools.dll") # https://github.com/dubhater/vapoursynth-mvtools/releases/download/v15/vapoursynth-mvtools-v15-win64.7z
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/Support/temporalsoften.dll") # https://github.com/dubhater/vapoursynth-temporalsoften/releases/download/v1.0/vapoursynth-temporalsoften-v1.0-win64.7z
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/Support/scenechange.dll") # http://uloz.to/x6gvxpbB/scenechange-win64-7z
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/Support/fmtconv.dll") # https://github.com/EleonoreMizo/fmtconv/releases/download/r20/fmtconv-r20.zip
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/SourceFilter/d2vSource/d2vsource.dll") # https://github.com/dwbuiten/d2vsource/releases/download/v1.0/d2vsource-1.0-windows.zip
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/GrainFilter/AddGrain/AddGrain.dll") # https://github.com/HomeOfVapourSynthEvolution/VapourSynth-AddGrain/releases/download/r5/AddGrain-r5.7z
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/DenoiseFilter/FFT3DFilter/vsfft3dfilter.dll") # http://vfrmaniac.fushizen.eu/works/vsfft3dfilter_r22-b023e21.7z
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/DenoiseFilter/DFTTest/DFTTest.dll") # https://github.com/HomeOfVapourSynthEvolution/VapourSynth-DFTTest/releases/download/r3/DFTTest-r3.7z
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/DenoiseFilter/KNLMeansCL/KNLMeansCL.dll") # https://github.com/Khanattila/KNLMeansCL/releases/download/v0.7.6/KNLMeansCL-v0.7.6.zip
# Loading Source: F:\TestClips&Co\interlaceAndTelecineSamples\interlaced\interlaced.m2v
clip = core.d2v.Source(input="H:/Temp/m2v_26c3cb85db00ee55b39de4864fd86927_491.d2v")
# Deinterlacing using QTGMC
clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=True)
clip = clip[::2]
# Output
clip.output(sys.stdout, y4m=1)
but I only get a 'VSPipe.exe has stopped working' with no further error message when calling:
"g:\Hybrid\Vapoursynth\VSPipe.exe" "h:\Temp\test.vpy" - --y4m | "g:\Hybrid\ffplay.exe" -
(same happens when I use vsedit)
-> am I missing something? (some missing/wrong filter?)

Cu Selur