vivy: tv: 05
This commit is contained in:
parent
f4ed75b6d0
commit
7f7611d3d3
76
Vivy/05/05.vpy
Normal file
76
Vivy/05/05.vpy
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
import vapoursynth as vs
|
||||||
|
|
||||||
|
from vivy_common import (VivyConfig, VivySource, antialias, deband, denoise,
|
||||||
|
finalize, fsrcnnx_rescale, letterbox_edgefix)
|
||||||
|
|
||||||
|
from yt_common.automation import SelfRunner
|
||||||
|
from yt_common.source import waka_replace
|
||||||
|
|
||||||
|
from lvsfunc.types import Range
|
||||||
|
from lvsfunc.dehardsub import HardsubLineFade, HardsubSign, HardsubSignFade, HardsubMask, bounded_dehardsub
|
||||||
|
|
||||||
|
from typing import List
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
core = vs.core
|
||||||
|
|
||||||
|
|
||||||
|
EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0]))
|
||||||
|
CONFIG: VivyConfig = VivyConfig(EPNUM)
|
||||||
|
SOURCE: VivySource = VivySource(CONFIG)
|
||||||
|
|
||||||
|
WAKA_REPLACE: List[List[Range]] = [
|
||||||
|
[(31528, 32331)],
|
||||||
|
[],
|
||||||
|
]
|
||||||
|
SIGNS_RU: List[HardsubMask] = [
|
||||||
|
HardsubLineFade([
|
||||||
|
(5632, 5679),
|
||||||
|
(10588, 10671),
|
||||||
|
(24934, 25005),
|
||||||
|
]),
|
||||||
|
HardsubSignFade([
|
||||||
|
(4016, 4135),
|
||||||
|
(19061, 19186),
|
||||||
|
]),
|
||||||
|
HardsubSignFade([
|
||||||
|
(33950, 34045),
|
||||||
|
], expand=10, thresh=0.03),
|
||||||
|
HardsubSignFade([
|
||||||
|
(18989, 19060),
|
||||||
|
], expand=15, thresh=0.02),
|
||||||
|
HardsubSign([
|
||||||
|
(18923, 18988),
|
||||||
|
]),
|
||||||
|
]
|
||||||
|
NOSCALE: List[Range] = []
|
||||||
|
NOAA: List[Range] = []
|
||||||
|
LETTERBOX: List[Range] = [(0, 1153)]
|
||||||
|
|
||||||
|
|
||||||
|
def filter_basic() -> vs.VideoNode:
|
||||||
|
wakas, ref = SOURCE.source()
|
||||||
|
waka = wakas[0]
|
||||||
|
waka, wakas = waka_replace(waka, wakas[1:], WAKA_REPLACE)
|
||||||
|
src = bounded_dehardsub(waka, ref, SIGNS_RU, wakas)
|
||||||
|
src.set_output(1)
|
||||||
|
return src
|
||||||
|
|
||||||
|
|
||||||
|
def filter() -> vs.VideoNode:
|
||||||
|
src = filter_basic()
|
||||||
|
rescale = fsrcnnx_rescale(src, NOSCALE)
|
||||||
|
den = denoise(rescale)
|
||||||
|
deb = deband(den)
|
||||||
|
aa = antialias(deb, NOAA)
|
||||||
|
edgefix = letterbox_edgefix(aa, LETTERBOX)
|
||||||
|
final = finalize(edgefix)
|
||||||
|
final.set_output()
|
||||||
|
return final
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
SelfRunner(CONFIG, filter, filter_basic)
|
||||||
|
else:
|
||||||
|
filter()
|
@ -1 +1 @@
|
|||||||
x265 --input - --y4m --input-depth 10 --output-depth 10 --input-csp i420 --profile main10 --colormatrix bt709 --colorprim bt709 --transfer bt709 --preset slower --rc-lookahead 72 --keyint 360 --min-keyint 23 --subme 5 --qcomp 0.7 --crf 15 --aq-mode 3 --aq-strength 0.9 --bframes 16 --psy-rd 2.0 --psy-rdoq 1.8 --rdoq-level 1 --deblock -2:-2 --no-sao --no-open-gop --no-wpp --frames {frames:d} --output {filename:s}.h265
|
x265 --input - --y4m --input-depth 10 --output-depth 10 --input-csp i420 --profile main10 --colormatrix bt709 --colorprim bt709 --transfer bt709 --preset slower --rc-lookahead 72 --keyint 360 --min-keyint 23 --subme 5 --qcomp 0.7 --crf 15 --aq-mode 3 --aq-strength 0.9 --bframes 16 --psy-rd 2.0 --psy-rdoq 1.8 --rdoq-level 1 --deblock -2:-2 --no-sao --no-open-gop --no-strong-intra-smoothing --frames {frames:d} --output {filename:s}.h265
|
||||||
|
@ -323,12 +323,14 @@ class SelfRunner():
|
|||||||
return subprocess.call(mkvtoolnix_args)
|
return subprocess.call(mkvtoolnix_args)
|
||||||
|
|
||||||
|
|
||||||
def gencomp(num: int = 10, path: str = "comp", matrix: str = "709", **clips: vs.VideoNode) -> None:
|
def gencomp(num: int = 10, path: str = "comp", matrix: str = "709",
|
||||||
|
firstnum: int = 1, **clips: vs.VideoNode) -> None:
|
||||||
lens = set(c.num_frames for c in clips.values())
|
lens = set(c.num_frames for c in clips.values())
|
||||||
if len(lens) != 1:
|
if len(lens) != 1:
|
||||||
raise ValueError("gencomp: 'Clips must be equal length!'")
|
raise ValueError("gencomp: 'Clips must be equal length!'")
|
||||||
|
|
||||||
frames = sorted(random.sample(range(lens.pop()), num))
|
frames = sorted(random.sample(range(lens.pop()), num))
|
||||||
|
print("Sample frames: " + str(frames))
|
||||||
|
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
shutil.rmtree(path)
|
shutil.rmtree(path)
|
||||||
@ -341,5 +343,5 @@ def gencomp(num: int = 10, path: str = "comp", matrix: str = "709", **clips: vs.
|
|||||||
for f in frames[1:]:
|
for f in frames[1:]:
|
||||||
splice += clip[f]
|
splice += clip[f]
|
||||||
splice = splice.resize.Bicubic(format=vs.RGB24, matrix_in_s=matrix) \
|
splice = splice.resize.Bicubic(format=vs.RGB24, matrix_in_s=matrix) \
|
||||||
.imwri.Write("PNG", os.path.join(path, f"{name}%0{len(str(num))}d.png"))
|
.imwri.Write("PNG", os.path.join(path, f"{name}%0{len(str(num))}d.png"), firstnum=firstnum)
|
||||||
[splice.get_frame(f) for f in range(splice.num_frames)]
|
[splice.get_frame(f) for f in range(splice.num_frames)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user