Skip to content

Instantly share code, notes, and snippets.

@tana3n
Last active April 10, 2020 07:14
Show Gist options
  • Save tana3n/ff38f844115449f2b64835916fced21b to your computer and use it in GitHub Desktop.
Save tana3n/ff38f844115449f2b64835916fced21b to your computer and use it in GitHub Desktop.
AviSynthで指定フレーム分(始点|終点)部分を無音化する関数
/*
AddSilent V0.3
V0.3 2020-04-10 音声だけ差し替えるようにしたのでif判定を消した
始点だけではなくて終点部分も削れるようにした(endオプション)
V0.2.1 2020-02-29 コメントアウト間違えてたので直した
V0.2 2020-02-27 forceオプション追加
V0.1.1 2019-12-03 微修正
V0.1 2019-09-05 初期版
仕様
音声のBitが決め打ち
*/
Function AddSilent (clip clip, int "trim", string "Bit", bool "end") {
cut=Default(trim,0)
end=Default(end,false)
bit=Default(Bit ,"16Bit")
add=BlankClip(length=trim,width=width(clip),height=height(clip),fps=FrameRateNumerator(clip),fps_denominator=FrameRateDenominator(clip),audio_rate=audiorate(clip),channels=AudioChannels(clip),sample_type=bit,pixel_type=PixelType(clip))
startrep=clip.Trim(cut,0)
endrep=Clip.Trim(0,Framecount(clip)-cut)
clip=clip.killaudio()
return end==true?audiodub(clip,endrep+add):audiodub(clip,add+startrep)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment