Log in

View Full Version : Troublesome analog master - differing geometry between fields


Lyris
8th May 2012, 20:53
Hi forum,
There is so much wrong with this master I've been handed that I want to put it to the forum to see if anyone has an alternative strategy for dealing with it. Really, this is special.

77-frame clipping indicating a scene change (81mb): http://www.mediafire.com/?2n0afoo6cj0jaw4

The source is PAL, 50i, Betacam SP. The telecine is out of phase unlike most PAL transfers. So one film frame is split across two video frames.

That's easy to fix, I used this code:

avisource("xxxxx.avi")
convertTOyv12(interlaced=true)

#Correct the out of phase telecine by separating fields->frames and deleting first frame, then reinterlacing
assumeTFF()
separatefields
deleteframe(0) #Knock things back into phase
weave()

But it gets weirder. If we comment out the 'weave' command we can see that both fields have different geometry! :eek: Which is why we have saw-tooth interlacing artefacts around the edges when we view the video as progressive.

So far I haven't been able to deal with this in any intelligent way. I experimented in Photoshop and pasted both fields in to a document and used the "Auto Align" feature to see if the second field could be warped to better match the first. It wasn't too successful. Even if it was, I'm not sure if I'd be able to automate that for half of the fields in the film.

Anyway, here's the rest of my script:


chubbyrain2() #Clean out composite rainbows, works best at FRAME level - be careful of artefacts
stab() #correct telecine jitter

#Noise Reduction combo:
source = last
pred = source # to get stronger denoising, put denoisers here, they will change how motion vectors are predicted

backward_vec2 = pred.MVAnalyse(isb = true, delta = 2, pel = 2, overlap=4, sharp=2, idx = 1, truemotion=true)
backward_vec1 = pred.MVAnalyse(isb = true, delta = 1, pel = 2, overlap=4, sharp=2, idx = 1, truemotion=true)
forward_vec1 = pred.MVAnalyse(isb = false, delta = 1, pel = 2, overlap=4, sharp=2, idx = 1, truemotion=true)
forward_vec2 = pred.MVAnalyse(isb = false, delta = 2, pel = 2, overlap=4, sharp=2, idx = 1, truemotion=true)

maskp1 = mvmask(kind=1, vectors=forward_vec1, ysc=255).UtoY()
maskp2 = mvmask(kind=1, vectors=forward_vec2).UtoY()
maskp3 = mvmask(kind=1, vectors=backward_vec1, ysc=255).UtoY()
maskp4 = mvmask(kind=1, vectors=backward_vec2).UtoY()
maskf = average(maskp1, 0.25, maskp2, 0.25, maskp3, 0.25, maskp4, 0.25).spline36resize(source.width, source.height)

smooth = pred.fft3dGPU(bw=16, bh=16, ow=8, oh=8, bt=1, sigma=4, plane=0)
source2 = maskedmerge(source, smooth, maskf)

source3 = source2.MVDegrain2(backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400,idx=2)
source3
# ttempsmooth(maxr=7)
# gradfun2db(1.51)

#So now we have the fields aligned, but each field has different geometry!!!
#A combination of anti-aliasing and deinterlacing (eugh) seems to be the best way...

antialiasing(th_luma=1)

#This in itself isn't enough to cure the saw-tooth artefacts,
#so deinterlacing as a last resort:

QTGMC( Preset="very slow" )
SelectEven() #to get original frame rate

Sharpen(0.5, 0.5)
#Sharpen(1,1)

#Fix the too high black level
levels(10,1,255,0,255) #in,gamma,out,in,out


#TO DO later: dirt and scratch filtering + add some grain


The dirt and scratches are easy enough to take care of later. As you can see I resorted to just deinterlacing. Can anyone suggest a better way?

Problems that I am still left with:

* Although the rainbows can be taken care of, I'm left with dot crawl around some edges.
* There is a "diamond-like" crawling pattern in some coloured areas which obviously only gets worse with sharpening.

Does anyone have a better suggestion at any step?


Beta SP is component so I'm also not sure why there are composite artefacts in this... perhaps it's a dub from some older format.

Mounir
8th May 2012, 21:18
error: couldn't decompress fourcc v210

Guest
8th May 2012, 22:53
[bump after re-open]

poisondeathray
8th May 2012, 23:03
error: couldn't decompress fourcc v210

You need a v210 decoder (uncompressed 10bit 4:2:2), standard windows doesn't come with one

You can open it with ffms2

FFVideoSource("SAMPLE.avi")

Lyris
8th May 2012, 23:35
Lagarith YUY2 sample if that's any help:

http://www.mediafire.com/?a0e5ygyh9on7ysa

Mounir
9th May 2012, 00:50
I prefer lagarith yeah

For the lines/telecine i don't know for the colors you should try camcoder color denoise (desaturate)
AVISource("C:\Users\lin\Desktop\SAMPLE_LAGS.avi")
assumeTFF()
separatefields
deleteframe(0) #Knock things back into phase
ConverttoRGB32(matrix="rec601",interlaced=false)
LoadVirtualDubPlugin("C:\Program Files (x86)\virtualdub1.9\plugins\Camcorder_Color_Denoise_sse2.vdf","CCD",1)
CCD(15,1) # from 0 to 100, defaut is 30 (higher than 30 desaturate too much in general, 15 ok here
ConverttoYV12(matrix="Rec601",interlaced=false)
weave()

Mounir
9th May 2012, 01:23
For the denoising part i give you my script, and well you adapt it (2pics before/after included)
http://depositfiles.com/files/y8eecfid7

Lyris
9th May 2012, 16:47
Thanks Mounir, I'll have a look at that VirtualDub filter.

My primary concern is seeing if there's any way of getting the two fields to match into a progressive frame somehow.

Does anyone out there with experience in old telecine systems know why the two fields have different geometry? Is this some sort of polygonal system?

Lyris
10th May 2012, 02:50
Mounir: that is a NICE denoising script! Thanks very much.

Just one problem. It doesn't seem to be aware of scene cuts. At the beginning and end of a scene, there's a warping/interpolation effect. Is there any way to fix that?

Mounir
10th May 2012, 05:32
I don't see, maybe it's the chroma bleeding part in the script that's causing this ?

Upload a picture to see what this look like thanks

This script is designed to keep as much detail as possible and remove effectively artefacts, it took me some time to find the good filters.
I use it for my vhs tapes mainly (although there is a color correction part i didn't include but your source is high quality unlike vhs...)