View Full Version : De-Interlacing of the Top Fields or The Lower Fields
papcom
6th July 2015, 18:06
I have an anaolg recording of a VHS machine where one of the heads was dirty. So one Field is clean and the other is dirty. In the mix there is a dirty/grainy picture. I think that when I remove e.g. the unpaired fields (top field) then my video is clean again. Of course this would lead to a lower resolution but that would not matter with the content of this old VHS.
Has anyone of You a suggestion how I can remove the top fields or the lower fields and then double the remaining proper fields in order to have a clean video as a result?
johnmeyer
6th July 2015, 18:20
Something like this was just posted today over at the Videohelp forum:
Replace bad field with good field (http://forum.videohelp.com/threads/372754-Any-way-to-improve-vid-quality-from-DVD-discs?p=2398684&viewfull=1#post2398684)
It does a few things that you don't need to do, but it demonstrates the concept. The general idea is as follows:
1. Use separatefields to get the even and odd fields as separate, half-height frames.
2. Use motion estimation (I use MFlowFPS rather than the function he uses) to double the frame rate of the good field.
3. Use SelectEvery() to select just the motion estimated fields from the result of #2.
4. Interleave that result with the good field.
This takes care of aligning the motion estimated version in time, but further work would be needed to estimate the result spatially. I'm not sure how to do that.
Groucho2004
6th July 2015, 18:20
SeparateFields()
SelectEven() #or SelectOdd()
nnedi3(dh = true, nns = 4, qual = 2) #adjust nns and/or qual as needed, the current values are for max. quality
John's method above is of course much better. :)
ChiDragon
6th July 2015, 19:03
Of course this would lead to a lower resolution but that would not matter with the content of this old VHS.
VHS records full-resolution picture height (with extra noise); only horizontal resolution is compromised. And John's post alludes to the other issue you have to account for, which is that dropping a field actually means you're losing temporal resolution. Of course if the original source is something like very soft animation, neither of these may be a concern.
johnmeyer
7th July 2015, 01:18
This is an attempt to provide a way to do both spatial and temporal interpolation on the good field, and then use the result of this effort to replace the bad field.
#Replace Bad Field With Motion Estimated Field from Good Field.avs
#John H. Meyer
#Copyright © 2015 John H. Meyer
#
source = AVISource("e:\fs.avi").assumetff()
fields = SeparateFields(source)
even = SelectEven(fields)
odd = SelectOdd(fields)
#Change the following to point to the good field
good = odd
#good = even
# Double the height to create spatial interpolation
double_height = Spline36Resize(good,good.width,good.height*2)
#Double the frame rate to create temporal interpolation
estimated_clip = DoubleFPS2(double_height)
#Keep only the motion-interpolated fields
replacement_fields = estimated_clip.selectodd().assumeframebased().separatefields().selectodd()
#Interleave the good field with the synthesized field
Interleave(good,replacement_fields)
#Create interlaced, final output
final=Weave()
#Return the fixed video
return final
#-------------------------------
#Debugging functions
#Before you start, enable this next line temporarily so you can see which field is the good field
#stackvertical(even,odd)
#When you are almost finished, enable this next line temporarily to check your work
#return final.SeparateFields
#------------------------------------
function DoubleFPS2(clip source) {
super = MSuper(source, pel=2)
back = MAnalyse(super, chroma=false, isb=true, blksize=16, overlap=4, searchparam=3, plevel=0, search=4)
forw = MAnalyse(super, chroma=false, isb=false, blksize=16, overlap=4, searchparam=3, plevel=0, search=4)
# MBlockFPS(source, super, back, forw, num=2*FramerateNumerator(source), den=FramerateDenominator(source), mode=0,thSCD2=130,thSCD1=400)
# Alternate motion estimation.
MFlowFPS(source, super, back, forw, num=2*FramerateNumerator(source), den=FramerateDenominator(source),thSCD2=130,thSCD1=400)
}
papcom
8th July 2015, 13:23
thank You johnmeyer for Your Field Repair Script. I am experimenting with different Parameters and combinantions with restore and resize - the results are encouraging. Thanks a lot for Your helpful Input.
BTW ...what exactely means the Copyright remark in Your script.
johnmeyer
8th July 2015, 14:05
BTW ...what exactely means the Copyright remark in Your script.I have learned, from long experience, that it is very important to stake a claim to any work that you have done. For instance, even though I am making this work available to everyone, and obviously am not expecting anyone to compensate me for the work I post in this forum, if a commercial entity were to use this, then I'd expect something.
For a ten-line script, a copyright notice is probably over the top and not really needed, but it is a good habit.
In case you think this is really stupid, or just some strange guy who does things because he read it in a book somewhere, I have negotiated over half a dozen deals in the past four years for movie film that I have posted on YouTube. Those are also copyrighted.
I spent the second half of my career in the computer software industry, back in the 1980s and early 1990s. The only protection we had against piracy was the copyright law (software patents had not yet been invented). I have great respect for intellectual property rights.
papcom
8th July 2015, 14:40
@johnmeyer - I understand You very well. I asked the question because I was unsure about what You wanted to express with the Copyright hint.
colours
8th July 2015, 17:08
For a ten-line script, a copyright notice is probably over the top and not really needed, but it is a good habit.
Well actually, it's never needed because the Berne Convention, which is recognised approximately everywhere (https://commons.wikimedia.org/wiki/File:Berne_Convention_signatories.svg), says that everything copyrightable is automatically copyrighted.
If you wanted to be anal about muh intellectual property, you'd have to state that the script you posted is "free for personal or noncommercial use", or something along those lines. Otherwise, we'd have no right to use your script by copying it into a file.
There's no reason to explicitly assert your copyright while not providing any terms under which we can use your script, so either (i) provide terms, or (ii) don't put a meaningless copyright statement.
johnmeyer
8th July 2015, 17:36
Well actually, it's never needed because the Berne Convention, which is recognised approximately everywhere (https://commons.wikimedia.org/wiki/File:Berne_Convention_signatories.svg), says that everything copyrightable is automatically copyrighted.
If you wanted to be anal about muh intellectual property, you'd have to state that the script you posted is "free for personal or noncommercial use", or something along those lines. Otherwise, we'd have no right to use your script by copying it into a file.
There's no reason to explicitly assert your copyright while not providing any terms under which we can use your script, so either (i) provide terms, or (ii) don't put a meaningless copyright statement.Fair enough. Good points.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.