Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 27th July 2021, 16:49   #1  |  Link
19631981
Registered User
 
Join Date: Jul 2021
Location: UK
Posts: 5
Newbie help request

Hello all. I am very new to the wonderful AVISynth and its associated software. Please can I ask for some help advice?

Having watched a tutorial on YouTube, I have been successfully deinterlacing and upscaling some old TV shows in both PAL and NTSC. The vast majority of these are 4:3

I am incredibly happy with the out of the box results, however, many of the episodes are telerecordings/kinoscopes. Here a 16mm (sometimes 35mm) was pointed at a TV screen and the output of a TV show filmed. Whilst I have no issues with real noise and grain as I appreciate that its part of recordings' detail, the film prints and their subsequent damage or age, have a lot of noise and grain that I do not believe was there in the VT recording. Also damage like dust, hair and scratches are marring the images (see example episode attached)

Here is where I hope someone can help a dullard like me.

I can partially clean up using Neat Video and other tools, but I have read of plugins/filters that can be added to remove or partially mitigate the "faux" (for want of a better word) noise/grain problems and eliminate specks, dust, hair and so on, on random frames?

Here is the simple script I use, taken from this tut (https://www.youtube.com/watch?v=d4rLvpkBlnQ&t=2265s - i am aware there is a later version but I had issues running the second part of the conversion on my machine) and I wonder what filters I could add in (and between which lines) to remove grain, spots, scratches etc? Could anyone please copy and paste my script and add in the requisite code line(s) (if that is the term)

I have attached a link to a sample BW Doctor Who episode which shows most of the issues I would like to solve.

Thank you in advance and I do appreciate any helpful replies.

Script I use in AVSPMOD
SetFilterMTMode ("QTGMC", 2)
FFmpegSource2("title_t01.mkv", atrack=1)
ConvertToYV12()
AssumeTFF()
QTGMC(preset="Faster", EdiThreads=1)
Spline64Resize(1440,1080)
Prefetch(1)

Sample episode https://mega.nz/file/hepGCCxZ#Y6464U...RtNbhAcCcue6BM

I am running Windows 10, 64GB RAM, i7, and RTX1080 card.
19631981 is offline   Reply With Quote
Old 27th July 2021, 17:33   #2  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
Short version:

1. First, do IVTC (inverse telecine) to remove any repeated fields. You use TFM/TDecimate, which are part of the TIVTC plugin.

2. Then, use one of VideoFred's film restoration scripts.

http://forum.doom9.org/showthread.php?t=144271
johnmeyer is offline   Reply With Quote
Old 27th July 2021, 17:41   #3  |  Link
19631981
Registered User
 
Join Date: Jul 2021
Location: UK
Posts: 5
Quote:
Originally Posted by johnmeyer View Post
Short version:

1. First, do IVTC (inverse telecine) to remove any repeated fields. You use TFM/TDecimate, which are part of the TIVTC plugin.

2. Then, use one of VideoFred's film restoration scripts.

http://forum.doom9.org/showthread.php?t=144271
Thank you for your quick response.

As I mentioned I am a newbie and the coding is somewhat alien at the moment. Can you tell me where to place the TFM/Tdecimate filter? Also would removing the fields make it look like film as currently 25i to 50p retains the authentic "video" look in the motion?
19631981 is offline   Reply With Quote
Old 27th July 2021, 21:41   #4  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
I can't give you much help without a short clip. I don't have the time or bandwidth to download an entire 800 MB episode.

You need to "walk through" a few dozen frames after first separating into fields:

separatefields()

If you see no horizontal motion between any field pairs, then you do NOT need to do an IVTC. However, if you see three or more fields in a row with no horizontal movement, than that indicates repeats, and these must first be removed before you can get rid of the dirt and the grain and make the result look somewhat like the original video.

If these are PAL episodes, then you may not need to do this. If they are NTSC, then you probably will. (You said you have both).

BTW, I have done quite a bit of this, and when I first started discovering and perfecting the technique, I posted some of my scripts in this thread:

Kinescope restoration back to 60i
johnmeyer is offline   Reply With Quote
Old 27th July 2021, 21:44   #5  |  Link
19631981
Registered User
 
Join Date: Jul 2021
Location: UK
Posts: 5
Quote:
Originally Posted by johnmeyer View Post
I can't give you much help without a short clip. I don't have the time or bandwidth to download an entire 800 MB episode.

You need to "walk through" a few dozen frames after first separating into fields:

separatefields()

If you see no horizontal motion between any field pairs, then you do NOT need to do an IVTC. However, if you see three or more fields in a row with no horizontal movement, than that indicates repeats, and these must first be removed before you can get rid of the dirt and the grain and make the result look somewhat like the original video.

If these are PAL episodes, then you may not need to do this. If they are NTSC, then you probably will. (You said you have both).

BTW, I have done quite a bit of this, and when I first started discovering and perfecting the technique, I posted some of my scripts in this thread:

Kinescope restoration back to 60i
Hi John
The PAL footage does not have repeated fields and so I will look at your link, thanks. I was really interested in a) the filter required to remove the dirt etc and b on which line to put it in the first script I posted. Thanks for your assistance
19631981 is offline   Reply With Quote
Old 27th July 2021, 23:15   #6  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
MDegrain is good for the grain. Look up RemoveDirt() and also the RemoveDirtMC() function which uses motion estimation to improve the effectiveness of RemoveDirt(). You'll find scripts for both of them in that film restoration link I gave above.

Here are those two functions, as they appear inside my film restoration script (posted elsewhere in this forum).

You can use MDegrain simply by copy/pasting the sample code given in the MVTools2 documentation.

Code:
function RemoveDirt(clip input, int "limit", bool "_grey")
{
  clensed=input.Clense(grey=_grey, cache=4)
  alt=input.RemoveGrain(2)
  return RestoreMotionBlocks(clensed,input,alternative=alt,pthreshold=6,cthreshold=8, gmthreshold=40,dist=3,dmode=2,debug=false,noise=limit,noisy=4, grey=_grey)
}

function RemoveDirtMC(clip,int "limit", bool "_grey")
{
  _grey=default(_grey, false)
  limit = default(limit,6)

  prefiltered = RemoveGrain(clip,2)
  superfilt = MSuper(prefiltered, hpad=32, vpad=32,pel=2)

  super=MSuper(clip, hpad=32, vpad=32,pel=2)

  bvec = MAnalyse(superfilt,isb=true,  blksize=16, overlap=2,delta=1, truemotion=true)
  fvec = MAnalyse(superfilt,isb=false, blksize=16, overlap=2,delta=1, truemotion=true)

# Increase thSAD if moving objects are being removed
  bvec_re = Mrecalculate(super,bvec,blksize=8, overlap=0,thSAD=100)
  fvec_re = Mrecalculate(super,fvec,blksize=8, overlap=0,thSAD=100)

  backw = MFlow(clip,super,bvec_re)
  forw  = MFlow(clip,super,fvec_re)

  clp=interleave(forw,clip,backw)
  clp=clp.RemoveDirt(limit,_grey)
  clp=clp.SelectEvery(3,1)
  return clp
}
johnmeyer is offline   Reply With Quote
Old 28th July 2021, 00:01   #7  |  Link
19631981
Registered User
 
Join Date: Jul 2021
Location: UK
Posts: 5
Quote:
Originally Posted by johnmeyer View Post
MDegrain is good for the grain. Look up RemoveDirt() and also the RemoveDirtMC() function which uses motion estimation to improve the effectiveness of RemoveDirt(). You'll find scripts for both of them in that film restoration link I gave above.

Here are those two functions, as they appear inside my film restoration script (posted elsewhere in this forum).

You can use MDegrain simply by copy/pasting the sample code given in the MVTools2 documentation.

Code:
function RemoveDirt(clip input, int "limit", bool "_grey")
{
  clensed=input.Clense(grey=_grey, cache=4)
  alt=input.RemoveGrain(2)
  return RestoreMotionBlocks(clensed,input,alternative=alt,pthreshold=6,cthreshold=8, gmthreshold=40,dist=3,dmode=2,debug=false,noise=limit,noisy=4, grey=_grey)
}

function RemoveDirtMC(clip,int "limit", bool "_grey")
{
  _grey=default(_grey, false)
  limit = default(limit,6)

  prefiltered = RemoveGrain(clip,2)
  superfilt = MSuper(prefiltered, hpad=32, vpad=32,pel=2)

  super=MSuper(clip, hpad=32, vpad=32,pel=2)

  bvec = MAnalyse(superfilt,isb=true,  blksize=16, overlap=2,delta=1, truemotion=true)
  fvec = MAnalyse(superfilt,isb=false, blksize=16, overlap=2,delta=1, truemotion=true)

# Increase thSAD if moving objects are being removed
  bvec_re = Mrecalculate(super,bvec,blksize=8, overlap=0,thSAD=100)
  fvec_re = Mrecalculate(super,fvec,blksize=8, overlap=0,thSAD=100)

  backw = MFlow(clip,super,bvec_re)
  forw  = MFlow(clip,super,fvec_re)

  clp=interleave(forw,clip,backw)
  clp=clp.RemoveDirt(limit,_grey)
  clp=clp.SelectEvery(3,1)
  return clp
}
Brilliant thanks. I was reading your reinterlacing thread too. Very ingenious!
19631981 is offline   Reply With Quote
Old 28th July 2021, 00:17   #8  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,153
Here for RemoveDirtMC_SE
https://github.com/realfinder/AVS-St...DirtMC_SE.avsi
kedautinh12 is offline   Reply With Quote
Old 28th July 2021, 11:46   #9  |  Link
19631981
Registered User
 
Join Date: Jul 2021
Location: UK
Posts: 5
Quote:
Originally Posted by kedautinh12 View Post
Thank you
19631981 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:19.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.