Skip to content

Instantly share code, notes, and snippets.

@lextra2
Last active November 7, 2024 22:17
Show Gist options
  • Save lextra2/11106c55561c8d45c5601b90fee33f5a to your computer and use it in GitHub Desktop.
Save lextra2/11106c55561c8d45c5601b90fee33f5a to your computer and use it in GitHub Desktop.
AVISYNTH-2022
LWLibavVideoSource("C:\Users\Admin\Downloads\New folder\OVA01.mkv")
ConvertBits(32).ConvertToPlanarRGB()
Trim(0, 600)
mlrt_ort(network_path="C:\Program Files (x86)\AviSynth+\plugins64+\models2\2x_AniScale2S_Compact_i8_60K.onnx", builtin=false, provider="dml")
#
function EZdenoise(clip Input, int "thSAD", int "thSADC", int "TR", int "BLKSize", int "Overlap", int "Pel", bool "Chroma", bool "out16")
{
thSAD = default(thSAD, 150)
thSADC = default(thSADC, thSAD)
TR = default(TR, 3)
BLKSize = default(BLKSize, 8)
Overlap = default(Overlap, BLKSize/2)
Pel = default(Pel, 1)
Chroma = default(Chroma, false)
out16 = default(out16, false)
Super = Input.MSuper(Pel=Pel, Chroma=Chroma)
Multi_Vector = Super.MAnalyse(Multi=true, Delta=TR, BLKSize=BLKSize, Overlap=Overlap, Chroma=Chroma)
Input.MDegrainN(Super, Multi_Vector, TR, thSAD=thSAD, thSAD2=int(float(thSAD*0.9)), thSADC=thSADC, thSADC2=int(float(thSADC*0.9)), out16=out16)
}
LWLibavVideoSource("C:\Video\SPONGEBOB_DISC1_NTSC\D3_t02.mkv")
tfm(slow=2, mChroma=false)
tdecimate(mode=1)
MPEG2Source("C:\Users\Admin\Downloads\New folder\E3_t06.d2v")
TFM(d2v="C:\Users\Admin\Downloads\New folder\E3_t06.d2v", slow=2, mode=5)
TDecimate(mode=1)
Crop(6, 0, -6, -0)
Spline36Resize(720, 540)
FFT3DFilter(sigma=10, bt=5, bw=32, bh=32, ow=16, oh=16, plane=3)
Autolevels(filterRadius=30).Levels(0, 1, 255, 0, 235)
Prefetch(4)
ConvertBits(32).ConvertToPlanarRGB()
mlrt_ort(network_path="C:\Program Files (x86)\AviSynth+\plugins64+\models2\2x_Garfieldjr_span48.onnx", builtin=false, provider="dml")
#4445
#7590
LWLibavVideoSource("C:\Users\Admin\Documents\01.mkv")
Debilinear(1280, 720)
EZdenoise(TR=8, Chroma=true)
ConvertBits(10, dither=1)
#Trim(0, 15720)
Trim(0, 600)
Prefetch(12, 48)
LWLibavVideoSource("C:\Users\Admin\Downloads\New folder\005.mkv")
ConvertBits(32).ConvertToPlanarRGB()
RIFE(model=44, factor_num=1, factor_den=1, fps_num=60, fps_den=1)
Prefetch(2)
function ShowMe(clip Input)
{
Super = Input.MSuper(hpad=0, vpad=0, pel=1)
Vector = MAnalyse(Super)
MShow(Super, Vector, showsad=true)
}
LWLibavVideoSource("C:\Users\Admin\Downloads\New folder\S01E01.mkv")
global c = last
global n = DoubleWeave(c).SelectOdd()
global p = DoubleWeave(c).SelectOdd().DuplicateFrame(0)
global c = VMAF2(c,vinverse(c),feature = 0)
global n = VMAF2(n,vinverse(n),feature = 0)
global p = VMAF2(p,vinverse(p),feature = 0)
c
ScriptClip("""
n_metric = propGetFloat(n,"psnr_y") + propGetFloat(n,"psnr_cb") + propGetFloat(n,"psnr_cr")
c_metric = propGetFloat(c,"psnr_y") + propGetFloat(c,"psnr_cb") + propGetFloat(c,"psnr_cr")
p_metric = propGetFloat(p,"psnr_y") + propGetFloat(p,"psnr_cb") + propGetFloat(p,"psnr_cr")
n_metric > c_metric && n_metric > p_metric ? n : \
p_metric > c_metric && p_metric > n_metric ? p : c
""")
@lextra2
Copy link
Author

lextra2 commented Jan 1, 2021

@lextra2
Copy link
Author

lextra2 commented May 30, 2022

ffmpeg -y -benchmark -init_hw_device opencl=GPU -filter_hw_device GPU -i INPUT.mkv -c:v prores_ks -filter_complex "format=yuv420p, hwupload, nlmeans_opencl, hwdownload, format=yuv420p" -q:v 4 -an -frames 480 OUTPUT.mkv

Note: Much slower and much worse quality over MVtools. Do not use!

@lextra2
Copy link
Author

lextra2 commented Sep 17, 2022

-c:v ffv1 -level 3 -coder 1 -context 1 -g 1 -slices 24 -slicecrc 1

@lextra2
Copy link
Author

lextra2 commented Jul 16, 2023

ffmpeg -y -benchmark -i 02.mkv -c:v prores_ks -q:v 4 -vf "dejudder, fps=30000/1001, fieldmatch=mode=pcn_ub:combmatch=full, yadif=deint=interlaced, decimate" -c:a copy 002.mkv

@lextra2
Copy link
Author

lextra2 commented Oct 9, 2024

Defaults:
search=4
searchparam=2

Explanation:
search decides the type of search at every level
searchparam is an additional parameter (step, radius) for this search

Below are the possible values for the search type

  1. OneTimeSearch
  2. NStepSearch
  3. DIA, diamond search, logarithmic search. searchparam is the initial step search, there again, it is refined progressively.
  4. ESA, exhaustive search, searchparam is the radius (square side is 2*radius+1). It is slow, but it gives the best results, SAD-wise.
  5. HEX, hexagonal search. searchparam is the range. (similar to x264). DEFAULT
  6. UMH, uneven multi-hexagon search. searchparam is the range. (similar to x264).
  7. pure Horizontal exhaustive search, searchparam is the radius (width is 2*radius+1).
  8. pure Vertical exhaustive search, searchparam is the radius (height is 2*radius+1).

@lextra2
Copy link
Author

lextra2 commented Oct 9, 2024

Try

Multi_Vector = Super.MAnalyse(Multi=true, Delta=TR, BLKSize=BLKSize, Overlap=Overlap, Chroma=Chroma, search=3, searchparam=4)

@lextra2
Copy link
Author

lextra2 commented Oct 9, 2024

@lextra2
Copy link
Author

lextra2 commented Oct 21, 2024

@lextra2
Copy link
Author

lextra2 commented Nov 6, 2024

ternary operator

Plane = 4 if Chroma = true, else Plane = 1

Plane = Chroma ? 4 : 1

function EZdenoise(clip Input, int "thSAD", int "thSADC", int "TR", int "BLKSize", int "Overlap", int "Pel", bool "Chroma", bool "out16")
{
thSAD = default(thSAD, 150)
thSADC = default(thSADC, thSAD)
TR = default(TR, 3)
BLKSize = default(BLKSize, 8)
Overlap = default(Overlap, BLKSize/2)
Pel = default(Pel, 1)
Chroma = default(Chroma, false)
out16 = default(out16, false)
 
Plane = Chroma ? 4 : 1
 
Super = Input.MSuper(Pel=Pel, Chroma=Chroma)
Multi_Vector = Super.MAnalyse(Multi=true, Delta=TR, BLKSize=BLKSize, Overlap=Overlap, Chroma=Chroma)
 
Input.MDegrainN(Super, Multi_Vector, TR, thSAD=thSAD, thSAD2=int(float(thSAD*0.9)), thSADC=thSADC, thSADC2=int(float(thSADC*0.9)), out16=out16, Plane=Plane)
}

@lextra2
Copy link
Author

lextra2 commented Nov 7, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment