pripri: bd: vol2
This commit is contained in:
parent
da10d6c379
commit
9e51e8c512
41
Princess Principal/03/03.vpy
Normal file
41
Princess Principal/03/03.vpy
Normal file
@ -0,0 +1,41 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, antialias, regrain, scenefilter_ed, finalize
|
||||
|
||||
from yt_common.automation import SelfRunner
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
|
||||
from typing import Optional
|
||||
|
||||
import os
|
||||
|
||||
core = vs.core
|
||||
|
||||
EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0]))
|
||||
CONFIG: PriPriConfig = PriPriConfig(EPNUM)
|
||||
SOURCE: SimpleSource = SimpleSource(
|
||||
FileTrim("../bdmv/[171027][BDMV] プリンセス・プリンシパル II/PRINCESS_PRINCIPAL_2/BDMV/STREAM/00006.m2ts", (0, -24))
|
||||
)
|
||||
ED: Optional[int] = 32608
|
||||
|
||||
|
||||
def filter() -> vs.VideoNode:
|
||||
src = SOURCE.source()
|
||||
if ED is not None:
|
||||
src = src.std.FreezeFrames(first=[src.num_frames-4], last=[src.num_frames-1], replacement=[src.num_frames-5])
|
||||
ef = edgefix(src)
|
||||
den = denoise(ef)
|
||||
rescale = descale(den)
|
||||
aa = antialias(rescale)
|
||||
grain = regrain(aa)
|
||||
ed = scenefilter_ed(grain, src, ED)
|
||||
final = finalize(ed)
|
||||
src.set_output(1)
|
||||
final.set_output(0)
|
||||
return final
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
SelfRunner(CONFIG, SOURCE, filter, audio_codec=["-c:a", "libopus", "-b:a", "192k", "-sample_fmt", "s16"])
|
||||
else:
|
||||
filter()
|
41
Princess Principal/04/04.vpy
Normal file
41
Princess Principal/04/04.vpy
Normal file
@ -0,0 +1,41 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, antialias, regrain, scenefilter_ed, finalize
|
||||
|
||||
from yt_common.automation import SelfRunner
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
|
||||
from typing import Optional
|
||||
|
||||
import os
|
||||
|
||||
core = vs.core
|
||||
|
||||
EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0]))
|
||||
CONFIG: PriPriConfig = PriPriConfig(EPNUM)
|
||||
SOURCE: SimpleSource = SimpleSource(
|
||||
FileTrim("../bdmv/[171027][BDMV] プリンセス・プリンシパル II/PRINCESS_PRINCIPAL_2/BDMV/STREAM/00007.m2ts", (0, -45))
|
||||
)
|
||||
ED: Optional[int] = 32607
|
||||
|
||||
|
||||
def filter() -> vs.VideoNode:
|
||||
src = SOURCE.source()
|
||||
if ED is not None:
|
||||
src = src.std.FreezeFrames(first=[src.num_frames-4], last=[src.num_frames-1], replacement=[src.num_frames-5])
|
||||
ef = edgefix(src)
|
||||
den = denoise(ef)
|
||||
rescale = descale(den)
|
||||
aa = antialias(rescale)
|
||||
grain = regrain(aa)
|
||||
ed = scenefilter_ed(grain, src, ED)
|
||||
final = finalize(ed)
|
||||
src.set_output(1)
|
||||
final.set_output(0)
|
||||
return final
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
SelfRunner(CONFIG, SOURCE, filter, audio_codec=["-c:a", "libopus", "-b:a", "192k", "-sample_fmt", "s16"])
|
||||
else:
|
||||
filter()
|
@ -10,7 +10,7 @@ from yt_common.denoise import bm3d
|
||||
from G41Fun import MaskedDHA
|
||||
from awsmfunc import bbmod
|
||||
from kagefunc import retinex_edgemask
|
||||
from lvsfunc.kernels import Bicubic
|
||||
from lvsfunc.kernels import Bicubic, Kernel
|
||||
from lvsfunc.misc import replace_ranges, scale_thresh
|
||||
from lvsfunc.scale import descale as ldescale
|
||||
from vardefunc import fsrcnnx_upscale, diff_creditless_mask
|
||||
@ -41,7 +41,7 @@ def _nnedi3_double(clip: vs.VideoNode) -> vs.VideoNode:
|
||||
return nn.resize.Bicubic(src_top=0.5, src_left=0.5)
|
||||
|
||||
|
||||
def descale(clip: vs.VideoNode) -> vs.VideoNode:
|
||||
def descale(clip: vs.VideoNode, kernel: Kernel = Bicubic(b=0, c=1/2)) -> vs.VideoNode:
|
||||
def _fsrlineart(clip: vs.VideoNode, width: int, height: int) -> vs.VideoNode:
|
||||
clip = clip.resize.Point(1280, 720)
|
||||
assert clip.format is not None
|
||||
@ -51,7 +51,7 @@ def descale(clip: vs.VideoNode) -> vs.VideoNode:
|
||||
mask = mask.std.Binarize(scale_thresh(0.65, mask)).std.Maximum()
|
||||
mask = depth(mask, clip.format.bits_per_sample, range_in=CRange.FULL, range=CRange.FULL)
|
||||
return core.std.MaskedMerge(nn.resize.Bicubic(width, height, filter_param_a=0, filter_param_b=1/2), fsr, mask)
|
||||
return depth(ldescale(clip, height=720, kernel=Bicubic(b=0, c=1/2), upscaler=_fsrlineart, mask=None), 16)
|
||||
return depth(ldescale(clip, height=720, kernel=kernel, upscaler=_fsrlineart, mask=None), 16)
|
||||
|
||||
|
||||
def antialias(clip: vs.VideoNode) -> vs.VideoNode:
|
||||
|
@ -103,24 +103,13 @@ class Encoder():
|
||||
|
||||
|
||||
class AudioGetter():
|
||||
"""
|
||||
TODO: really should modularize this a bit instead of assuming amazon->funi
|
||||
"""
|
||||
config: Config
|
||||
src: FileSource
|
||||
|
||||
audio_file: str
|
||||
audio_start: int
|
||||
video_src: Optional[vs.VideoNode]
|
||||
|
||||
cleanup: List[str]
|
||||
|
||||
def __init__(self, config: Config, src: FileSource) -> None:
|
||||
self.config = config
|
||||
self.src = src
|
||||
|
||||
self.audio_start = 0
|
||||
self.video_src = None
|
||||
self.cleanup = []
|
||||
|
||||
def trim_audio(self, ftrim: Optional[acsuite.types.Trim] = None) -> str:
|
||||
@ -136,14 +125,14 @@ class AudioGetter():
|
||||
|
||||
return audio_cut
|
||||
|
||||
def encode_audio(self, path: str, args: List[str]) -> str:
|
||||
def encode_audio(self, path: str, codec_args: List[str]) -> str:
|
||||
ffmpeg_args = [
|
||||
"ffmpeg",
|
||||
"-hide_banner", "-loglevel", "panic",
|
||||
"-i", path,
|
||||
"-y",
|
||||
"-map", "0:a",
|
||||
] + args + [AUDIO_ENCODE]
|
||||
] + codec_args + [AUDIO_ENCODE]
|
||||
print("+ " + " ".join(ffmpeg_args))
|
||||
subprocess.call(ffmpeg_args)
|
||||
|
||||
@ -232,6 +221,7 @@ class SelfRunner():
|
||||
out_name += ".mka"
|
||||
self._do_audio(start, end, audio_codec, out_name=out_name)
|
||||
self.audio.do_cleanup()
|
||||
log.success("--- AUDIO ENCODE COMPLETE ---")
|
||||
return
|
||||
|
||||
out_name += ".mkv"
|
||||
|
Loading…
x
Reference in New Issue
Block a user