Monday, June 04, 2012

more on overlay

After my earlier post on using AviSynth and virtualdub to create an overlaid video, found that the framerate of the clips had been wrong. The first version of the script had
bg=Imagesource("bk3.jpg", end = 16200, fps=30, use_DevIL=true)
top = BicubicResize(Crop(DirectShowSource("1.mp4"),40,6,-36,-4),320,240,0,0.75)

audio=DirectShowSource("1.mp4")
video1=Audiodub(Overlay(bg, top, 834, 771), audio)

Overlay uses the background clip's length to create the framerate. In this case, the clip used for "top" became speeded up.
So, modified the script, and also took into account that some of the clips were PAL and some NTSC - converted the PAL to NTSC using Bob and Weave using the recipe given here.

bg1=Imagesource("bk3.jpg", end = 15732, fps=30)

# changed the number of frames here
top = BicubicResize(Crop(DirectShowSource("1.mp4"),40,6,-36,-4),320,240,0,0.75)
audio=DirectShowSource("1.mp4")
video1=Audiodub(Overlay(bg1, top, 834, 771), audio)
# this was NTSC video, did not have to change framerate

 
bg2=Imagesource("bk3.jpg", end = 17264, fps=30)
# changed the number of frames here to match number of frames
#  in 30 fps version of ntscvid2 below

palvid2=DirectShowSource("2.mp4")
palvid2=Bob(palvid2) # Separate fields and interpolate them to full height.
palvid2 = ChangeFPS(palvid2, 60000, 1001)
# Convert field rate to NTSC, by duplicating fields.


palvid2 = SeparateFields(palvid2)
palvid2 = SelectEvery(palvid2,4,0,3)
# Undo Bob, even field first. Use SelectEvery(4,1,2) for odd field first.
ntscvid2= Weave(palvid2)
top2 = BicubicResize(ntscvid2,320,240,0,0.75)
audio2=DirectShowSource("2.mp4")
video2=Audiodub(Overlay(bg2, top2, 834, 771), audio2)

# and so on

No comments:

Post a Comment