Log in

View Full Version : De-Interlacing and Removing noise


magnatique
23rd March 2005, 01:57
Hey Guys! Thanks to StickBoy, I was able to manage a way to add a logo on top of my video every XXXX frame as I needed to do. I'm now trying to research what the most common tools for de-interlacing and removing noise are.... as I have hours of footage to encode, which is for the most part ntsc video interlaced (29.97).



First question, is it safe to leave de-interlacing on for all d2v projects, even if some of them might not be interlaced? how about for removing noise?

second of all, I see 3 ways of de-interlacing and removing noise on files created by Gordian Knot... which would be the most common to use to do a good job, or should I use some other ones that would do a better job?

here's what it gives...
-------------------
# DEINTERLACING (1)
#FieldDeinterlace()
#FieldDeinterlace(blend=false)
#TomsMoComp(1,5,1)

# DEINTERLACING (2)
#KernelDeInt(order=1,sharp=true)
# or maybe
#DGBob(order=1,mode=0)

# DEINTERLACING (3) - special requests
#GreedyHMA(1,0,0,0,0,0,0,0)
#Telecide()
#SeparateFields()


# 1) little noise
#Temporalsoften(2,3,3,mode=2,scenechange=6)
#mergechroma(blur(1.3))
#FluxSmoothST(5,7)

# 2) medium noise
#Temporalsoften(3,5,5,mode=2,scenechange=10)
#Convolution3d("moviehq")
#FluxSmoothST(7,7)

# 3) heavy noise
#Temporalsoften(4,8,8,mode=2,scenechange=10)
#Convolution3d("movielq")
#FluxSmoothST(10,15)
-------------------


Finally, here's a partial copy of my script. am I missing anything important? is my pluggin order proper, or should I move some stuff like de-interlacing up or down the list?





# SOURCE
video=mpeg2source("S:\dvds\shap\tct01\tct01.d2v")
audio=WAVsource("S:\dvds\shap\tct01\tct01.wav")
z = AudioDub(video,audio)
#LOGO
logo = JDL_ImageSource("X:\media\logo.jpg", fps=z.FrameRate())
logoMask = JDL_ImageSource("X:\media\logo-mask.jpg", fps=z.FrameRate())
logoMask = logoMask.Loop(900).FadeIO(10)
logoMask = logoMask.LengthenClip(3000)
logoMask = logoMask.Loop()


Overlay(z, logo,
\ x=(z.Width() - logo.Width()),
\ y=(z.Height() - logo.Height()),
\ mask=logoMask, opacity=0.5)
#TRIM
Trim(17000,20600)

# RESIZING
LanczosResize(640,480)
# NOISE
Temporalsoften(2,3,3,mode=2,scenechange=6)
mergechroma(blur(1.3))
FluxSmoothST(5,7)
#DE-INT
FieldDeinterlace()
FieldDeinterlace(blend=false)
TomsMoComp(1,5,1)

Undot()



THANKS EVERYONE! you guys have been a tremendous help and I enjoy learning more and more about video encoding this way :)

ShawnFumo
23rd March 2005, 17:47
While I don't know anything about noise settings, I think I can help with some other issues in this.

First of all, if you want to have a de-interlaced result (like a DivX file to play on computer), that should be one of the first thing you do to the video. Especially resizing before de-interlacing can cause bad things to happen, but it also affects the overlay. You'll end up losing some of the quality of the overlay if you do that before the de-interlace.

Also, you only want one of those de-interlacing commands. FieldDeinterlace is a "smart" de-interlacer that keeps the same framerate that you started with. It tries to detect which areas are moving and either interpolate or grab fields from the previous frame (to add detail in nonmoving areas).

TomsMoComp is the same, but also uses motion compensation. That means that sometimes it can also get data from previous frames even in moving areas. You'd probably just want this one.

Now the KernalBob and DGBob double the frame rate. If you started at 30fps, you'll get a 60fps result. Since fully interlaced footage (like DV) actually records fields in a half a frame time period, the motion is actually twice as smooth as the framerate. So the only way to keep that smoothness of motion is to either double the framerate or blend the fields together (which causes blurring in motion areas).

If you go that route, you may want to investigate Tdeint, which (like TomsMoComp) uses motion compensation.

Also, I'm not sure what your source file is, but you may want to change the order on some of the other steps. Like trim the clip first (less for the rest to work on). Then resize it and denoise (faster to resize first but not sure if quality is better if you reverse that). Then add the overlay last. That keeps any of the denoising filters from affecting the overlay, which is probably perfect quality already.

Maybe somthing like this?


# SOURCE
video=mpeg2source("S:\dvds\shap\tct01\tct01.d2v")
audio=WAVsource("S:\dvds\shap\tct01\tct01.wav")
z = AudioDub(video,audio)

# TRIM
Trim(17000,20600)

# DE-INT
TomsMoComp(1,5,1)

# RESIZING (maybe do denoise first?)
LanczosResize(640,480)

# NOISE
Temporalsoften(2,3,3,mode=2,scenechange=6)
mergechroma(blur(1.3))
FluxSmoothST(5,7)
Undot()

# LOGO
logo = JDL_ImageSource("X:\media\logo.jpg", fps=z.FrameRate())
logoMask = JDL_ImageSource("X:\media\logo-mask.jpg", fps=z.FrameRate())
logoMask = logoMask.Loop(900).FadeIO(10)
logoMask = logoMask.LengthenClip(3000)
logoMask = logoMask.Loop()

# Overlay the logo
Overlay(z, logo,
\ x=(z.Width() - logo.Width()),
\ y=(z.Height() - logo.Height()),
\ mask=logoMask, opacity=0.5)


Hope that helps,
Shawn

Edit: kernaldeint->kernalbob

jstelly
23rd March 2005, 18:40
I'm completely new to all of this, but I was playing around with a few different plugins for deinterlacing some different sources. Family Guy (animated), Sports Night (TV, NTSC), The Day After Tomorrow (FILM, NTSC), From The Earth To The Moon (TV miniseries, mixed TV / FILM NTSC). The one that looked the best for all 4 sources was Neuron2's Decomb plugin. Keep in mind that I'm new to all of this, so I might be missing something, but my basic deinterlace script is below.


loadplugin("DGDecode.dll")
loadplugin("Decomb521.dll")

mpeg2source("source.d2v")
Telecide(guide=1,order=1)
Decimate(cycle=5,mode=3)

magnatique
23rd March 2005, 18:46
that's of great help shaun!


makes a lot of sense for the order of things, now that I think of it I am wondering howcome it didn't occur to me earlier hehe


My sources are both from NTSC dvds, as well as from Mini Dv's captured to the computer...

should I use two different methods of de-interlacing for the different sources?

IE for the dvds, use TomsMoComp, but for the minidvs double up the fps?

magnatique
23rd March 2005, 18:48
Originally posted by jstelly
I'm completely new to all of this, but I was playing around with a few different plugins for deinterlacing some different sources. Family Guy (animated), Sports Night (TV, NTSC), The Day After Tomorrow (FILM, NTSC), From The Earth To The Moon (TV miniseries, mixed TV / FILM NTSC). The one that looked the best for all 4 sources was Neuron2's Decomb plugin. Keep in mind that I'm new to all of this, so I might be missing something, but my basic deinterlace script is below.


loadplugin("DGDecode.dll")
loadplugin("Decomb521.dll")

mpeg2source("source.d2v")
Telecide(guide=1,order=1)
Decimate(cycle=5,mode=3)


from reading a lot on the subject lately, I would think that most of your sources were actualy with telecline, where you used IVTC to get rid of the extra half frames... using telecide on a true interlaced source won't change much from what i understood... but I could be wrong too ;)

magnatique
23rd March 2005, 23:35
uhm, looks like I can't trim before I do the logo overlay, avisynth crashes everytime...

ShawnFumo
24th March 2005, 05:39
Hmmm... I haven't actually used overlay yet, so not sure what is up with the crashing. Weird.

For the de-interlacing, jstelly brings up a good point. It'll actually depend on the source. My mind was in DV, so that colored my response before.

If you recorded the mini dv directly with the camera, then it is true interlaced material and needs something like tomsmocomp or tdeint.

But something from a DVD could be various things. :devil: If it was originally a theatrical film, you can probably use an IVTC filter (inverse telecine). Telecining is a process of changing a progressive 24fps film into interlaced 30fps video. In that case, you can transform it back (with IVTC) into progressive 24fps video with good quality. Of course integrating that in with 30fps video is another story that other people know more about than I do..heh

There's also a chance the DVD was progressive to begin with (all the hoopla about progressive scan dvd players), though it is a bit rarer. In that case, you may not have to do anything to it. :)

TV is another ballpark that I know little about. I know it can get really confusing if you capture directly from satellite, since it can switch between interlaced and progressive at the drop of a hat. I'm not sure what the deal is if you captured TV or VHS through a DV camera though...

But yeah, you'll probably want a different de-interlacer for a DVD movie versus something you filmed on DV yourself.

Shawn

Leak
24th March 2005, 09:03
Originally posted by ShawnFumo
Now the Kernaldeint and DGBob double the frame rate. If you started at 30fps, you'll get a 60fps result.

Just a minor nitpick here, but KernelDeint doesn't double the framerate. KernelBob, on the other hand, does.

ShawnFumo
24th March 2005, 19:33
Originally posted by Leak
Just a minor nitpick here, but KernelDeint doesn't double the framerate. KernelBob, on the other hand, does.

Oops! You have a good eye. :)

magnatique
29th March 2005, 19:41
I cracked what the crashing was... I am using the latest beta since 2.55 has an issue with overlays, it makes em upside down sometimes...

well, in the beta, there is no warning or info as to what is going on, so I installed 255 back to see what the errors were...

it seems since I was using z as my video+audio name in the script, that the other functions would look for "c" and therefor return an error... I added the z variable to the resize, trim, deint, etc... and now it works perfect in this order :

Input Files
De-Int
De-Noise
Resize
Logo



now, is there anyway to modify the brightness and contrast easily within the script?

Boulder
29th March 2005, 20:29
Originally posted by magnatique
now, is there anyway to modify the brightness and contrast easily within the script?
There's a good documentation installed on your computer along with Avisynth 2.5;)