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 9th May 2020, 17:01   #1  |  Link
warrenjb
Registered User
 
Join Date: Apr 2020
Posts: 4
Blur Private Parts?

I'm making a movie of my kids growing up with some old dv tapes. There's a scene with the kids dancing naked. They're 1 &3 so I think it's cute but they'll be embarrassed. Suggestions for blurring out their private parts? Thanks!
warrenjb is offline   Reply With Quote
Old 9th May 2020, 17:57   #2  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
If they are moving at inconstant speed (i.e randomly) it can become a pain to do that in Avisynth as you would have to "move" your blurred blocks frame by frame. It can be done, it's just extremely tedious. As much as I hate suggesting NLE over frame servers, I generally do it with AVID Media Composer. There are other NLE that can do it in an automated fashion like Davinci Resolve. What they do is to make a mask internally and follow the blocks with the values you specified in time. Another good tracking program which has been the de facto standard and has many integrations with other programs is Mocha. Anyway since you asked how to do it with a frame server (namely Avisynth) I'm gonna wait for others to reply...
FranceBB is offline   Reply With Quote
Old 9th May 2020, 18:03   #3  |  Link
warrenjb
Registered User
 
Join Date: Apr 2020
Posts: 4
Thanks for your reply! It's a pretty short clip without a lot of movement so I can probably apply the blur with a big enough radius to have it work without any or maybe only some slight movement. I am having a hard time finding a 64 bit filter that would allow me to do this, however. Any suggestions?
warrenjb is offline   Reply With Quote
Old 9th May 2020, 18:03   #4  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Agree with FraneBB, however,

EDIT: Script REMOVED. See post #9
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 10th May 2020 at 00:36.
StainlessS is offline   Reply With Quote
Old 9th May 2020, 18:37   #5  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
Post a link to the clip so we can experiment.
videoh is offline   Reply With Quote
Old 9th May 2020, 20:06   #6  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
EDIT: Script REMOVED. See post #9
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 10th May 2020 at 00:37.
StainlessS is offline   Reply With Quote
Old 9th May 2020, 20:12   #7  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by videoh View Post
Post a link to the clip so we can experiment.
FBI open up!
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 9th May 2020, 20:20   #8  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Can somebody look at my prev post, Animate seems to apply effect to entire clip, and NOT just the Start, End range,
did I cock up somewhere or is v3.5.2 animate bugged ?

EDIT: Overlay also has Start End Args, and used via Conceal() function, perhaps related.
Is Overlay incompatible with Animate ?

EDIT:
Arh crap,
Quote:
Animate is a meta-filter which evaluates its parameter filter with continuously varying arguments. At frame start_frame and earlier, the filter is evaluated with the arguments given by start_args. At frame end_frame and later, the filter is evaluated with the arguments given by end_args. In between, the arguments are linearly interpolated for a smooth transition.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 9th May 2020 at 20:27.
StainlessS is offline   Reply With Quote
Old 9th May 2020, 21:26   #9  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Code:
/*

    https://forum.doom9.org/showthread.php?p=1911260#post1911260
    Req:- Masktools2, FastBlur, Avs+
    YUV444 or RGB Only, 8 -> 32 bit.

*/

Function EllipMsk(clip c,int W, Int H,Bool "Soft") {
    # Req mt_tools_2, Returns frame WxH same FPS as c and without audio
    Soft=Default(Soft,False)
    # INFIX_H="(((x-.5)^2 +(y-.5)^2) < .25 ? 255 : 0"
    #          Elliptical Disk (Hard Edge) :: mode = "relative", Radius=0.5, Rad^2=0.25 :: SOFT_Inner rad:(Rad*0.9)^2~=0.2
    # INFIX_S="((x-.5)^2+(y-.5)^2)<.2?255 : (((x-.5)^2+(y-.5)^2)<.25 ? ((.25-((x-.5)^2+(y-.5)^2))*5100):0)"
    #          Elliptical Disk (Soft Edge) :: (.25-0.2)*5100=255 : (.25-.25)*5100=0.0] :: mode="relative", 0.25~=1.0 : 0.2~=0.9
    rpn = (!Soft)
    \ ? "x 0.5 - 2 ^ y 0.5 - 2 ^ + 0.25 < 255 0 ? scalef"                                                                            [*  RPN: EllipMsk [Hard Edge] *]
    \ : "x 0.5 - 2 ^ y 0.5 - 2 ^ + 0.2 < 255 x 0.5 - 2 ^ y 0.5 - 2 ^ + 0.25 < 0.25 x 0.5 - 2 ^ y 0.5 - 2 ^ + - 5100 * 0 ? ?  scalef" [*  RPN: EllipMsk [Soft Edge] *]
    c.Blankclip(width=W,height=H,Length=1).Killaudio
    return Last.mt_lutspa(mode = "relative", expr = rpn, chroma = "-128" )
}


Function RectMsk(clip c,int W, Int H,Bool "Soft") {
    # Req mt_tools_2, Returns frame WxH same FPS as c and without audio
    Soft=Default(Soft,False)
    # INFIX_H = "255"
    # INFIX_S = "max(abs(x-.5),abs(y-.5)) < .45 ? 255 : ((.5 - max(abs(x-.5),abs(y-.5)) ) * 5100)"
    rpn=(!Soft)
    \ ? "255 scalef"
    \ : "x 0.5 - abs y 0.5 - abs max 0.45 < 255 0.5 x 0.5 - abs y 0.5 - abs max - 5100 * ? scalef"
    c.Blankclip(width=W,height=H,Length=1).Killaudio
    return Last.mt_lutspa(mode = "relative", expr = rpn, chroma = "-128" )
}

Function Conceal(clip c,clip bc,clip msk, Float x, Float y,Float Opacity) {
    mw = Msk.Width   mh=Msk.Height
    ow=c.width-2*mw  oh=c.Height-2*mh
    xc = Round(min(max(0.0,x),ow))
    yc = Round(min(max(0.0,y),oh))
    x  = xc + mw/2
    y  = yc + mh/2
    bc=bc.crop(x,y,mw,mh)
    c.Overlay(bc,mask=msk,x=x,y=y,opacity=Opacity)
}

Function ConcealRange(clip c,clip bc,clip msk,Int "S", Int "E",float "sx",Float "sy",Float "ex",float "ey", Float "sop",Float "eop") {
/*
    Blur/Conceal clip c with blurred clip clip bc using Mask msk, frames S to E, sx,sy start coords, ex,ey end coords.
    Start and End Args S & E, are similar but not exactly like trim.
    ConcealRange(c,bc,msk, 0,0)     # Entire clip
    ConcealRange(c,bc,msk, 100,0)   # Frame 100 to End of Clip
    ConcealRange(c,bc,msk, 0,-1)    # Frame 0 Only
    ConcealRange(c,bc,msk, 1,1)     # Frame 1 Only
    ConcealRange(c,bc,msk, 1,-1)    # Frame 1 Only
    ConcealRange(c,bc,msk, 1)       # Frame 1 Only [Not same as Trim()], E defaults to -1 ie single frame.
    ConcealRange(c,bc,msk, 1,-3)    # Frames 1 to 3 (ie 3 frames)
    ConcealRange(c,bc,msk, 100,200) # 101 Frames, 100 to 200
    ConcealRange(c,bc,msk, 100,-50) # Frames 100 to 149 ie 50 frames

    X coords sx, and ex, allowed range 0 -> c.width.
    Y coords sy, and ey, allowed range 0 -> c.height.
    sop, eop, Start and End Opacity, Default 1.0, range 0.0 -> 1.0
*/
    FMX=c.FrameCount-1
    S = Min(Max(Default(S,0),0),FMX)            E = Default(E,-1)
    sx=Default(sx,0.0)                          sy=Default(sy,0.0)
    ex=Default(ex,0.0)                          ey=Default(ey,0.0)
    sop=min(max(Default(sop,1.0),0.0),1.0)      eop=min(max(Default(eop,1.0),0.0),1.0)
    E = (E==0) ? FMX : E
    E = Min(((E < 0) ? S-E-1 : E),FMX)                                      # S <= E <= FMX : E is +ve END Frame number (may be 0)
    Empty = c.BlankClip(Length=0)
    CS = (S==0) ? Empty : c.Trim(0,-S)
    C2E = (E==0?FMX:E)
    mw=Msk.Width   mh=Msk.Height
    cpad   = c.Addborders(mw,mh,mw,mh)
    bcpad  = bc.Addborders(mw,mh,mw,mh)
    CM     = cpad.Animate(S,C2E,"Conceal",   bcpad,Msk,sx,sy,sop,    bcpad,Msk, ex,ey,eop)
    CM     = CM.Trim(S,C2E).crop(mw,mh,-mw,-mh)
    CE     = (E==FMX) ? Empty : c.Trim(E+1,0)
    CS ++ CM ++ CE
}

##############################################################

AviSource("D:\Parade.avi").Trim(100,0)           # Source Clip

# Either YUV444 or RGB
ConvertToYV24.ConvertBits(10)
#ConvertToPlanarRGB.ConvertBits(10)
#ConvertToRGB24
#ConvertToRGB48
#ConvertToRGB64

####### CONFIG ###############################################

DISK     = True             # True = Disk/Ellipse, Else Rectangle
PIXELATE = False            # True = PIXELATE, False=Blur
PIXSZ    = 8                # PIXELATE Size, (maybe 8 or 4)

# FastBlur args             # Fastblur args if PIXELATE=False
FBlurRad  = 5
FBlurIter = 3

# Mask args [size of concealed area]
MWidth    = 128
MHeight   = MWidth
MSOFT     = True   # Soft Edge mask

# Opacity of Overlay'd concealment. [You are unlikely to want anything less than about 0.9, usually 1.0]
sop = 1.0          # Start frame Opacity
eop = sop          # End frame opacity same as start opacity.

# OTHER STUFF
BLANKFG   = false  # Show ForeGround(blurred/concealed Area) in Blue [see path traveled better].
BLANKBG   = False  # Show BackGround in Pink

####### END CONFIG ########################
Assert(IsRGB || (Height==ExtractU.Height&&Width==ExtractU.Width),"YV444 or RGB ONLY")


W   = Width
H   = Height
BPC = BitsPerComponent

#
BClip = (PIXELATE) ? BilinearResize(W/PIXSZ,H/PIXSZ).PointResize(W,H) : Last.Fastblur(FBlurRad,iterations=FBlurIter)        # Concealing clip
MSK   = Last.BlankClip(pixel_type="Y8").ConvertBits(BPC)                                                                   # Mask
MSK   = (DISK) ? MSK.EllipMsk(MWidth,MHeight,Soft=MSOFT) : MSK.RectMsk(MWidth,MHeight,Soft=MSOFT)
#

Last = (BLANKBG) ? Last.BlankClip(Color=$C04060)  : Last
BCLip= (BLANKFG) ? BCLip.BlankClip(Color=$0000FF) : BClip

#################################################################################
# Demo coords,               Start,End Frm,  Start X,Y    End X,Y    Start,End Opacity(default 1.0 if not supplied)
ConcealRange(Last,BClip,Msk,   0,     499,    0,    0,    W,    H,   sop,    eop)
ConcealRange(Last,BClip,Msk,   500,   999,    W,    H,    W,    0,   sop,    eop)
ConcealRange(Last,BClip,Msk,   1000, 1499,    W,    0,    0,    H,   sop,    eop)
ConcealRange(Last,BClip,Msk,   1500, 1999,    0,    H,    0,    0,   sop,    eop)
ConcealRange(Last,BClip,Msk,   2000, 2499,    0,    0,    W/2,H/2,   sop,    eop)
#################################################################################

ConvertToRGB32 # For viewing HBD
EDIT: Fastblur and Masktools2 both available in x64 flavours.

Original


Pixelated


Blurred


Pixelated/BlankBG


Blurred/BlankBG
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 10th May 2020 at 19:30.
StainlessS is offline   Reply With Quote
Old 10th May 2020, 19:31   #10  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Prev post, High Bit Depth capable, Req AVS+.

Added Start and End overlay Opacity args.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS 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 18:16.


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