View Full Version : Insterting blank clips


EddieTH
28th February 2004, 00:06
I have some TV captures I'm trying to edit and I want to put 20 frames of blank frames where the commercials were originally. I thought BlankClip should do what I want, but I'm having problems with it. The first problem I had was getting the correct framerate. According to the AviSynth manual I should be using fps=30 and fps_denominator=1001 to get a clip at 29.97fps, but when I used those numbers and tried splicing the blank clip with my video I got an error that the framerates didn't match. This is my original script:

filler=BlankClip(length=20,width=720,pixel_type="yv12",fps=30,fps_denominator=1001).KillAudio()
MPEG2Source("D:\Capture\Farscape-FamilyTies.d2v",idct=5,iPP=true)
Trim(9246,15415) + filler + Trim(22047,43102) + filler + \
Trim(47603,60631) + filler + Trim(66032,83284) + filler + \
Trim(88865,103035) + filler + Trim(108476,115636) + \
Trim(115637,116807)
ConvertToYUY2(interlaced=true)


When I couldn't get that to work, I tried doing things differently and setting fps=29.97 and leaving fps_denominator=1. It worked after that.

Then I modified the script to add the audio to it so I could load it into VirtualDubMod and save it as a Wav with all the edits. I changed the script to:

filler=BlankClip(length=20,width=720,pixel_type="yv12",fps=29.97,audio_rate=48000)
v=MPEG2Source("D:\Capture\Farscape-FamilyTies.d2v",idct=5,iPP=true)
a=MPASource()
AudioDub(v,a)
Trim(9246,15415) + filler + Trim(22047,43102) + filler + \
Trim(47603,60631) + filler + Trim(66032,83284) + filler + \
Trim(88865,103035) + filler + Trim(108476,115636) + \
Trim(115637,116807)
ConvertToYUY2(interlaced=true)

When I open that file with VirtualDubMod and play it, the sound is mostly noise with what sounds like the actual sound playing at an increased speed in the background. When it gets to the first splice I get an error:

Avisynth read error:
Avisynth: caught an access violation at 0x00f48d23
attempting to write to 0x0720c000

If I try to play it from different points I get the same error with different addresses, and once I've tried playing it past the first splice it also gives me that error if I go back to the beginning and try to play it from there. It plays fine when I take out all the blank clips.

Edit: I probably should have mentioned that I'm using Avisynth 2.54

stickboy
28th February 2004, 01:31
I'm not sure why you're getting that access violation, but here are some general tips for you script:

Forget about the fps/denominator stuff.

One of the arguments that BlankClip can take is another clip to use as a template. The generated clip will have the same frame rate, frame size, pixel type, audio sampling rate, etc. as the original.

Also, you probably want to use AlignedSplice (++) instead of UnalignedSplice (+).
v = MPEG2Source("D:\Capture\Farscape-FamilyTies.d2v",idct=5,iPP=true)
a = MPASource()
src = AudioDub(v,a)
filler = src.BlankClip(length=20)

src

Trim(9246,15415) ++ filler ++ Trim(22047,43102) ++ filler ++ \
Trim(47603,60631) ++ filler ++ Trim(66032,83284) ++ filler ++ \
Trim(88865,103035) ++ filler ++ Trim(108476,115636) ++ \
Trim(115637,116807)
ConvertToYUY2(interlaced=true)

EddieTH
28th February 2004, 01:53
Thanks, I'll try that when I get the chance to work on it again. And I actually did use AlignedSplice for the blank clips, I must have changed it during one of the many rewrites.

BTW, I love your UnfoldFieldsVertical/FoldFieldsVertical functions. I do a lot of capturing from TV and I use them all the time.

EddieTH
28th February 2004, 03:59
That took care of it. Plus it's much easier and quicker. Thanks again.