View Single Post
Old 14th August 2019, 18:24   #5  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,869
I'm at work and I had very limited time and resources to play with your sample and I can only encode an XDCAM file as output (sadly), but would something like this be enough for you?

Original 1:



Encoded 1:



Original 2:



Encoded 2:



Original 3:



Encoded 3:




On a positive side, there are no spots or scratches in your recording, which is good 'cause doing despot and de-scratch doesn't always fix each and every one of them.
There's also no significant issues with the interlace: it's just a truly interlaced footage which can be bobbed to 50fps progressive without issues, except for the aliasing that it's created, which is annoying, but we can take care of that.
As to the luma, the footage itself is overshoot, which basically means that luma is out of range as you can see here:



There's no way to bring that wall back as the values are out of range, but even trying to bring it back to legal range, there's no detail anymore as it's been clipped out in the original source (you can see that by taking a look at the waveform).
As to the chroma, there's some work to do, but thankfully StainlessS made a very good filter that has become a "must use" whenever you wanna restore old sources: GamMac. (And I thank him every time I use it).
Unfortunately, there isn't much detail on your source, but there's dynamic noise and a bit of grain as well, so it really comes down to what you wanna do in this case: taking care of it at the expense of the details (not that there are many anyway) or leaving it as it is and accepting dynamic noise and grain in your source.

Please note that this is just a draft and I'm at work, so I have been forced to output an interlaced FULL HD XDCAM file with 8 PCM mono audio tracks out of your source, but this should give you an idea of what can be done with very little time:

Code:
#Indexing

video=FFVideoSource("tdk vhsc-sample.avi")
audiook=FFAudioSource("tdk vhsc-sample.avi")
audio=MergeChannels(audiook, audiook, audiook, audiook)
AudioDub(video, audio)



#Bob-deinterlace 25i to 50fps progressive

tdeint(mode=1, order=-1, field=-1, mthreshL=6, mthreshC=6, map=0, type=2, debug=false, mtnmode=1, sharp=true, cthresh=6, blockx=16, blocky=16, chroma=true, MI=64, tryWeave=true, link=1, denoise=true, slow=2, opt=4)


#Cropping out inactive lines of your SD source (overscan)
Crop(10, 4, -10, -4)

#Converting from yv12 to RGB, keeping BT601

ConverttoRGB(matrix="Rec601")


#Color correction

GamMac(dither=true, LockChan=-3, Scale=2, RedMul=1.0, GrnMul=1.0, BluMul=1.0, loTh=0.0, hiTh=0.0, LockVal=128, RngLim=12, GamMax=10.0, omin=16, omax=235, Show=false, Coords=false)


#Converting from RGB to yv16, keeping BT601

Converttoyv16(matrix="Rec601")


#Going from BT601 to BT709

Matrix(from=601, to=709, rg=1.0, gg=1.0, bg=1.0, a=16, b=235, ao=16, bo=235, bitdepth=8)


#Losslessly converting from yv16 to YUY2 (4:2:2 planar to 4:2:2 interleave)

ConverttoYUY2()


#Deflickering

antiflicker(window=25)


#Denoise

AdaptiveMedian(maxgrid=9)

PeachSmoother(NoiseReduction=40, Stability=30, DoSpatial=true, Spatial=110, Dot=false, Readout=false, ShowMotion=false, Debug=false)


#Antialiasing

AAA(Xres=700, Yres=568, Xshrp=20, Yshrp=0, Us=1, Ds=2, Chroma=true)


#Final degrain

xNLMeans()


#Adding borders to go to 1.33 PB (16:9)

AddBorders(154, 0, 154, 0)


#Upscale

nnedi3_rpow2(cshift="Spline64ResizeMT", rfactor=2, fwidth=1920, fheight=1080, nsize=4, nns=4, qual=1, etype=0, pscrn=2, threads=0, csresize=true, mpeg2=true, threads_rs=0, logicalCores_rs=true, MaxPhysCore_rs=true, SetAffinity_rs=false, opt=3)


#Clipping

Limiter(min_luma=16, max_luma=235, min_chroma=16, max_chroma=240)


#Loudness Correction

ResampleAudio(48000)
Normalize(0.22)
ConvertAudioTo24bit()


#Re-interlacing (50fps progressive to 25i)

assumeTFF()
separatefields()
selectevery(4,0,3)
weave()
Converttoyv16(matrix="Rec709", interlaced=true)

This is the result (encoded file): https://we.tl/t-ydUgXgNaep

Please beware that the reason why I didn't make much denoise is that it can really make everything look blurry and make details disappear.
This is what I mean by that:

Extreme Denoise + Highlights compression example (brutally encoded file): https://we.tl/t-tgH1ADGLRE

Please note that I did all this in legacy Avisynth 2.6.1 as you didn't specify whether you are using Avisynth+ or legacy Avisynth. If you are actually using the legacy Avisynth, I strongly suggest you to update, though. As to the upscale and re-interlace part, you could actually avoid it, as the only reason why I did it is that at work I gotta encode everything in XDCAM and I'm not sitting at my home personal computer (and team viewer is blocked of course for obvious reasons). As a matter of fact, I'm replying to you in a break between a program and another. :P

By the way, I'm not an expert in restoring old sources and there are people like videofred who do this kind of stuff on a daily basis, so hopefully they're gonna help you more than I did, but anyway, my script is just an example of what could be potentially done.

Cheers,
Frank.

Last edited by FranceBB; 14th August 2019 at 18:39.
FranceBB is offline   Reply With Quote