Log in

View Full Version : Advice humbly requested on optimal filter order.


3hj
27th August 2014, 11:55
Hello.

I have a non-profit film project I'm doing, with the intention of releasing it for free download/streaming online. This film is going to be cobbled together from a multitude of sources:

- 1080p HDV footage
- SD DVCam footage
- 2nd-gen VHS camcorder footage
- Hi-8 camcorder footage

I figure the prudent thing to do would be to release this project in 720p, because (a) I've seen some astonishingly good results with upscalers here and elsewhere on the internet but (b) I think upscaling VHS to 1080p is probably a bit too much of a stretch.

My question is about the 'optimal' order of filters, which ones to put in which order to get the best results. At some point, I'm going to use the following filters on the footage (the HDV footage will probably remain as-is, since it's pretty pristine):

- upscaling to 720p
- cropping (removing useless black/garbage outer edges on the VHS footage; turning all 4:3 images into 16:9)
- deinterlacing (all the VHS footage and some of the DVCam footage is interlaced)
- deblocking (some of the DVCam stuff has lossy DivX compression on top of the original MPEG-2 captures and has noticeable artifacting)
- de-noising (some of the VHS footage is quite noisy, and some of the DVCam footage was shot in low-light and is quite grainy)
- general de-VHS-ugliness'ing (seems to be a lot of filter chains built specifically around making VHS footage more pleasing, so I'll be investigating and probably including stuff like that as well)
- levels/brightness/contrast adjustment
- colour correction/colour grading
- sharpening where needed (not sure if upscaling would negate needing to do this?)

Might be subjected to some minor adjustments and filtering otherwise, but I think the above will be pretty much everything I'll be doing with AviSynth.

So. In what order would I stack these to get the best results? My assumption would be levels+colour correction -> deinterlace -> deblock -> denoise -> sharpening -> upscaling -> cropping, but this is just my gut feel, and I'm not too knowledgeable on the intricacies of filtering. What would you suggest? Any info/hints will be greatly appreciated.

Also, would I want to do the filtering before editing the footage together, or after? I would assume beforehand, but again, beginner knowledge and all that.

Thanks.

bxyhxyh
27th August 2014, 13:11
Sharpening should be after upscaling or before downscaling.
Upscaling sharpened video can be "upscale" artifacts caused by sharpeners.
Same for levels/colour correction.
Also I think cropping should be done before resizing. Black borders can be recognized as line then there can be ring/halo artifacts.

So my recommendation is
deinterlace -> denoise -> deblock -> cropping -> upscaling -> sharpening -> levels+colour correction

feisty2
27th August 2014, 13:22
1. sharpen (separatefields first and do limit the sharpdif so artifacts and noise will not get worsened)
2. color adjustments (16bpc precision, same as 1, separatefields first, then adjust)
3. denoise/deblock (separatefields then denoise/deblock)
4. deinterlace
5. upscale

bxyhxyh
27th August 2014, 13:27
3. denoise/deblock (separatefields then denoise/deblock)
4. deinterlace


I think this destroys more detail than deinterlace + denoise.

feisty2
27th August 2014, 13:32
sharpening should be performed on the original clip before any other filters,
your clip will easily be oil painted look like if sharpen a denoised clip
color adjustments should be performed before denoising
you may find some residual noise/dirty spots if denoise first then lighten the color

feisty2
27th August 2014, 13:38
I think this destroys more detail than deinterlace + denoise.

deinterlacing WILL affect the original noise pattern, so will affect the denoise effect
however, denoise first is harmless to deinterlace

fvisagie
29th August 2014, 13:48
If you have a long, quiet day at the office to kill, consider reading this thread: http://forum.videohelp.com/threads/354292-Preparing-this-Rec-601-YV12-clip-for-Rec-709-MPEG-2-encoding. It covers this and other issues pertinent to working with multiple sources of the types you mention, such as taking into account DV vs. MPEG chroma placement, translating between the SD Rec.601 and HD Rec.709 colourspaces, the luma (and perhaps chroma) correction you mention, etc.

For what it's worth at this point, for interlaced material the most important rule is always to deinterlace before doing ANYTHING that changes vertical geometry (e.g. resize and crop), and/or that makes assumptions about vertical information being from the same point in time (e.g. subtitles) and/or is generally interlacing unaware. For example, denoising interlaced material is debatably damaging - spatial denoising will spatially blur information between fields originally from different points in time, and temporal denoising will similarly not account for true movement between fields. In various threads (if not in the one above) jagabo has explained why not even separated-field work-arounds are generally suitable.

The filter sequence you suggest seems largely safe from that point of view, except that some purists would argue that giving the deinterlacer less-than-original field information after levels and chroma correction is sub-optimal.

feisty2
29th August 2014, 15:04
If you have a long, quiet day at the office to kill, consider reading this thread: http://forum.videohelp.com/threads/354292-Preparing-this-Rec-601-YV12-clip-for-Rec-709-MPEG-2-encoding. It covers this and other issues pertinent to working with multiple sources of the types you mention, such as taking into account DV vs. MPEG chroma placement, translating between the SD Rec.601 and HD Rec.709 colourspaces, the luma (and perhaps chroma) correction you mention, etc.

For what it's worth at this point, for interlaced material the most important rule is always to deinterlace before doing ANYTHING that changes vertical geometry (e.g. resize and crop), and/or that makes assumptions about vertical information being from the same point in time (e.g. subtitles) and/or is generally interlacing unaware. For example, denoising interlaced material is debatably damaging - spatial denoising will spatially blur information between fields originally from different points in time, and temporal denoising will similarly not account for true movement between fields. In various threads (if not in the one above) jagabo has explained why not even separated-field work-arounds are generally suitable.

The filter sequence you suggest seems largely safe from that point of view, except that some purists would argue that giving the deinterlacer less-than-original field information after levels and chroma correction is sub-optimal.

you can surely interpolate every fields to full frames with eedi3 and do denoise, sharpen all those stuff and simply discard the interpolated fields and weave the source fields together at the end of everything before deinterlacing if you worry about even separatefields first is not right


#interlaced input#
separatefields ().assumeframebased ()
bot=selecteven ().eedi3 (field=0,dh=true,sclip=selecteven ().nnedi3 (field=0,dh=true))
top=selectodd ().eedi3 (field=1,dh=true,sclip=selectodd ().nnedi3 (field=1,dh=true))
interleave (bot,top)
#sharpen, denoise, blah blah...#
bot=selecteven ().separatefields ().selecteven ().assumefieldbased ()
top=selectodd ().separatefields ().selectodd ().assumefieldbased ()
interleave (bot,top).assumebff ()
weave ()
#deinterlace#


EDIT: Fixed field temporal shift

StainlessS
29th August 2014, 16:01
Some denoise filters have an Interlaced arg (or similar) eg FFT3DFilter (spacio/temporal) and VagueDenoise (Spacial).
Also, Stickboy's jdl-interlace.avsi has JDL_UnfoldFieldsVertical, and JDL_FoldFieldsVertical (using flip arg), used to apply
spatial filters to interlaced material.
http://www.avisynth.nl/users/stickboy/

feisty2
29th August 2014, 16:17
Some denoise filters have an Interlaced arg (or similar) eg FFT3DFilter (spacio/temporal) and VagueDenoise (Spacial).
Also, Stickboy's jdl-interlace.avsi has JDL_UnfoldFieldsVertical, and JDL_FoldFieldsVertical (using flip arg), used to apply
spatial filters to interlaced material.
http://www.avisynth.nl/users/stickboy/

as far as I'm concerned, all these filters just do separatefields function or things similar internally, which fvisagie thinks is wrong

poisondeathray
29th August 2014, 17:03
Everyone has their own way of doing things, you have to determine what works best for your particular scenario

Separatefields() is "technically wrong" because of the even/odd vertical field offset. Even/Odd fields are not vertically aligned

Even if you group even/odd separate fields, and filter that way, then interleave and weave - then use of temporal filters is technically "wrong" and less effective, because in bobbed sequence, you will be filtering 0,2,4,6... separately from 1,3,5,7.... ie. there will be no temporal filtering between even and odd, only within




you can surely interpolate every fields to full frames with eedi3 and do denoise, sharpen all those stuff and simply discard the interpolated fields and weave the source fields together at the end of everything before deinterlacing if you worry about even separatefields first is not right


#interlaced input#
separatefields ().assumeframebased ()
bot=selecteven ().eedi3 (field=0,dh=true,sclip=selecteven ().nnedi3 (field=0,dh=true))
top=selectodd ().eedi3 (field=1,dh=true,sclip=selectodd ().nnedi3 (field=1,dh=true))
interleave (bot,top)
#sharpen, denoise, blah blah...#
bot=selecteven ().separatefields ().selecteven ().assumefieldbased ()
top=selectodd ().separatefields ().selectodd ().assumefieldbased ()
interleave (bot,top).assumebff ()
weave ()
#deinterlace#


EDIT: Fixed field temporal shift



Did you realize that you're essentially "double rate deinterlacing" by separating , interleaving the EDI "resized" fields ? ie You're supporting what fvisagie said

So why are you deinterlacing, re-interlacing then deinterlacing again ? Seems like a lot of extra steps ?

feisty2
29th August 2014, 17:13
the difference is a lot of people like to use advanced deinterlace/bob script like qtgmc, those scripts will not keep the original fields, there are new fields interpolated, but the original fields are altered as well, this method will not do anything to the original fields if you leave that #denoise xxxx#part empty

poisondeathray
29th August 2014, 17:31
the difference is a lot of people like to use advanced deinterlace/bob script like qtgmc, those scripts will not keep the original fields, there are new fields interpolated, but the original fields are altered as well, this method will not do anything to the original fields if you leave that #denoise xxxx#part empty



Yes, that will keep original fields.. But who said anything about keeping original fields?

He wants to deinterlace and upscale, and he's filtering anyways - so not keeping original fields

Or maybe you implying that filtering should be done on original fields ?

feisty2
29th August 2014, 17:34
Yes, that will keep original fields.. But who said anything about keeping original fields?

He wants to deinterlace and upscale, and he's filtering anyways - so not keeping original fields

Or maybe you implying that filtering should be done on original fields ?

personally, I think it's quality wise to use sharpen or denoise kinda stuff on original fields and that's the whole point why I order like that, to get the best quality