Quantcast Removing horizontal/vertical film lines and scratches? - digitalFAQ Forum
  #1  
04-12-2018, 11:24 AM
yukukuhi yukukuhi is offline
Free Member
 
Join Date: Apr 2018
Posts: 7
Thanks: 7
Thanked 0 Times in 0 Posts
Hey there folks of Digitafaq
I want to remove horizontal/vertical Film Lines, Scratches, Patches, Dots etc. from this video sample that i'm attaching here using Avisynth filters. Please help.


Attached Files
File Type: mp4 Chinnvar Movie Comedy.mp4 (13.31 MB, 13 downloads)
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
 
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
04-12-2018, 12:44 PM
themaster1 themaster1 is offline
Free Member
 
Join Date: Feb 2011
Posts: 137
Thanks: 0
Thanked 20 Times in 18 Posts
Try spotremover for virtualdub >> http://spotremoverfilter.com/
Reply With Quote
  #3  
04-12-2018, 02:55 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 2,649
Thanks: 78
Thanked 771 Times in 675 Posts
@yukukuhi:
Your sample has been processed to low-bitrate MP4 using obsolete Layer2 audio. Is it a re-encoded piece of an earlier original, or was it captured directly to mp4? If you intended to perform any cleanup or repair of a video with defects as seriously bad as these, low-bitrate lossy encoding is a big mistake.


Quote:
Originally Posted by themaster1 View Post
Did you try it? What was the result?
Reply With Quote
  #4  
04-12-2018, 03:13 PM
ehbowen ehbowen is offline
Premium Member
 
Join Date: Feb 2018
Posts: 54
Thanks: 2
Thanked 3 Times in 3 Posts
@sanlyn,

I posted this clip in a thread about trouble I was having with another VCR. However, I was thinking of taking this capture from the other VCR and posting it on YouTube pretty much as is. Do you have any recommendations for cleaning it up beforehand? I have it captured to lossless AVI for processing.
Reply With Quote
  #5  
04-12-2018, 04:05 PM
themaster1 themaster1 is offline
Free Member
 
Join Date: Feb 2011
Posts: 137
Thanks: 0
Thanked 20 Times in 18 Posts
Quote:
Originally Posted by sanlyn View Post
Did you try it? What was the result?
Haven't tested and i may add the description of the filter fit the problems on the sample he's submitted, am i wrong Mr Sanlyn ?

Quote:
SpotRemover is a filter/plugin for VirtualDub to clean noise in your digital video. It is designed for digital restoration of damaged films. SpotRemover filter removes (cleans) dust, hairs, specks and other defects commonly seen in aged films.
Reply With Quote
  #6  
04-12-2018, 07:49 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 2,649
Thanks: 78
Thanked 771 Times in 675 Posts
Quote:
Originally Posted by themaster1 View Post
Haven't tested and i may add the description of the filter fit the problems on the sample he's submitted, am i wrong Mr Sanlyn ?
I have. You're going to be very disappointed with its performance.
Reply With Quote
  #7  
04-12-2018, 08:21 PM
ehbowen ehbowen is offline
Premium Member
 
Join Date: Feb 2018
Posts: 54
Thanks: 2
Thanked 3 Times in 3 Posts
I'm still learning to use it, but I've gotten some good results with Neat Video for VirtualDub. However, it's a paid plugin/app.

Edit To Add: There is a demo version which you can download and try free of charge.
Reply With Quote
  #8  
04-12-2018, 08:48 PM
lordsmurf's Avatar
lordsmurf lordsmurf is online now
Site Staff | Video
 
Join Date: Dec 2002
Posts: 6,822
Thanks: 669
Thanked 1,029 Times in 916 Posts
NeatVideo mostly just blurs, nothing else. Terrible restoration these days.

Something like KNLmeansCL, using x64 Avisynth/VirtualDub, makes it looks pathetic by comparison. Even a lot of the VirtualDub filters from the past 10 years are better than NeatVideo.

It was good for its time, but that time has long been gone.

- Did my advice help you? Then become a Premium Member and support this site.
- Find television shows, cartoons, DVDs and Blu-ray releases at the TVPast forums.
Reply With Quote
  #9  
04-13-2018, 07:40 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 2,649
Thanks: 78
Thanked 771 Times in 675 Posts
Quote:
Originally Posted by ehbowen View Post
@sanlyn,

I posted this clip in a thread about trouble I was having with another VCR. However, I was thinking of taking this capture from the other VCR and posting it on YouTube pretty much as is. Do you have any recommendations for cleaning it up beforehand? I have it captured to lossless AVI for processing.
I wouldn't want to go through the double work of cleaning the original defects and the really bad compression defects at the same time. For restoration one should work with lossless originals, not with lossy encodes. The lossy sample you linked to looks pretty well eviscerated already and won't withstand much additional filtering.

If you'd like some discussion on the original video, please start a new thread on the subject. Otherwise you would be hijacking a thread on a different subject started by yukukuhi.

Quote:
Originally Posted by ehbowen View Post
I'm still learning to use it, but I've gotten some good results with Neat Video for VirtualDub.
I've used NeatVideo since version 1.5 for Windows 98. Unfortunately it won't do much for those scratches in the posted sample. It works well on excessive grain and mosquito noise, but the original mp4 sample in post #1 has very little grain but too much compression loss for filters like NeatVideo.
Reply With Quote
  #10  
04-13-2018, 05:44 PM
themaster1 themaster1 is offline
Free Member
 
Join Date: Feb 2011
Posts: 137
Thanks: 0
Thanked 20 Times in 18 Posts
Right, spot remover is useless in this case
You're gonna need a script of that nature but even more agressive so good luck to find the right balance but someone that knows avisynth better than i do will find a way i'm sure

Original:https://image.noelshack.com/fichiers...img-381-og.jpg

You must be logged in to view this content; either login or register for the forum. The attached screen shots, before/after images, photos and graphics are created/posted for the benefit of site members. And you are invited to join our digital media community.


Processed: https://image.noelshack.com/fichiers...33-img-381.jpg

You must be logged in to view this content; either login or register for the forum. The attached screen shots, before/after images, photos and graphics are created/posted for the benefit of site members. And you are invited to join our digital media community.


Quote:
# original script by Didée: http://forum.doom9.org/showpost.php?...9&postcount=10
# the script below is adapted for my own needs, themaster1
LSMASHVideoSource("Chinnvar Movie Comedy.mp4")
a=last
#clense(reduceflicker=false).merge(last,0.5).clens e(reduceflicker=false)
mot=removegrain(8,0).DepanEstimate(range=2)
take2=a.depaninterleave(mot,prev=2,next=2,subpixel =2)
clean1=take2.DeGrainMedian(limitY=255,limitUV=255, mode=5,norow=true,interlaced=false).selectevery(5, 2)

sup1 = clean1.minblur(1).removegrain(11,0)
\ .mt_lutxy(clean1,"x 1 + y < x 2 + x 1 - y > x 2 - y ? ?",U=2,V=2)
\ .msuper(pel=2,sharp=0)
sup2 = a.msuper(pel=2,levels=1,sharp=2)
###### Good mvtools values, Do not change, checked##########
bv22=sup1.manalyse(isb=true, truemotion=false,global=true,delta=2,blksize=16,ov erlap=8,search=5,searchparam=4,DCT=5)
bv21=sup1.manalyse(isb=true, truemotion=false,global=true,delta=1,blksize=16,ov erlap=8,search=5,searchparam=4,DCT=5)
fv21=sup1.manalyse(isb=false,truemotion=false,glob al=true,delta=1,blksize=16,overlap=8,search=5,sear chparam=4,DCT=5)
fv22=sup1.manalyse(isb=false,truemotion=false,glob al=true,delta=2,blksize=16,overlap=8,search=5,sear chparam=4,DCT=5)

interleave(a.mcompensate(sup2,fv22),a.mcompensate( sup2,fv21),a,a.mcompensate(sup2,bv21),a.mcompensat e(sup2,bv22))
mergeluma(TMedian2(),1.0).mergechroma(TMedian2(),1 ).selectevery(5,2)

sup3 = last.msuper(pel=2,sharp=2)
bv33=sup3.manalyse(isb=true, truemotion=false,global=true,delta=3,blksize=8,ove rlap=4,search=5,searchparam=4,DCT=5)
bv32=sup3.manalyse(isb=true, truemotion=false,global=true,delta=2,blksize=8,ove rlap=4,search=5,searchparam=4,DCT=5)
bv31=sup3.manalyse(isb=true, truemotion=false,global=true,delta=1,blksize=8,ove rlap=4,search=5,searchparam=4,DCT=5)
fv31=sup3.manalyse(isb=false,truemotion=false,glob al=true,delta=1,blksize=8,overlap=4,search=5,searc hparam=4,DCT=5)
fv32=sup3.manalyse(isb=false,truemotion=false,glob al=true,delta=2,blksize=8,overlap=4,search=5,searc hparam=4,DCT=5)
fv33=sup3.manalyse(isb=false,truemotion=false,glob al=true,delta=3,blksize=8,overlap=4,search=5,searc hparam=4,DCT=5)
last


################ SHARPENING ###########
#non edge sur X:
#LimitedSharpenFaster(ss_x=1.4,ss_y=1.0,Smode=3,st rength=100,soft=0,edgemode=2,wide=false) # FINAL
# edge mode=1 sur Y:
#LimitedSharpenFaster(ss_x=1.0,ss_y=2.0,Smode=3,st rength=100,soft=0,edgemode=1,wide=false) # FINAL
#weave()

################################################## ###############
function EdgeCleaner(clip c, float "strength", bool "rep", int "rmode", int "smode", bool "hot", bool "fix") {

strength = default(strength, 8.0)
rep = default(rep, true)
rmode = default(rmode, 17)
smode = default(smode, 0)
hot = default(hot, false)
fix = default(fix, true)

c = (c.isYV12()) ? c : c.ConvertToYV12()
strength = (smode==0) ? strength : strength+4

main = c.aWarpSharp(strength,1)
main = (rep) ? Repair(main,c,rmode) : main

mask = c.mt_edge("prewitt",4,32,4,32).mt_invert().mt_conv olution()

final = (!hot) ? mt_merge(c,main,mask) : Repair(mt_merge(c,main,mask),c,2)
final = (fix) ? Overlay(final,c.ConvertToRGB24().Crop(0,1,-c.width+1,-c.height+2),x=0,y=1) : final
final = (smode != 0) ? mt_merge(final,c,c.StarMask(smode)) : final

return final

}

function StarMask(clip c, int "mode") {

mode = default(mode, 1)

clean = (mode==1) ? c.RemoveGrain(17) : Repair(c.Deen("a3d",4,12,0),c,15).RemoveGrain(21)
diff = (mode==1) ? mt_makediff(c,clean) : NOP

final = (mode==1) ? diff.Greyscale().Levels(40,0.350,168,0,255).remove grain(7,-1).mt_edge("prewitt",4,16,4,16) : \
Subtract(mt_merge(clean,c,c.mt_edge("roberts",0,2, 0,2).mt_expand(mode=mt_circle(1)).mt_invert()),c). mt_edge("roberts",0,0,0,0).mt_deflate()

return final

}



function MinBlur(clip clp, int r, int "uv")
{
uv = default(uv,3)
uv2 = (uv==2) ? 1 : uv
rg4 = (uv==3) ? 4 : -1
rg11 = (uv==3) ? 11 : -1
rg20 = (uv==3) ? 20 : -1
medf = (uv==3) ? 1 : -200

RG11D = (r==0) ? mt_makediff(clp,clp.sbr(),U=uv2,V=uv2)
\ : (r==1) ? mt_makediff(clp,clp.removegrain(11,rg11),U=uv2,V=u v2)
\ : (r==2) ? mt_makediff(clp,clp.removegrain(11,rg11).removegra in(20,rg20),U=uv2,V=uv2)
\ : mt_makediff(clp,clp.removegrain(11,rg11).removegra in(20,rg20).removegrain(20,rg20),U=uv2,V=uv2)
RG4D = (r<=1) ? mt_makediff(clp,clp.removegrain(4,rg4),U=uv2,V=uv2 )
\ : (r==2) ? mt_makediff(clp,clp.medianblur(2,2*medf,2*medf),U= uv2,V=uv2)
\ : mt_makediff(clp,clp.medianblur(3,3*medf,3*medf),U= uv2,V=uv2)
DD = mt_lutxy(RG11D,RG4D,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=uv2,V=uv2)
clp.mt_makediff(DD,U=uv,V=uv)
return(last)
}



# median of 5 clips from Helpers.avs by G-force
Function Median2(clip "input_1", clip "input_2", clip "input_3", clip "input_4", clip "input_5", string "chroma")
{
chroma = default(chroma,"process") #default is "process". Alternates: "copy first" or "copy second"
#MEDIAN(i1,i3,i5)
Interleave(input_1,input_3,input_5)
chroma == "process" ? Clense(reduceflicker=false) : Clense(reduceflicker=false,grey=true)
m1 = selectevery(3,1)
#MAX(MIN(i1,i3,i5),i2)
m2 = input_1.MT_Logic(input_3,"min",chroma=chroma).MT_L ogic(input_5,"min",chroma=chroma).MT_Logic(input_2 ,"max",chroma=chroma)
#MIN(MAX(i1,i3,i5),i4)
m3 = input_1.MT_Logic(input_3,"max",chroma=chroma).MT_L ogic(input_5,"max",chroma=chroma).MT_Logic(input_4 ,"min",chroma=chroma)
Interleave(m1,m2,m3)
chroma == "process" ? Clense(reduceflicker=false) : Clense(reduceflicker=false,grey=true)
selectevery(3,1)
chroma == "copy first" ? last.MergeChroma(input_1) : chroma == "copy second" ? last.MergeChroma(input_2) : last
ConverttoRGB32(matrix="rec601",interlaced=false)
LoadVirtualDubPlugin("C:\Program Files (x86)\VirtualDub\plugins\Camcorder_Color_Denoise_s se2.vdf", "CCD", 1)
CCD(7,1) # de 0 à 100 # Défaut =30 /
converttoyv12(matrix="rec601",interlaced=false)
Return(last)
}

function TMedian2(clip c) {
Median2( c.selectevery(1,-2), c.selectevery(1,-1), c, c.selectevery(1,1), c.selectevery(1,2) ) }


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=li mit,noisy=4, grey=_grey)

# Alternative settings
# return RestoreMotionBlocks(clensed,input,alternative=alt, pthreshold=4,cthreshold=6, gmthreshold=40,dist=1,dmode=2,debug=false,noise=li mit,noisy=12,grey=_grey,show=true)
# return RestoreMotionBlocks(clensed,input,alternative=alt, pthreshold=6,cthreshold=8, gmthreshold=40,dist=3,tolerance= 12,dmode=2,debug=false,noise=limit,noisy=12,grey=_ grey,show=false)
}


Reply With Quote
  #11  
04-13-2018, 08:14 PM
lordsmurf's Avatar
lordsmurf lordsmurf is online now
Site Staff | Video
 
Join Date: Dec 2002
Posts: 6,822
Thanks: 669
Thanked 1,029 Times in 916 Posts
The problem with this clip is that the line noise is constant, on all frames. So any sort of temporal NR, no matter how complex, will fail. That leaves in-image static filters, and it will easily harm good parts of the picture.

I've seen some pretty amazing stuff, for film, from VideoFred and johnmeyer. But nothing like this that I can recall.

The long GOP source encoding isn't helping (ie, H264 encoding).

- Did my advice help you? Then become a Premium Member and support this site.
- Find television shows, cartoons, DVDs and Blu-ray releases at the TVPast forums.
Reply With Quote
  #12  
04-15-2018, 01:08 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 2,649
Thanks: 78
Thanked 771 Times in 675 Posts
Welcome to digitalfaq, by the way.


Quote:
Originally Posted by yukukuhi View Post
Hey there folks of Digitafaq
I want to remove horizontal/vertical Film Lines, Scratches, Patches, Dots etc. from this video sample that i'm attaching here using Avisynth filters. Please help.
Quote:
Originally Posted by yukukuhi View Post
I want to remove horizontal/vertical Film Lines, Scratches, Patches, Dots etc. from this video sample that i'm attaching here using Avisynth filters.
Thanks for the sample. This sample isn't an original encode, is it? It looks like a lossy re-encode from a previous lossy video. The low bitrate used for the sample generated more data loss. No Avisynth script can restore lost data, so you'll get a script might be overkill, underkill, or otherwise inappropriate for the original source. Low-bitrate encodes with multiple stages of detail loss look worse after it's filtered and re-encoded.

I also noted that the audio track is mute. Actually, obsolete Layer2 audio isn't valid for most h.264/mp4 containers.

Those scratches are from a film-based original. For PAL, film is either speeded up to 25fps or some form of pulldown is used. In this sample the original frame brate was speeded up and looks like it. I doubt the movie was originally shot at 25fps.

I ran a first Avisynth script ("Chinnvar_01_25p.avs, shown below) that cleared about 60% of the original noise. I saved the results of the first script using lossless Lagarith YV12. Then I ran the results with a second script (Chinnvar_01_MC3_25p.avs) and applied the RemoveSpotsMC3 filter, which removed another 15 or 20% of the scratches. Each script breaks the video into groups of 2 or 3 half-size frames for more efficient handling and because some defects persist for multiple frames, thus they don't look like noise to the filters. Defects that don't change shape or position for several frames are not considered noise. You can increase the filter strength, but that will destroy more of the video.

CAUTION: Script #1 runs at about 7 to 10 fps processing, depending on the system. Script #2 runs very slowly at from 1 to 2.5 fps.

A) frame 202, original:


B) frame 202 after first script (You might feel that script #1 is good enough):


C) frame 202 after 2nd script with RemoveSpotsMC3. The filters can't clean 100%, but they cleaned some of the worst of it and and brought the main subject into the foreground a little more:


D) frame 926 original:


E) frame 926 after Script 1 and after MC3 (Script 1 and MC3 look similar, MC3 is a bit cleaner). You can't clean more scratches without using methods that will destroy most of the images:



Script 1: Chinnvar_01_25p.avs

Code:
## --- modify the path statements below to match your system --- ##
aud=ffaudioSource("Drive:\path\to\Chinnvar Movie Comedy.mp4")
vid=ffvideoSource("Drive:\path\to\Chinnvar Movie Comedy.mp4")
AudioDub(vid,aud)

## --- The line below is a comment. Remove the # character to execute the code. --- ##
## --- If working with the YUY2 original, the code converts to YV12 color. -------- ##
# ConvertToYV12(interlaced=true)  

AssumeTFF()
SeparateFields()
Source=last
a=source1.SelectEvery(3,0).RemoveDirtMC(50,false).Descratch().TurnRight().DeScratch().TurnLeft().MV2()
b=source1.SelectEvery(3,1).RemoveDirtMC(50,false).Descratch().TurnRight().DeScratch().TurnLeft().MV2()
c=source1.SelectEvery(3,2).RemoveDirtMC(50,false).Descratch().TurnRight().DeScratch().TurnLeft().MV2()
Interleave(a,b,c)
LimitedSharpenFaster()
AddGrainC(1.5, 1.5)
AssumeFieldBased()
Weave()
return last
### --- Save with Lagarith as YV12 --- ###

#..........................................................................................
### --- REMOVE DIRT & REMOVE DIRT MC FUNCTIONS --- ###
### --- -------------------------------------- --- ###
### --- Required: RgTools.dll & RemoveDirt.dll --- ###

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=30,cthreshold=8,\
     gmthreshold=40,dist=3,dmode=2,debug=false,noise=limit,noisy=4, grey=_grey)

  # Alternative settings
  # return RestoreMotionBlocks(clensed,input,alternative=alt,pthreshold=4,cthreshold=6,\
  #  gmthreshold=40,dist=1,dmode=2,debug=false,noise=limit,noisy=12,grey=_grey,show=true)
  # return RestoreMotionBlocks(clensed,input,alternative=alt,pthreshold=6,cthreshold=8,\
  #  gmthreshold=40,dist=3,tolerance= 12,dmode=2,debug=false,noise=limit,noisy=12,\
  #  grey=_grey,show=false)
}

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=20)
  fvec_re = Mrecalculate(super,fvec,blksize=8, overlap=0,thSAD=20)

  backw = MFlow(clip,super,bvec_re,thSCD1=900,thSCD2=200)
  forw  = MFlow(clip,super,fvec_re,thSCD1=900,thSCD2=200)

  clp=interleave(forw,clip,backw)
  clp=clp.RemoveDirt(limit,_grey)
  clp=clp.SelectEvery(3,1)
  return clp
}


#..........................................................................................
function MV2(clip)
{ 
### --- copy of modified MDeGrain2 MVTools filter, renamed "MV2" ---- ###
### --------- (requires MVTools2.dll and aWarpSharp.dll)  ----------- ###
source=clip

  super = source.MSuper(pel=2, sharp=1)
  backward_vec2 = MAnalyse(super, isb = true, delta = 2, blksize=8, overlap=4, dct=0)
  backward_vec1 = MAnalyse(super, isb = true, delta = 1, blksize=8, overlap=4, dct=0)
  forward_vec1 = MAnalyse(super, isb = false, delta = 1, blksize=8, overlap=4, dct=0)
  forward_vec2 = MAnalyse(super, isb = false, delta = 2, blksize=8, overlap=4, dct=0)
  MDegrain2(source,super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400) 

    clean=last #save cleaned version
    diff1=subtract(source,clean).Blur(0.25)
    diff2=diff1.blur(1.5,0)
#diff3 is high-ish frequency noise only
    diff3=subtract(diff1,diff2) 
#sharpen cleaned version a little
    sharpen(0.3,0.0) 
#mix high frequency noise back in
    overlay(last,diff3.levels(128,1.0,255,0,127,coring=false),mode="add", opacity=0.7)
    overlay(last,diff3.levels(0,1.0,127,128,255,coring=false).Invert(),mode="subtract", opacity=0.7)
#put cleaned chroma back in with warp sharpening
    mergechroma(clean.aWarpSharp(depth=20.0, thresh=0.75, blurlevel=2, cm=1))

return last}
Script 2: Chinnvar_02_MC3_25p.avs

Code:
AviSource(vidpath+"Chinnvar_01_25p.avi")
AssumeTFF()
SeparateFields()
Source1=last
e=source1.SelectEven().RemoveSpotsMC3()
o=source1.SelectOdd().RemoveSpotsMC3()
Interleave(e,o)
AssumeFieldBased()
Weave()
LimitedSharpenFaster()
AddGrainC(1.25,1.25)
return last
The RemoveSpotsMC4.avsi plugin is attached. It contains RemoveSpots and 4 versions of RemoveSpotsMC filters.
The attached mp4 is an encode of Script #2 after running Script #1 and RemoveSpotsMC3, 720x576 with flags for 4:3 display.



@themaster1:
An interesting script with some good ideas and a way to use the median filter without a lot of geometric distortion. I gave it a try, but it took a long time to clean up the text. I counted about 2 dozen typos caused by posting with the quote markers instead of code markers. They prevented the script from running and took a long time to repair.

Here are some typical sample spacing problems that caused the script to fail (errors in blue type):
Quote:
Originally Posted by themaster1 View Post
Code:
# original script by Didée: http://forum.doom9.org/showpost.php?...9&postcount=10
# the script below is adapted for my own needs, themaster1
LSMASHVideoSource("Chinnvar Movie Comedy.mp4")
a=last
......
......
bv22=sup1.manalyse(isb=true, truemotion=false,global=true,delta=2,blksize=16,ov erlap=8,search=5,searchparam=4,DCT=5)
bv21=sup1.manalyse(isb=true, truemotion=false,global=true,delta=1,blksize=16,ov erlap=8,search=5,searchparam=4,DCT=5)
fv21=sup1.manalyse(isb=false,truemotion=false,glob al=true,delta=1,blksize=16,overlap=8,search=5,sear chparam=4,DCT=5)
fv22=sup1.manalyse(isb=false,truemotion=false,glob al=true,delta=2,blksize=16,overlap=8,search=5,sear chparam=4,DCT=5)
......
......
bv33=sup3.manalyse(isb=true, truemotion=false,global=true,delta=3,blksize=8,ove rlap=4,search=5,searchparam=4,DCT=5)
bv32=sup3.manalyse(isb=true, truemotion=false,global=true,delta=2,blksize=8,ove rlap=4,search=5,searchparam=4,DCT=5)
bv31=sup3.manalyse(isb=true, truemotion=false,global=true,delta=1,blksize=8,ove rlap=4,search=5,searchparam=4,DCT=5)
fv31=sup3.manalyse(isb=false,truemotion=false,glob al=true,delta=1,blksize=8,overlap=4,search=5,searc hparam=4,DCT=5)
fv32=sup3.manalyse(isb=false,truemotion=false,glob al=true,delta=2,blksize=8,overlap=4,search=5,searc hparam=4,DCT=5)
fv33=sup3.manalyse(isb=false,truemotion=false,glob al=true,delta=3,blksize=8,overlap=4,search=5,searc hparam=4,DCT=5)
last
......
......

################ SHARPENING ###########
#non edge sur X:
#LimitedSharpenFaster(ss_x=1.4,ss_y=1.0,Smode=3,st rength=100, soft=0,edgemode=2,wide=false) # FINAL
# edge mode=1 sur Y:
#LimitedSharpenFaster(ss_x=1.0,ss_y=2.0,Smode=3,st rength=100, soft=0,edgemode=1,wide=false) # FINAL
#weave()
......
......
RG11D = (r==0) ? mt_makediff(clp,clp.sbr(),U=uv2,V=uv2)
\ : (r==1) ? mt_makediff(clp,clp.removegrain(11,rg11),U=uv2,V=u v2)
\ : (r==2) ? mt_makediff(clp,clp.removegrain(11,rg11).removegra in(20,rg20),U=uv2,V=uv2)
\ : mt_makediff(clp,clp.removegrain(11,rg11).removegra in(20,rg20).\
removegrain(20,rg20),U=uv2,V=uv2)
RG4D = (r<=1) ? mt_makediff(clp,clp.removegrain(4,rg4),U=uv2,V=uv2 )
......
......
ConverttoRGB32(matrix="rec601",interlaced=false)
LoadVirtualDubPlugin\
("C:\Program Files (x86)\VirtualDub\plugins\Camcorder_Color_Denoise_s se2.vdf", "CCD", 1)
CCD(7,1) # de 0 à 100 # Défaut =30 
converttoyv12(matrix="rec601",interlaced=false)
Return(last)
......
and so on ....


Attached Images
File Type: png A frame 202 original.png (480.2 KB, 35 downloads)
File Type: png B frame 202 after script 1.png (724.2 KB, 34 downloads)
File Type: png C frame 202 after MC3.png (758.8 KB, 35 downloads)
File Type: png D frame 926 original.png (624.8 KB, 35 downloads)
File Type: png E Frame 926 after MC3.png (828.8 KB, 34 downloads)
Attached Files
File Type: avsi RemoveSpotsMC4.avsi (28.9 KB, 3 downloads)
File Type: mp4 Chinnvar_02_MC3_25p.mp4 (22.67 MB, 3 downloads)
Reply With Quote
The following users thank sanlyn for this useful post: yukukuhi (04-17-2018)
  #13  
04-16-2018, 02:49 AM
lordsmurf's Avatar
lordsmurf lordsmurf is online now
Site Staff | Video
 
Join Date: Dec 2002
Posts: 6,822
Thanks: 669
Thanked 1,029 Times in 916 Posts
@sanlyn:
Interesting that you ran AssumeTFF(), on a video that was clearly progressive.

I've had similar ideas in the past, with varying success. Nothing in my code library did much here.

- Did my advice help you? Then become a Premium Member and support this site.
- Find television shows, cartoons, DVDs and Blu-ray releases at the TVPast forums.
Reply With Quote
  #14  
04-16-2018, 03:22 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 2,649
Thanks: 78
Thanked 771 Times in 675 Posts
Quote:
Originally Posted by lordsmurf View Post
@sanlyn:
Interesting that you ran AssumeTFF(), on a video that was clearly progressive
That's what happens when I take a script from another project and re-use some boilerplate text....at 4:00 AM with only one coffee under my belt.

For those readers wondering about lordsmurf's comment: Progressive video doesn't have interlaced fields, so TopFieldFirst (TFF) or BottomFieldFirst() are not irrelevant. In the above scripts, SeparateFields() was used to break the progressive image into two smaller, half-sized images, then split those images into two or three separate streams. Effectively, what that does is reduce the number of pixels each time the filters scan the video (less memory and CPU load), and because many of the defects persist for multiple frames, a lot of those defects will occur only once or twice in the separate streams and will be detected by the filters as "noise" to be cleaned.

Sometimes it works better that way, sometimes not. Depends on the nature of the problem.

Also noted: a longer version of the samples was posted as a .ts file in another forum, with audio. Yes, indeed, the video was film speeded up for 25fps PAL, and the big guy's voice gets ridiculously squeaky.
Reply With Quote
  #15  
04-16-2018, 10:34 AM
yukukuhi yukukuhi is offline
Free Member
 
Join Date: Apr 2018
Posts: 7
Thanks: 7
Thanked 0 Times in 0 Posts
Hey there Sanlyn
Thanks for the Invite.

The original file is in .ts format. I didn't see any .ts in the supported file types for attaching.

What's with the Alternative setting in the Script 1: Chinnvar_01_25p.avs? as well as the ### --- Save with Lagarith as YV12 --- ###?
Reply With Quote
  #16  
04-16-2018, 12:17 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 2,649
Thanks: 78
Thanked 771 Times in 675 Posts
Are you referring to this alternative setting notes:

Code:
## --- The line below is a comment. Remove the # character to execute the code. --- ##
## --- If working with the YUY2 original, the code converts to YV12 color. -------- ##
# ConvertToYV12(interlaced=true)
If you are working with a video that isn't using YV12, you have to convert to YV12 for the filters used. Your mp4 and most .ts encodes use YV12, so the line isn't needed in this case.

At the end of the script the color format is YV12. The file is saved as YV12 unless you want another colorspace. Note that huffyuv can't compress YV12, so I suggest Lagarith. If you run the script in VirtualDub and are using "full processing mode", the file will automatically be saved as uncompressed 24bit RGB and will expand to 3X its original size unless you specify otherwise and use "fast recompress" mode after specifying a different colorspace and compressor. When saving a file in Virtualdub you can always specify a desired color format and compressor for output.

If you need to post a file without an allowed file extension, use zip or RAR on the file to give it a file ending of .zip or .rar. Re-encoding lossy encoded files or lossless captures degrades the results and is not recommended.
Reply With Quote
The following users thank sanlyn for this useful post: yukukuhi (04-17-2018)
  #17  
04-17-2018, 12:31 AM
yukukuhi yukukuhi is offline
Free Member
 
Join Date: Apr 2018
Posts: 7
Thanks: 7
Thanked 0 Times in 0 Posts
Ok, shall I send the original source file then?

Does running script 1 & 2 means encoding it 2 times?

This is the first time I'm trying to remove noises from a source file. I usually deinterlace, crop and resize in Avisynth & directly load onto megui for mp4 conversion. Why I'm saying all this is because I can't quite understand how to start. So it would be so kind if you break it down step by step like a quick guide this one time. Pretty please.

And lastly you've done an excellent job denoising the file.
Reply With Quote
  #18  
04-17-2018, 02:02 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 2,649
Thanks: 78
Thanked 771 Times in 675 Posts
What is your original source and how was it created? The workflow depends on what video source and hardware/software was used to create your initial working file.

For web posting, you must first deinterlace and denoise before resizing. Your samples have already been deinterlaced, but how that was done could have possibly made the defects look worse than they were when you started.
Reply With Quote
  #19  
04-17-2018, 08:14 AM
yukukuhi yukukuhi is offline
Free Member
 
Join Date: Apr 2018
Posts: 7
Thanks: 7
Thanked 0 Times in 0 Posts
My original source is from HD STB (Set Top Box) but the channel broadcasts are in SD, & was recorded via HD PVR.

Below i'm attaching the original .ts sample.


Attached Files
File Type: rar Chinnvar Movie Comedy Sample.rar (36.39 MB, 2 downloads)
Reply With Quote
  #20  
04-17-2018, 10:29 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 2,649
Thanks: 78
Thanked 771 Times in 675 Posts
Thanks for the new sample. I'll be able to get to it later today.
Reply With Quote
The following users thank sanlyn for this useful post: yukukuhi (04-17-2018)
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Horizontal lines/scanlines in captures? (ATI 600 USB) Turok81 Capture, Record, Transfer 8 11-27-2016 08:25 PM
My guide on removing vertical jitter using VirtualDub and Photoshop hysteriah Restore, Filter, Improve Quality 6 06-08-2015 04:45 AM
Need help with blue vertical lines max_cady Restore, Filter, Improve Quality 3 05-03-2011 04:24 AM
Vertical or horizontal for storing an external hard drive & best enclosures ? Sossity Computers 1 12-09-2010 07:26 PM

Thread Tools



 
All times are GMT -5. The time now is 08:36 AM  —  vBulletin Copyright © Jelsoft Enterprises Ltd