As a follow-up on my capturing thread (
https://www.digitalfaq.com/forum/vid...sharper-2.html ), I'm now in the post-processing/restoring phase, using vapoursynth
Below my current script. It does the following:
1. crop noise&black borders existing in capture
2. correct the broken u,v channels at the right edge coming from the D8 camcorder during PAL Hi8 playback, different pixel width for each in my case
3. deinterlace with QTGMC
4. resizing with spline64
5. upscaling with nnedi3cl
I think I'm doing something wrong in the upscaling steps.
Disabling/enabling the nnedi3cl does give the result.
I'm resizing with spline64 because the nnedi3cl has no w/h parameters.
Should I try using nnedi3_rpow2 instead ?
Code:
# vapoursynth script originally from https://forum.videohelp.com/threads/354425-Hi8-capture-using-Digital8-camcorder-Edge-color-issues/page2?highlight=discolored+edge#post2677115
# modified & added stuff for my needs
import vapoursynth as vs
import havsfunc as haf
import adjust
core = vs.core
core.std.LoadPlugin(path="/usr/local/lib/libmvtools.so")
core.std.LoadPlugin(path="/usr/lib/x86_64-linux-gnu/libffms2.so.5")
core.std.LoadPlugin(path="/usr/local/lib/libfmtconv.so")
core.std.LoadPlugin(path="/home/render/vapoursynth/vapoursynth-temporalsoften2/build/libtemporalsoften2.so")
core.std.LoadPlugin(path="/home/render/vapoursynth/vs-miscfilters-obsolete/build/libmiscfilters.so")
core.std.LoadPlugin(path="/home/render/vapoursynth/znedi3/vsznedi3.so")
core.std.LoadPlugin(path="/home/render/vapoursynth/VapourSynth-EEDI3/build/libeedi3m.so")
core.std.LoadPlugin(path="/usr/local/lib/libnnedi3.so")
core.std.LoadPlugin(path="/home/render/vapoursynth/VapourSynth-NNEDI3CL/build/libnnedi3cl.so")
clip = core.ffms2.Source(source=file)
## a) Crop extra pixels, noise, headswitching noise included in captured format
# https://web.archive.org/web/20191026141308/https://bjohas.de/wiki/Tutorials/Video/Pixel_Aspect_Ratio
# https://web.archive.org/web/20050404092907/http://www.bbc.co.uk/commissioning/branding/picturesize.shtml
# https://bavc.github.io/avaa/artifacts/head_switching_noise.html
clip = core.std.Crop(clip, 12, 10, 6, 10)
## b) correct the broken u,v channels at the right edge coming from the D8 camcorder during PAL Hi8 playback
# https://forum.videohelp.com/threads/354425-Hi8-capture-using-Digital8-camcorder-Edge-color-issues
badPixelsv = 15
badPixelsu = 5
y = core.std.ShufflePlanes(clips=clip, planes=0, colorfamily=vs.GRAY)
u = core.std.ShufflePlanes(clips=clip, planes=1, colorfamily=vs.GRAY)
v = core.std.ShufflePlanes(clips=clip, planes=2, colorfamily=vs.GRAY)
v = core.std.Crop(v, 0, badPixelsv, 0, 0)
u = core.std.Crop(u, 0, badPixelsu, 0, 0)
# Stretch V channel to the right
extrav= core.std.CropAbs(v, 2, v.height, v.width-2).resize.Point(badPixelsv, v.height)
v = core.std.StackHorizontal([v, extrav])
# Stretch U channel to the right
extrau = core.std.CropAbs(u, 2, u.height, u.width-2).resize.Point(badPixelsu, u.height)
u = core.std.StackHorizontal([u, extrau])
# merge Y,U,V planes again
clip = core.std.ShufflePlanes(clips=[y, u, v], planes=[0, 0, 0], colorfamily=vs.YUV)
## c) Deinterlace
clip = haf.QTGMC(clip, Preset='Slower', TFF=True)
## d) Resizing/Upscaling to square pixels for 4:3
#clip = core.resize.Bicubic(clip, 768, 576)
#clip = core.resize.Bicubic(clip, 1440, 1080).std.AddBorders(240, 240, 0, 0, color=[0, 128, 128])
#clip = core.resize.Bicubic(clip, 1440, 1080)
clip = core.resize.Spline64(clip,1440,1080,matrix_s="709")
clip = core.nnedi3cl.NNEDI3CL(clip, 0, dh=False, dw=False, planes=[0, 1, 2], nsize=0, nns=4, qual=2, etype=0, pscrn=2, device=-1, list_device=True, info=True)
clip.set_output()