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. |
6th September 2015, 11:58 | #21 | Link |
Registered User
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
|
sorry I missed it
__________________
https://github.com/stax76/software-list https://www.youtube.com/@stax76/playlists |
26th January 2016, 20:46 | #22 | Link |
Registered User
Join Date: Nov 2012
Posts: 23
|
Code:
import vapoursynth as vs import finesharp core = vs.get_core() clip = core.lsmas.LWLibavSource(source = r'c:\test4.mts') clip = finesharp.sharpen(clip) clip.set_output() "AttributeError: module 'finesharp' has no attribute 'sharpen" What am I missing here? |
21st February 2016, 11:36 | #26 | Link | |
Registered User
Join Date: Oct 2001
Location: Germany
Posts: 7,277
|
Quote:
Is Code:
core.avs.LoadPlugin('/path/to/RemoveGrain.dll') core.avs.LoadPlugin('/path/to/Repair.dll') |
|
21st February 2016, 11:58 | #28 | Link |
Registered User
Join Date: Oct 2001
Location: Germany
Posts: 7,277
|
Code:
# Imports import vapoursynth as vs import os import sys core = vs.get_core() # Include Scripts scriptPath='G:/Hybrid/Vapoursynth/scripts' sys.path.append(os.path.abspath(scriptPath)) # Import finesharp.py import finesharp as finesharp # Loading Plugins core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/SourceFilter/FFMS2/ffms2.dll") # Loading Source: F:/TestClips&Co/Test-AC3-5.1.avi clip = core.ffms2.Source(source="F:/TESTCL~1/TEST-A~1.AVI",cachefile="H:/Temp/avi_54a4199c1a3d3b1476ea1d15dc267332_491.ffindex",fpsnum=25) # Sharpen clip = finesharp.sharpen(clip) # Output clip.set_output() Code:
Failed to evaluate the script: Python exception: module 'finesharp' has no attribute 'sharpen' Traceback (most recent call last): File "src\cython\vapoursynth.pyx", line 1489, in vapoursynth.vpy_evaluateScript (src\cython\vapoursynth.c:26885) File "H:/Temp/tempPreviewVapoursynthFile11_07_39_848.vpy", line 16, in <module> # Output AttributeError: module 'finesharp' has no attribute 'sharpen' |
21st February 2016, 12:10 | #29 | Link |
Registered User
Join Date: Jun 2012
Location: Ibiza, Spain
Posts: 321
|
There is a super-easy way to load from a custom place. In your site-packages folder create a file with ".pth" extension, in linux it will be something like for example:
Code:
/usr/lib/python3.5/site-packages/vapoursynth_modules.pth About your error I think you are using the original script from this thread, not the one sl1pkn07 linked to you. The original is somewhat dated, it does not use vapoursynth native plugins and supports only 8bit. |
21st February 2016, 12:15 | #30 | Link |
Registered User
Join Date: Oct 2001
Location: Germany
Posts: 7,277
|
finesharp.py script I use is:
Code:
# finesharp.py - finesharp module for VapourSynth # Original author: Didee (http://forum.doom9.org/showthread.php?t=166082) # Requirement: VapourSynth r25 or later # Rev: 2016-01-09 import vapoursynth as vs def spline(x, coordinates): def get_matrix(px, py, l): matrix = [] matrix.append([(i == 0) * 1.0 for i in range(l + 1)]) for i in range(1, l - 1): p = [0 for t in range(l + 1)] p[i - 1] = px[i] - px[i - 1] p[i] = 2 * (px[i + 1] - px[i - 1]) p[i + 1] = px[i + 1] - px[i] p[l] = 6 * (((py[i + 1] - py[i]) / p[i + 1]) - (py[i] - py[i - 1]) / p[i - 1]) matrix.append(p) matrix.append([(i == l - 1) * 1.0 for i in range(l + 1)]) return matrix def equation(matrix, dim): for i in range(dim): num = matrix[i][i] for j in range(dim + 1): matrix[i][j] /= num for j in range(dim): if i != j: a = matrix[j][i] for k in range(i, dim + 1): matrix[j][k] -= a * matrix[i][k] if not isinstance(coordinates, dict): raise TypeError('coordinates must be a dict') length = len(coordinates) if length < 3: raise ValueError('coordinates require at least three pairs') px = [key for key in coordinates.keys()] py = [val for val in coordinates.values()] matrix = get_matrix(px, py, length) equation(matrix, length) for i in range(length + 1): if x >= px[i] and x <= px[i + 1]: break j = i + 1 h = px[j] - px[i] s = matrix[j][length] * (x - px[i]) ** 3 s -= matrix[i][length] * (x - px[j]) ** 3 s /= 6 * h s += (py[j] / h - h * matrix[j][length] / 6) * (x - px[i]) s -= (py[i] / h - h * matrix[i][length] / 6) * (x - px[j]) return s def clamp(x, maximum): return max(0, min(round(x), maximum)) def sharpen(clip, mode=1, sstr=2.0, cstr=None, xstr=0.19, lstr=1.49, pstr=1.272, ldmp=None): """Small and relatively fast realtime-sharpening function, for 1080p, or after scaling 720p -> 1080p during playback (to make 720p look more like being 1080p) It's a generic sharpener. Only for good quality sources! (If the source is crap, FineSharp will happily sharpen the crap.) ;) Noise/grain will be enhanced, too. The method is GENERIC. Modus operandi: A basic nonlinear sharpening method is performed, then the *blurred* sharp-difference gets subtracted again. Args: clip (clip): vs.YUV or vs.GRAY video. mode (int): 1 to 3, weakest to strongest. When negative -1 to -3, a broader kernel for equalisation is used. sstr (float): strength of sharpening, 0.0 up to ?? cstr (float): strength of equalisation, 0.0 to ? 2.0 ? (recomm. 0.5 to 1.25, default AUTO) xstr (float): strength of XSharpen-style final sharpening, 0.0 to 1.0 (but, better don't go beyond 0.249 ...) lstr (float): modifier for non-linear sharpening pstr (float): exponent for non-linear sharpening ldmp (float): "low damp", to not overenhance very small differences (noise coming out of flat areas, default sstr+1) Example: .. code-block:: python ... import finesharp ... clip = finesharp.sharpen(clip) ... """ core = vs.get_core() bd = clip.format.bits_per_sample max_ = 2 ** bd - 1 mid = (max_ + 1) // 2 scl = (max_ + 1) // 256 x = 'x {} /'.format(scl) y = 'y {} /'.format(scl) src = clip if src.format.color_family != vs.YUV and src.format.color_family != vs.GRAY: raise ValueError('clip must be YUV or GRAY color family.') if bd < 8 or bd > 16: raise ValueError('clip must be 8..16 bits.') mode = int(mode) if abs(mode) > 3 or mode == 0: raise ValueError('mode must be 1, 2, 3, -1, -2 or -3.') sstr = float(sstr) if sstr < 0.0: raise ValueError('sstr must be larger than zero.') if src.format.color_family != vs.GRAY: clip = core.std.ShufflePlanes(clips=clip, planes=0, colorfamily=vs.GRAY) if cstr is None: cstr = spline(sstr, {0: 0, 0.5: 0.1, 1: 0.6, 2: 0.9, 2.5: 1, 3: 1.09, 3.5: 1.15, 4: 1.19, 8: 1.249, 255: 1.5}) if mode > 0: cstr **= 0.8 cstr = float(cstr) xstr = float(xstr) if xstr < 0.0: raise ValueError('xstr must be larger than zero.') lstr = float(lstr) pstr = float(pstr) if ldmp is None: ldmp = sstr + 0.1 ldmp = float(ldmp) rg = 20 - (mode > 0) * 9 if sstr < 0.01 and cstr < 0.01 and xstr < 0.01: return src if abs(mode) == 1: c2 = core.rgvs.RemoveGrain(clip=clip, mode=[11]).rgvs.RemoveGrain(mode=[4]) else: c2 = core.rgvs.RemoveGrain(clip=clip, mode=[4]).rgvs.RemoveGrain(mode=[11]) if abs(mode) == 3: c2 = core.rgvs.RemoveGrain(clip=c2, mode=[4]) if bd in [8, 9, 10]: def expr(x, y): d = x - y absd = abs(d) e0 = ((absd / lstr) ** (1 / pstr)) * sstr e1 = d / (absd + 0.001) e2 = (d * d) / (d * d + ldmp) return clamp(e0 * e1 * e2 + mid, max_) diff = core.std.Lut2(clipa=clip, clipb=c2, function=expr) else: expr = '{x} {y} - abs {lstr} / log 1 {pstr} / * exp ' \ '{sstr} * {x} {y} - {x} {y} - abs 0.001 + / * {x} {y} - log 2 * exp ' \ '{x} {y} - log 2 * exp {ldmp} + / * 128 + {scl} *' expr = expr.format(x=x, y=y, lstr=lstr, pstr=pstr, sstr=sstr, ldmp=ldmp, scl=scl) diff = core.std.Expr(clips=[clip, c2], expr=expr) shrp = clip if sstr >= 0.01: shrp = core.std.MergeDiff(clipa=shrp, clipb=diff) if cstr >= 0.01: if bd in [8, 9, 10]: def expr(x): return clamp((x - mid) * cstr + mid, max_) diff = core.std.Lut(clip=diff, function=expr) else: expr = 'x {mid} - {cstr} * {mid} +'.format(mid=mid, cstr=cstr) diff = core.std.Expr(clips=diff, expr=expr) diff = core.rgvs.RemoveGrain(clip=diff, mode=[rg]) shrp = core.std.MakeDiff(clipa=shrp, clipb=diff) if xstr >= 0.01: if bd in [8, 9]: def expr(x, y): return clamp(x + (x - y) * 9.9, max_) xyshrp = core.std.Lut2(clipa=shrp, clipb=core.rgvs.RemoveGrain(clip=shrp, mode=[20]), function=expr) else: expr = 'x x y - 9.9 * +' xyshrp = core.std.Expr(clips=[shrp, core.rgvs.RemoveGrain(clip=shrp, mode=[20])], expr=expr) rpshrp = core.rgvs.Repair(clip=xyshrp, repairclip=shrp, mode=[12]) shrp = core.std.Merge(clipa=rpshrp, clipb=shrp, weight=[1 - xstr]) if src.format.color_family != vs.GRAY: shrp = core.std.ShufflePlanes(clips=[shrp, src], planes=[0, 1, 2], colorfamily=src.format.color_family) return shrp -> WORKS NOW!! Had to restart VapourSynth Editor,... Last edited by Selur; 21st February 2016 at 12:40. |
18th June 2016, 16:51 | #32 | Link |
Registered User
Join Date: Oct 2009
Location: crow-land
Posts: 540
|
thank you.
Now of to find the latest versions of these RemoveGrain.dll Repair.dll beginner query - I assume they could go into the root folder of embedded python where VS was also extracted to ? or a "DLLs" subfolder to be safer. Last edited by hydra3333; 19th June 2016 at 04:18. |
18th June 2016, 19:36 | #33 | Link | |
Registered User
Join Date: Mar 2012
Location: Texas
Posts: 1,664
|
Quote:
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 |
|
21st August 2016, 03:29 | #36 | Link |
Registered User
Join Date: Oct 2009
Location: crow-land
Posts: 540
|
Downloaded the latest finesharp from post #1, but I must be doing something wrong, to receive the error message, but can't see what ... suggestions welcomed.
Code:
T:\HDTV\WDTVlive\MP4-VS\1>"C:\SOFTWARE\Vapoursynth\VSPipe.exe" "T:\HDTV\WDTVlive\MP4-VS\1\test.mpg.2016.08.21.11.50.29.84.vpy" - --y4m | "C:\SOFTWARE\ffmpeg\0-homebuilt-x64\x264-mp4.exe" - --stdin y4m --thread-input --frames 45810 --profile high --level 4.1 --preset slow --interlaced --tff --no-cabac --crf 16 --sar 64:45 --colormatrix bt470bg -o "s:\HDTV\WDTVlive\MP4-VS\1\test-temp.2016.08.21.11.50.29.84.h264" Script evaluation failed: Python exception: There is no function named RemoveGrain Traceback (most recent call last): File "src\cython\vapoursynth.pyx", line 1491, in vapoursynth.vpy_evaluateScript (src\cython\vapoursynth.c:26897) File "T:\HDTV\WDTVlive\MP4-VS\1\test.mpg.2016.08.21.11.50.29.84.vpy", line 458, in <module> main() File "T:\HDTV\WDTVlive\MP4-VS\1\test.mpg.2016.08.21.11.50.29.84.vpy", line 151, in main video = fs.FineSharp().sharpen(video) File "C:\SOFTWARE\Vapoursynth\finesharp.py", line 71, in __init__ self.rgrain = self.core.avs.RemoveGrain File "src\cython\vapoursynth.pyx", line 1264, in vapoursynth.Plugin.__getattr__ (src\cython\vapoursynth.c:23480) AttributeError: There is no function named RemoveGrain Code:
import vapoursynth as vs import havsfuncTS as haf # this version uses vanilla TemporalSoften instead of TemporalSoften2, as it will be "better" over time import mvsfunc as mvs # http://forum.doom9.org/showthread.php?t=172564 import finesharp as fs # http://forum.doom9.org/showthread.php?p=1755227#post1755227 http://avisynth.nl/index.php/FineSharp core = vs.get_core(accept_lowercase=True) # leave off threads=8 so it auto-detects threads core.std.LoadPlugin(r'C:\SOFTWARE\Vapoursynth\vapoursynth32\plugins\dll-to-choose-from\AddGrain.dll') # the r'' indicates do not treat special characters and accept backslashes core.std.LoadPlugin(r'C:\SOFTWARE\Vapoursynth\vapoursynth32\plugins\dll-to-choose-from\d2vsource.dll') # the r'' indicates do not treat special characters and accept backslashes core.std.LoadPlugin(r'C:\SOFTWARE\Vapoursynth\vapoursynth32\plugins\dll-to-choose-from\Deblock.dll') # the r'' indicates do not treat special characters and accept backslashes core.std.LoadPlugin(r'C:\SOFTWARE\Vapoursynth\vapoursynth32\plugins\dll-to-choose-from\DFTTest.dll') # the r'' indicates do not treat special characters and accept backslashes core.std.LoadPlugin(r'C:\SOFTWARE\Vapoursynth\vapoursynth32\plugins\dll-to-choose-from\fmtconv.dll') # the r'' indicates do not treat special characters and accept backslashes core.std.LoadPlugin(r'C:\SOFTWARE\Vapoursynth\vapoursynth32\plugins\dll-to-choose-from\KNLMeansCL.dll') # the r'' indicates do not treat special characters and accept backslashes core.std.LoadPlugin(r'C:\SOFTWARE\Vapoursynth\vapoursynth32\plugins\dll-to-choose-from\libawarpsharp2.dll') # the r'' indicates do not treat special characters and accept backslashes core.std.LoadPlugin(r'C:\SOFTWARE\Vapoursynth\vapoursynth32\plugins\dll-to-choose-from\libmvtools.dll') # the r'' indicates do not treat special characters and accept backslashes core.std.LoadPlugin(r'C:\SOFTWARE\Vapoursynth\vapoursynth32\plugins\dll-to-choose-from\libnnedi3.dll') # the r'' indicates do not treat special characters and accept backslashes core.std.LoadPlugin(r'C:\SOFTWARE\Vapoursynth\vapoursynth32\plugins\dll-to-choose-from\scenechange.dll') # http://forum.doom9.org/showthread.php?t=166769 core.std.LoadPlugin(r'C:\SOFTWARE\Vapoursynth\vapoursynth32\plugins\dll-to-choose-from\vsdctfilter.dll') # http://vfrmaniac.fushizen.eu/works core.std.LoadPlugin(r'C:\SOFTWARE\Vapoursynth\vapoursynth32\plugins\dll-to-choose-from\vsfft3dfilter.dll') # http://vfrmaniac.fushizen.eu/works core.std.LoadPlugin(r'C:\SOFTWARE\Vapoursynth\vapoursynth32\plugins\dll-to-choose-from\Yadifmod.dll') # the r'' indicates do not treat special characters and accept backslashes core.avs.LoadPlugin(r'C:\SOFTWARE\Vapoursynth\DGIndex\DGDecodeNV.dll') core.avs.LoadPlugin(r'C:\SOFTWARE\DGindex\DGDecode.dll') def main(): video = core.avs.MPEG2Source(r'T:\HDTV\WDTVlive\MP4-VS\1\test.d2v',info=0,iPP=True,cpu=6) # DEBLOCK and DERING video = core.std.SeparateFields(video, tff=True) video = haf.Deblock_QED(video) video = haf.Weave(video, tff=True) video = mvs.AssumeTFF(video) video = haf.QTGMC(video, TFF=True, Preset="Very Slow", Sharpness=1.2, SLMode=2, EZKeepGrain=1.2, NoiseProcess=2) # result is double framerate progressive, so re-interlate it later video = fs.FineSharp().sharpen(video) video = core.std.SeparateFields(video, tff=True) video = core.std.SelectEvery(video, cycle=4, offsets=[0, 3]) # looks like avisynth video = haf.Weave(video, tff=True) video = mvs.AssumeTFF(video) video.set_output() return True #---------------------------------------------------------------------------------------------------- #if __name__ == "__main__": # # execute main only if run as a script # main() main() Last edited by hydra3333; 21st August 2016 at 03:32. |
21st August 2016, 03:47 | #37 | Link |
Registered User
Join Date: Oct 2009
Location: crow-land
Posts: 540
|
If I edit finesharp.py like this
Code:
#self.rgrain = self.core.avs.RemoveGrain self.rgrain = self.core.rgvs.RemoveGrain #self.repair = self.core.avs.Repair self.repair = self.core.rgvs.Repair Code:
T:\HDTV\WDTVlive\MP4-VS\1>"C:\SOFTWARE\Vapoursynth\VSPipe.exe" "T:\HDTV\WDTVlive\MP4-VS\1\test.mpg.2016.08.21.12.13.34.49.vpy" - --y4m | "C:\SOFTWARE\ffmpeg\0-homebuilt-x64\x264-mp4.exe" - --stdin y4m --thread-input --frames 45810 --profile high --level 4.1 --preset slow --interlaced --tff --no-cabac --crf 16 --sar 64:45 --colormatrix bt470bg -o "s:\HDTV\WDTVlive\MP4-VS\1\test-temp.2016.08.21.12.13.34.49.h264" Script evaluation failed: Python exception: RemoveGrain: Too many unnamed arguments specified Traceback (most recent call last): File "src\cython\vapoursynth.pyx", line 1491, in vapoursynth.vpy_evaluateScript (src\cython\vapoursynth.c:26897) File "T:\HDTV\WDTVlive\MP4-VS\1\test.mpg.2016.08.21.12.13.34.49.vpy", line 458, in <module> main() File "T:\HDTV\WDTVlive\MP4-VS\1\test.mpg.2016.08.21.12.13.34.49.vpy", line 151, in main video = fs.FineSharp().sharpen(video) File "C:\SOFTWARE\Vapoursynth\finesharpmod20160821.py", line 136, in sharpen c2 = self.rgrain(self.rgrain(clip, 11, -1), 4, -1) File "src\cython\vapoursynth.pyx", line 1353, in vapoursynth.Function.__call__ (src\cython\vapoursynth.c:24744) vapoursynth.Error: RemoveGrain: Too many unnamed arguments specified |
21st August 2016, 04:02 | #38 | Link |
Registered User
Join Date: Oct 2009
Location: crow-land
Posts: 540
|
Tried Selur's version from http://forum.doom9.org/showthread.ph...55#post1757955 which looks different and is called differently, and it doesn't crash (don't know how functionally equivalent it is).
Code:
import finesharpmod20160821 as finesharp ... video = finesharp.sharpen(video) Last edited by hydra3333; 21st August 2016 at 04:10. |
21st August 2016, 10:21 | #39 | Link |
Registered User
Join Date: Feb 2010
Location: Saint-Petersburg, Russia
Posts: 38
|
This script needs an upgrade, it uses avisynth functions instead of VS equivalents. Why do you even need finesharp? It's designed for realtime sharpening of upscaled (720 -> 1080) videos. Not quite suitable for video processing.
|
Thread Tools | Search this Thread |
Display Modes | |
|
|