Thursday, November 22, 2012

Blacking out frames with AviSynth (BlankClip)

Jeez, I don't know why it took me this long.

I've been capturing shows off the DVR as a hobby for about a decade now. Over the years I've fine-tuned my editing technique. Before I used to clumsily trim the clips right in VirtualDub, never knowing if I really did find and cut all the commercials out. Joining the clips was a pain and clips pieced back together were usually out of sync anyway. Today, I use AviSynth to consistently and elegantly trim my videos.

With VirtualDub's view -> Audio Display feature, I'm able to more accurately edit my captures down to the frame. When the commercials end and the program begins, sometimes the audio from the commercial spills over a few frames into the program. And sometimes the audio of the program begins before the first frame of the program appears.

The goal, of course, is to remove all commercials. Editing strictly by frames, one segment might start with a a bit of audio from a commercial. In that case, I use ApplyRange to mute that portion:

ApplyRange(1797,140673, "Amplify",0.0)

If the audio of the program plays before the first frame of the audio, I would start at the audio. I'll then use FreezeFrame to either copy the frame from the first frame of the program back to the audio, or I'll black out those other frames entirely.

The issue was finding a black frame in the first place. A lot of times I could try to find a black frame between commercials or at the very end of the program. But why not take the guesswork out of it and add a single black frame at the beginning or end of your video? I prefer the end -- here's an example of me blacking out the last few frames:


c1=AviSource("Untitled 50.avi").Trim(151,1948)
black=BlankClip(c1,1)

AlignedSplice(c1,black)
FreezeFrame(1797,1799,1799)

I guess I'll make a proper post about capturing and editing TV shows with my setup later on.