├── README.md ├── dual_out.py └── examples ├── README.md ├── demo.json ├── demo.vpy ├── demo_720p.json ├── demo_720p.vpy ├── demo_VSFilterMod.json ├── demo_VSFilterMod.vpy ├── demo_lpsub_web_x265.json ├── demo_lpsub_web_x265.vpy ├── demo_x264_lolihouseBased.json └── demo_x264_lolihouseBased.vpy /README.md: -------------------------------------------------------------------------------- 1 | # Encode-Tools 2 |   这里是 **离谱Sub** 字幕组的压制工具合集(基于win64系统) 3 | 4 | ### OKEGui 5 | ~  https://github.com/vcb-s/OKEGui~ 6 |   来自 **VCB-Studio** 的压制集合GUI工具 7 |   * PS:使用 `OKEGui` 之前需要安装 8 | > [.NET 4.5](https://www.microsoft.com/zh-cn/download/details.aspx?id=30653)(win10自带) 9 | > [qaac](https://github.com/lipusub/Encode-Tools/releases/download/1.1/AppleApplicationSupport64.msi) (电脑上有iTunes不需要安装) 10 |   * PS2:使用时记得放在纯英文目录 11 | ~  * PS3:点进去后,一定要修改 `vspipe` 和 `RPChecker.exe` 的位置,点开设置修改 两个都放在: `你的路径\OKEGui\tools\vapoursynth\` 下~ 12 | 前往 https://github.com/AmusementClub/tools/releases 下载`OKEGui_portable_xxxxxx.7z` 13 | 下载 [基于 AmusementClub 的版本并补充部分字幕组常用滤镜的 VapourSynth_Portable 包](https://wweo-my.sharepoint.com/:u:/g/personal/lpsub_lpsub_com/EeE6P57IuxdIjXdjdblsmMkBwc9hnZQGt89EeT7VijEQWQ?e=MVtpHB) 14 | 并使用此包替换`OKEGUI`中的`tools/vapoursynth` 15 | 16 | ### x264-tMod 17 |   https://github.com/jpsdr/x264/releases 18 |   *x264* 编码器,使用时记得要和 `.json` 文件和 `.vpy` 文件放在同一个文件夹里。 19 | 20 | ### x265 21 |   https://github.com/Mr-Z-2697/x265-Yuuki-Asuna/releases 22 |   *x265* 编码器,使用时记得要和 `.json` 文件和 `.vpy` 文件放在同一个文件夹里。 23 | 24 | ### MediaInfo 25 |   https://mediaarea.net/en/MediaInfo 26 |   视频文件信息查看器,左键使用 27 | 28 | ### MeGUI 29 |   https://sourceforge.net/projects/megui/ 30 |   综合工具,可以用来压缩音频,混流,抽流,章节工具 31 |   * PS: 其实不一定用的到,但是推荐下载。组内使用这个封装 `MP4` 32 | ~封装`MP4`使用`OKEGui`自动完成~ 33 | 34 | ### MKVToolNix 35 |   https://mkvtoolnix.download/downloads.html 36 |   `MKV` 封装工具 37 | 38 | ### ~vapoursynth-portable-FATPACK~ 39 | ~  https://github.com/theChaosCoder/vapoursynth-portable-FATPACK~ 40 | ~  `Vapoursynth` 便携版(带常用插件),已经和 `OKEGui` 打包在了一起,不需要单独安装了~ 41 | 42 | ### MPV-config 43 | 44 | https://github.com/dyphire/mpv-config 45 | *Windows* 下 *mpv* 播放器 46 |   * PS:具体信息看该项目的 **README.md** 47 | 当然同时推荐 *PotPlayer* 和 *VLC* 等播放器 48 | 49 | ### AssFontSubset 50 | 51 | https://github.com/tastysugar/AssFontSubset 52 | `Advanced SubStation Alpha` 字幕文件的字体子集化工具 53 | 54 |           * **此压制方案由`M.B.F.`制定,后经过多次迭代** 55 | -------------------------------------------------------------------------------- /dual_out.py: -------------------------------------------------------------------------------- 1 | import vapoursynth as vs 2 | import sys 3 | 4 | # Originately writen by YomikoR 5 | #https://gist.github.com/RyougiKukoc/2dc1bf4fc7e54515329abdb2ff16b976#file-dual_output_v2-py 6 | 7 | # Outputting various size and format clips requires VS R61 and later 8 | def multiple_outputs(clips, files): 9 | # Checks 10 | num_clips = len(clips) 11 | num_files = len(files) 12 | assert num_clips > 0 and num_clips == num_files 13 | for clip in clips: 14 | assert clip.format 15 | 16 | is_y4m = [clip.format.color_family in (vs.YUV, vs.GRAY) for clip in clips] 17 | 18 | for n in range(num_files): 19 | fileobj = files[n] 20 | if (fileobj is sys.stdout or fileobj is sys.stderr) and hasattr(fileobj, "buffer"): 21 | files[n] = fileobj.buffer 22 | 23 | # Interleave 24 | max_len = max(len(clip) for clip in clips) 25 | clips_aligned = [] 26 | for n, clip in enumerate(clips): 27 | if len(clip) < max_len: 28 | clip_aligned = clip + vs.core.std.BlankClip(clip, length=max_len - len(clip)) 29 | else: 30 | clip_aligned = clip 31 | clips_aligned.append(vs.core.std.Interleave([clip_aligned] * num_clips)) 32 | if vs.__version__.release_major > 60: 33 | clips_varfmt = vs.core.std.BlankClip(length=max_len * num_clips, varformat=True, varsize=True) 34 | else: 35 | clips_varfmt = vs.core.std.BlankClip(clips[0], length=max_len * num_clips) 36 | def _interleave(n, f): 37 | return clips_aligned[n % num_clips] 38 | interleaved = vs.core.std.FrameEval(clips_varfmt, _interleave, clips_aligned, clips) 39 | 40 | # Y4M header 41 | for n in range(num_clips): 42 | if is_y4m[n]: 43 | clip = clips[n] 44 | fileobj = files[n] 45 | if clip.format.color_family == vs.GRAY: 46 | y4mformat = 'mono' 47 | if clip.format.bits_per_sample > 8: 48 | y4mformat = y4mformat + str(clip.format.bits_per_sample) 49 | else: # YUV 50 | if clip.format.subsampling_w == 1 and clip.format.subsampling_h == 1: 51 | y4mformat = '420' 52 | elif clip.format.subsampling_w == 1 and clip.format.subsampling_h == 0: 53 | y4mformat = '422' 54 | elif clip.format.subsampling_w == 0 and clip.format.subsampling_h == 0: 55 | y4mformat = '444' 56 | elif clip.format.subsampling_w == 2 and clip.format.subsampling_h == 2: 57 | y4mformat = '410' 58 | elif clip.format.subsampling_w == 2 and clip.format.subsampling_h == 0: 59 | y4mformat = '411' 60 | elif clip.format.subsampling_w == 0 and clip.format.subsampling_h == 1: 61 | y4mformat = '440' 62 | if clip.format.bits_per_sample > 8: 63 | y4mformat = y4mformat + 'p' + str(clip.format.bits_per_sample) 64 | 65 | y4mformat = 'C' + y4mformat + ' ' 66 | 67 | data = 'YUV4MPEG2 {y4mformat}W{width} H{height} F{fps_num}:{fps_den} Ip A0:0 XLENGTH={length}\n'.format( 68 | y4mformat=y4mformat, 69 | width=clip.width, 70 | height=clip.height, 71 | fps_num=clip.fps_num, 72 | fps_den=clip.fps_den, 73 | length=len(clip) 74 | ) 75 | fileobj.write(data.encode("ascii")) 76 | 77 | # Output# 78 | for idx, frame in enumerate(interleaved.frames(close=False)): 79 | clip_idx = idx % num_clips 80 | clip = clips[clip_idx] 81 | fileobj = files[clip_idx] 82 | finished = idx // num_clips 83 | if finished < len(clip): 84 | if is_y4m[clip_idx]: 85 | fileobj.write(b"FRAME\n") 86 | for planeno, plane in enumerate(frame): 87 | if frame.get_stride(planeno) != plane.shape[1] * clip.format.bytes_per_sample: 88 | fileobj.write(bytes(plane)) 89 | else: 90 | fileobj.write(plane) 91 | if hasattr(fileobj, "flush"): 92 | fileobj.flush() 93 | 94 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | 这是几个OKEGui的例子 2 | 具体使用看wiki 3 | -------------------------------------------------------------------------------- /examples/demo.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version" : 3, 3 | "VSVersion" : "20210901", 4 | "ProjectName" : "Demo - 1080p", 5 | "EncoderType" : "x265", 6 | "Encoder" : "x265-10b.exe", 7 | "EncoderParam" : "-D 10 --deblock -1:-1 --preset slower --limit-tu 4 --no-strong-intra-smoothing --ctu 32 --crf 16 --qg-size 8 --pbratio 1.2 --cbqpoffs -2 --crqpoffs -2 --no-sao --me 3 --subme 5 --merange 38 --b-intra --no-amp --ref 4 --weightb --keyint 360 --min-keyint 1 --bframes 6 --aq-mode 1 --aq-strength 0.7 --rd 5 --psy-rd 1.5 --psy-rdoq 0.8 --rdoq-level 2 --no-open-gop --rc-lookahead 80 --scenecut 40 --qcomp 0.65 --vbv-bufsize 40000 --vbv-maxrate 30000 --colormatrix bt709 --range limited", 8 | "ContainerFormat" : "mkv", 9 | "AudioTracks" : [{ 10 | "OutputCodec" : "flac" 11 | },{ 12 | "OutputCodec" : "aac", 13 | "Bitrate" : 192, 14 | "Name": "Commentary", 15 | "Language" : "eng", 16 | "Optional": true 17 | }], 18 | "InputScript" : "demo.vpy", 19 | "Fps" : 23.976, 20 | "SubtitleTracks" : [{ 21 | "Language" : "jpn" 22 | }], 23 | "InputFiles" : [ 24 | "Main_Disc\\BDMV\\STREAM\\00000.m2ts", 25 | "Main_Disc\\BDMV\\STREAM\\00001.m2ts", 26 | "Main_Disc\\BDMV\\STREAM\\00002.m2ts", 27 | ], 28 | "Config" : { 29 | "VspipeArgs" : [ 30 | "op_start=10000", 31 | "op_end=15000" 32 | ] 33 | }, 34 | "Rpc" : true 35 | } 36 | -------------------------------------------------------------------------------- /examples/demo.vpy: -------------------------------------------------------------------------------- 1 | import vapoursynth as vs 2 | import sys 3 | import os.path 4 | import math 5 | from vapoursynth import core 6 | import havsfunc as haf 7 | import mvsfunc as mvf 8 | 9 | core.num_threads = 8 10 | 11 | #OKE:PROJECTDIR 12 | projDir = '.' 13 | sys.path.insert(1, projDir) # some packages rely on having '' as sys.path[0] 14 | #import custom # import python modules under the project directory 15 | #core.std.LoadPlugin(os.path.join(projDir, 'libcustom.dll')) # or load custom plugins 16 | 17 | #OKE:MEMORY 18 | core.max_cache_size = 8000 19 | 20 | #OKE:INPUTFILE 21 | a="00000.m2ts" 22 | src8 = core.lsmas.LWLibavSource(a) 23 | src16 = core.fmtc.bitdepth(src8,bits=16) 24 | 25 | op = core.rgvs.RemoveGrain(src16, 20) 26 | 27 | res = core.std.Trim(src16, 0, int(op_start) - 1) + core.std.Trim(op, int(op_start), int(op_end)) + core.std.Trim(src16, int(op_end) + 1, src16.num_frames - 1) 28 | 29 | #OKE:DEBUG 30 | Debug = 0 31 | if Debug: 32 | res=core.std.Interleave([src16, res]) 33 | res=mvf.ToRGB(res,full=False,depth=8) 34 | else: res = mvf.Depth(res, 10) 35 | 36 | res.set_output() 37 | src16.set_output(1) 38 | -------------------------------------------------------------------------------- /examples/demo_720p.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version" : 2, 3 | "ProjectName" : "Demo - 720p", 4 | "EncoderType" : "x264", 5 | "Encoder" : "x264_64_tMod-8bit-420.exe", 6 | "EncoderParam" : "--preset veryslow --tune animation --crf 19.0 --deblock 0:0 --keyint 360 --min-keyint 1 --bframes 8 --ref 9 --pbratio 1.25 --qcomp 0.7 --rc-lookahead 70 --aq-strength 0.9 --merange 24 --psy-rd 0.00:0.20 --no-dct-decimate --no-fast-pskip --colormatrix bt709 --fgo 1", 7 | "ContainerFormat" : "mp4", 8 | "AudioTracks" : [{ 9 | "TrackId" : 0, 10 | "OutputCodec" : "aac", 11 | "Bitrate" : 128 12 | },{ 13 | "TrackId" : 1, 14 | "OutputCodec" : "flac", 15 | "MuxOption" : "Skip" 16 | }], 17 | "InputScript" : "demo_720p.vpy", 18 | "Fps" : 23.976, 19 | "SubtitleTracks" : [{ 20 | "MuxOption" : "Skip" 21 | }], 22 | "InputFiles" : [ 23 | "00000.m2ts", 24 | "00001.m2ts", 25 | "00002.m2ts", 26 | ], 27 | "Rpc" : true 28 | } 29 | -------------------------------------------------------------------------------- /examples/demo_720p.vpy: -------------------------------------------------------------------------------- 1 | import vapoursynth as vs 2 | import sys 3 | from vapoursynth import core 4 | import havsfunc as haf 5 | import mvsfunc as mvf 6 | 7 | core.num_threads = 12 8 | 9 | #OKE:MEMORY 10 | core.max_cache_size = 9000 11 | 12 | #OKE:INPUTFILE 13 | a="00001.m2ts" 14 | src8 = core.lsmas.LWLibavSource(a) 15 | src16 = core.fmtc.bitdepth(src8,bits=16) 16 | 17 | gray = core.std.ShufflePlanes(src16, 0, colorfamily=vs.GRAY) 18 | gray = core.fmtc.transfer(gray,transs="709",transd="linear") 19 | gray = core.fmtc.resample(gray,1280,720) 20 | gray = core.fmtc.transfer(gray,transs="linear",transd="709") 21 | UV = core.fmtc.resample(src16,1280,720) 22 | down = core.std.ShufflePlanes([gray,UV],[0,1,2], vs.YUV) 23 | 24 | nr16 = core.knlm.KNLMeansCL(down,device_type="GPU",h=0.6,s=3,d=1,a=2,channels="Y") 25 | noise16 = core.std.MakeDiff(down,nr16,0) 26 | dbed = core.f3kdb.Deband(nr16, 8,48,48,48,0,0,output_depth=16) 27 | dbed = core.f3kdb.Deband(dbed,16,32,32,32,0,0,output_depth=16) 28 | dbed = mvf.LimitFilter(dbed,nr16,thr=0.5,thrc=0.4,elast=1.5) 29 | dbed = core.std.MergeDiff(dbed,noise16,0) 30 | 31 | 32 | bright = mvf.Depth(dbed,8,dither=1) 33 | dark = mvf.Depth(dbed,8,dither=0,ampo=1.5) 34 | res = core.std.MaskedMerge(dark, bright, core.std.Binarize(bright, 128, planes=0), first_plane=True) 35 | 36 | res.set_output(0) 37 | src8.set_output(1) 38 | -------------------------------------------------------------------------------- /examples/demo_VSFilterMod.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version" : 2, 3 | "ProjectName" : "Demo - 1080p", 4 | "EncoderType" : "x264", 5 | "Encoder" : "x264_x64_tmod.exe", 6 | "EncoderParam" : "--preset slow --crf 22.0 --deblock 1:1 --keyint 120 --min-keyint 1 --bframes 14 --b-adapt=1 --ref 3 --pbratio 1.25 --qcomp 0.5 --rc-lookahead 80 --aq-mode 3 --aq-strength=0.7 --merange 32 --subme=7 --trellis=1 --psy-rd 0.00:0.20 --no-dct-decimate --no-fast-pskip --colormatrix bt709 --fgo 1", 7 | "ContainerFormat" : "mp4", 8 | "AudioTracks" : [{ 9 | "OutputCodec" : "aac", 10 | "Bitrate" : 256, 11 | "Language" : "jpn", 12 | "Optional": true 13 | }], 14 | "InputScript" : "demo_VSFilterMod.vpy", 15 | "Fps" : 23.976, 16 | "InputFiles" : [ 17 | ], 18 | "Config" : { 19 | "VspipeArgs" : [ 20 | "input_ass=" # 写ass字幕位置,记得带双引号 21 | ] 22 | }, 23 | "Rpc" : false 24 | } 25 | -------------------------------------------------------------------------------- /examples/demo_VSFilterMod.vpy: -------------------------------------------------------------------------------- 1 | import vapoursynth as vs 2 | import sys 3 | import havsfunc as haf 4 | import mvsfunc as mvf 5 | core = vs.core 6 | core.num_threads = 12 7 | 8 | #OKE:MEMORY 9 | core.max_cache_size = 1000 10 | 11 | #OKE:INPUTFILE 12 | a = "src.mkv" 13 | src8 = core.lsmas.LWLibavSource(a) 14 | ass = input_ass #修改成字幕名称 15 | res = core.vsfm.TextSubMod(src8,ass) 16 | res = mvf.Depth(res) 17 | res.set_output(0) 18 | -------------------------------------------------------------------------------- /examples/demo_lpsub_web_x265.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version" : 2, 3 | "ProjectName" : "lpsub_web", 4 | "EncoderType" : "x265", 5 | "Encoder" : "x265.exe", 6 | "EncoderParam" : "--preset veryslow --ctu 32 --min-cu-size 8 --limit-tu 1 --tu-intra-depth 3 --tu-inter-depth 3 --max-tu-size 32 --me 3 --merange 57 --subme 5 --ref 5 --max-merge 3 --radl 2 --min-keyint 1 --keyint 360 --pbratio 1.2 --bframes 16 --weightb --b-adapt 2 --no-strong-intra-smoothing --crf 18 --qpmin 0 --cbqpoffs -2 --crqpoffs -3 --qcomp 0.70 --rdoq-level 2 --psy-rdoq 0.8 --psy-rd 1.5 --aq-mode 1 --aq-strength 0.8 --qg-size 16 --rd 5 --limit-modes --limit-refs 1 --no-rect --no-amp --tskip-fast --rc-lookahead 180 --dynamic-rd 3 --deblock 0:0 --no-sao --hrd --colormatrix bt709 --range limited --aud --repeat-headers --output-depth 10 --level-idc 5.1", 7 | "ContainerFormat" : "mkv", 8 | "AudioTracks" : [{ 9 | "OutputCodec" : "aac", 10 | "MuxOption" : "ExtractOnly", 11 | "Name": "Orgianal", 12 | "Language" : "jpn", 13 | "Optional": true 14 | }], 15 | "SubtitleTracks": [{ 16 | "MuxOption": "Skip", 17 | "Language" : "jpn" 18 | }], 19 | "InputScript" : "demo_lpsub_web_x265.vpy", 20 | "Fps" : 23.976, 21 | "InputFiles" : [ 22 | ], 23 | "Config" : { 24 | "VspipeArgs" : [ 25 | ] 26 | }, 27 | "Rpc" : true 28 | } 29 | -------------------------------------------------------------------------------- /examples/demo_lpsub_web_x265.vpy: -------------------------------------------------------------------------------- 1 | from typing import NamedTuple, List 2 | import mvsfunc as mvf 3 | import kagefunc as kgf 4 | import havsfunc as haf 5 | import vapoursynth as vs 6 | import nnedi3_resample as nnrs 7 | import fvsfunc as fvf 8 | import vsTAAmbk as taa 9 | import adptvgrnMod as adp 10 | import atomchtools 11 | core = vs.core 12 | #OKE:MEMORY 13 | core.max_cache_size = 50000 14 | 15 | #OKE:INPUTFILE 16 | a =r"F:\output\Downloads\Script\48.mp4" 17 | src = core.lsmas.LWLibavSource(a) 18 | src = core.std.Trim(src,last=1000) 19 | src16 = mvf.Depth(src,16) 20 | out16 = adp.adptvgrnMod(src16, strength=1, size=1.2, sharp=20, static=False, luma_scaling=5, grain_chroma=False) 21 | res = mvf.Depth(out16,10) 22 | 23 | #OKE:DEBUG 24 | debug = 0 25 | if debug: 26 | denoise = mvf.ToRGB(denoise,full=False,depth=8) 27 | src = mvf.ToRGB(src,full=False,depth=8) 28 | compare = core.std.Interleave([denoise,src]) 29 | compare.set_output() 30 | else: 31 | res.set_output(0) 32 | src16.set_output(1) 33 | -------------------------------------------------------------------------------- /examples/demo_x264_lolihouseBased.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version": 2, 3 | "ProjectName": "x264-WebRip-CHS", 4 | "EncoderType": "x264", 5 | "Encoder": "x264.exe", 6 | "EncoderParam": "--level 5.0 --preset veryslow --profile high --crf 19.0 --deblock -1:-1 --keyint 480 --min-keyint 1 --ref 9 --vbv-bufsize 35000 --vbv-maxrate 34000 --chroma-qp-offset 1 --qcomp 0.65 --rc-lookahead 80 --aq-mode 3 --aq-strength 0.90 --merange 24 --fgo 1 --psy-rd 0.60:0.20 --no-fast-pskip --colorprim bt709 --transfer bt709 --colormatrix bt709 --subme 10", 7 | "ContainerFormat": "mp4", 8 | "AudioTracks": [ 9 | { 10 | "OutputCodec": "aac", 11 | "Language": "jpn", 12 | "Optional": true 13 | } 14 | ], 15 | "SubtitleTracks": [ 16 | { 17 | "TrackId": 0, 18 | "MuxOption": "Skip", 19 | "Optional": true 20 | } 21 | ], 22 | "InputScript": "demo_x264_lolihouseBased.vpy", 23 | "Fps": 23.976, 24 | "Config": { 25 | "VspipeArgs": [] 26 | }, 27 | "Rpc": true 28 | } 29 | -------------------------------------------------------------------------------- /examples/demo_x264_lolihouseBased.vpy: -------------------------------------------------------------------------------- 1 | import vapoursynth as vs 2 | import mvsfunc as mvf 3 | import adptvgrnMod as adp 4 | 5 | # 字幕组新番 web源 x264 通用脚本 6 | # libass 7 | # 字幕文件名为 视频文件名(去除后缀).sc.ass 8 | 9 | core = vs.core 10 | #OKE:MEMORY 11 | core.max_cache_size = 8000 12 | #OKE:INPUTFILE 13 | source = r"E:\Animations\4个人各自有着自己的秘密\[SubsPlease] 4-nin wa Sorezore Uso wo Tsuku - 02 (1080p) [A5D310BC].mkv" # 片源 14 | ass = source[:-4]+'.sc.ass' 15 | src8 = core.lsmas.LWLibavSource(source) 16 | src16 = mvf.Depth(src8, depth=16) 17 | #Denoise 18 | down444 = core.fmtc.resample(src16,960,540, sx=[-0.5,0,0], css="444", planes=[3,2,2], cplace="MPEG2") 19 | nr16y = core.knlm.KNLMeansCL(src16, d=2, a=2, s=3, h=0.8, wmode=2, device_type="GPU") 20 | nr16uv = core.knlm.KNLMeansCL(down444, d=2, a=1, s=3, h=0.4, wmode=2, device_type="GPU") 21 | nr16 = core.std.ShufflePlanes([nr16y,nr16uv], [0,1,2], vs.YUV) 22 | #Deband 23 | nr8 = mvf.Depth(nr16, depth=8) 24 | luma = core.std.ShufflePlanes(nr8, 0, vs.YUV).resize.Bilinear(format=vs.YUV420P8) 25 | nrmasks = core.tcanny.TCanny(nr8,sigma=0.8,op=2,gmmax=255,mode=1,planes=[0,1,2]).std.Expr(["x 7 < 0 65535 ?",""],vs.YUV420P16) 26 | nrmaskb = core.tcanny.TCanny(nr8,sigma=1.3,t_h=6.5,op=2,planes=0) 27 | nrmaskg = core.tcanny.TCanny(nr8,sigma=1.1,t_h=5.0,op=2,planes=0) 28 | nrmask = core.std.Expr([nrmaskg,nrmaskb,nrmasks, nr8],["a 20 < 65535 a 48 < x 256 * a 96 < y 256 * z ? ? ?",""],vs.YUV420P16) 29 | nrmask = core.std.Maximum(nrmask,0).std.Maximum(0).std.Minimum(0) 30 | nrmask = core.rgvs.RemoveGrain(nrmask,[20,0]) 31 | debd = core.f3kdb.Deband(nr16,12,24,16,16,0,0,output_depth=16) 32 | debd = core.f3kdb.Deband(debd,20,56,32,32,0,0,output_depth=16) 33 | debd = mvf.LimitFilter(debd,nr16,thr=0.6,thrc=0.5,elast=2.0) 34 | debd = core.std.MaskedMerge(debd,nr16,nrmask,first_plane=True) 35 | #Addnoise 36 | adn = adp.adptvgrnMod(debd, strength=0.50, size=1.5, sharp=30, static=False, luma_scaling=12, grain_chroma=False) 37 | out16 = core.std.MaskedMerge(adn,debd,nrmask,first_plane=True) 38 | #OKE:DEBUG 39 | debug = 0 40 | if debug: 41 | src1 = mvf.ToRGB(src16,depth=8) 42 | src2 = mvf.ToRGB(out16,depth=8) 43 | compare = core.butteraugli.butteraugli(src1, src2) 44 | res = core.std.Interleave([src1,src2,compare]) 45 | else: 46 | res = core.sub.TextFile(out16,ass) 47 | res = mvf.Depth(res,8) 48 | res.set_output() 49 | src8.set_output(1) 50 | --------------------------------------------------------------------------------