Forum archive - How to edit with Avisynth

http://www.supermediastore.com/



Forum Archive Home -> User guides -> How to edit with Avisynth



How to edit with Avisynth

Truman posted 2002 Jun 28 12:36
How to edit with Avisynth

Newbies start here
Download
Sample scripts

Introduction
Avisynth is a very useful utility created by Ben Rudiak-Gould. It provides many options for joining and filtering videos. What makes Avisynth unique is the fact that it is not a stand-alone program that produces output files. Instead, Avisynth acts as the "middle man" between your videos and video applications.

Basically, Avisynth works like this: First, you create a simple text document with special commands, called a script. These commands make references to one or more videos and the filters you wish to run on them. Then, you run a video application, such as VirtualDub, and open the script file. This is when Avisynth takes action. It opens the videos you referenced in the script, runs the specified filters, and feeds the output to video application. The application, however, is not aware that Avisynth is working in the background. Instead, the application thinks that it is directly opening a filtered AVI file that resides on your hard drive.( http://www.lukesvideo.com/avisynth.html )

Avisynth is a scripting language and a collection of filters for simple non-linear editing tasks. Avisynth is unusual in that it does not generate output files.
Instead, Avisynth scripts, which have the extension .AVS, can be opened directly
in applications which read AVI files. When an AVS file is opened, Avisynth runs in
the background, generating video and audio data according to the script and feeding
it to the application as needed.

Original Avisynth homepage (Ben Rudiak-Gould)
Avisynth doc (updated by dividee)
more guides how to use Avisynth with Adobe Premiere, DVDx, etc.

Download:

Avisynth 1.0beta7d (dividee)
Avisynth 1.0beta6 (Edwin van Eggelen)
Plugins
SpatialSoftenMMX (fixed by dividee)
Mpeg2Dec (original by M.Born)
MPEG2DEC (modified by dividee, added some filters, e.g. TemporalSmoother)
MPEG2DEC2 (modified by Tom Barry)
Vobsub / TextSub (Gabest)
Avisynth BMP loader (dvd2svcd)
Decomb / Tweak (Donald Graft)
VirtualDub filters import script
Avisynth subtitler (dvd2svcd)
GreedyHMA (Tom Barry)
GreyYUY2 (Steady)
ImageSequence (bzzz)
IVTC (Wizard)
Merge 1.0 (Klaus Post)
MJPEGcorrect
SimpleResize 0.3 (Tom Barry)
SmoothHIQ 1.0 (Klaus Post)
TemporalSoften2 (dividee)
UnFilter (Tom Barry)
VScope 1.1 (Randy French)
There are some tools, that help you to write basic scripts.
GordianKnot
D@rk$oul's AVSGen
MPEG2DEC GUI (esby)
AVStool (french)
FitCD (shh)

more links on request


Sample scripts

Make the text roll
Video fade in/out. Dissolve
Add subtitles
Crop and split screen
Resize and add borders
Zoom in/out
Picture in Picture
Full animated menu
Insert a blank clip
Make a video clip from a still image
Clean up a clip captured from VHS tape
Cut and join
Add a logo
Video/audio Reverse SlowMotion FastMotion

more scripts on request

________________________________________________________________________________________
Make the text roll

The following sample scripts create credits of a home-made video. Source is 720x576, 25 fps.

Zoom out the main movie title
:

AVISource("D:\video\jack.avi")
Animate(0,100,"subtitle","Little Jack's",-1000,500,0,150,"Arial",
  \  1000,$FF0000,"Little Jack's",70,300,0,150,"Arial",60,$FF0000)
Animate(0,100,"subtitle","birthday party",-1000,500,0,150,"Arial",
  \  1000,$FF0000,"birthday party",70,350,0,150,"Arial",60,$FF0000)

Zoom in the title
:

AVISource("D:\video\jack.avi")
Animate(0,100,"subtitle","Little Jack's",240,300,0,150,"Arial",
  \  0,$FF0000,"Little Jack's",70,300,0,150,"Arial",60,$FF0000)
Animate(0,100,"subtitle","birthday party",240,300,0,150,"Arial",
  \  0,$FF0000,"birthday party",70,350,0,150,"Arial",60,$FF0000)


Simple text (credits)

:

AVISource("D:\video\jack.avi")
Subtitle("starring",180,300,150,200,"Arial",40,$FFFFFF)
Subtitle("Jack",200,360,150,200,"Arial",40,$FFFFFF)
#
Subtitle("co-starring",150,300,225,275,"Arial",40,$FFFFFF)
#
Subtitle("mum",180,300,300,350,"Arial",40,$FFFFFF)
Subtitle("and",205,340,300,350,"Arial",20,$FFFFFF)
Subtitle("dad",190,390,300,350,"Arial",40,$FFFFFF)


Rolling text (upwards)

:

AVISource("D:\video\jack.avi")
Animate(400,600,"subtitle","editor.......Bob",100,500,400,600,"Arial",
  \  40,$FFFFFF,"editor.......Bob",100,100,400,600,"Arial",40,$FFFFFF)
Animate(420,620,"subtitle","camera.......Jim",100,500,420,620,"Arial",
  \  40,$FFFFFF,"camera.......Jim",100,100,420,620,"Arial",40,$FFFFFF)
Animate(440,640,"subtitle","regie.......susi",100,500,440,640,"Arial",
  \  40,$FFFFFF,"regie.......susi",100,100,440,640,"Arial",40,$FFFFFF)
Animate(460,660,"subtitle","producer......Ed",100,500,460,660,"Arial",
  \  40,$FFFFFF,"producer......Ed",100,100,460,660,"Arial",40,$FFFFFF)
Animate(480,680,"subtitle","drinks.......Mag",100,500,480,680,"Arial",
  \  40,$FFFFFF,"drinks.......Mag",100,100,480,680,"Arial",40,$FFFFFF)
Animate(500,700,"subtitle","breakfast...Will",100,500,500,700,"Arial",
  \  40,$FFFFFF,"breakfast...Will",100,100,500,700,"Arial",40,$FFFFFF)
Animate(520,720,"subtitle","sponsor......mum",100,500,520,720,"Arial",
  \  40,$FFFFFF,"sponsor......mum",100,100,520,720,"Arial",40,$FFFFFF)
Animate(540,740,"subtitle","party..mcDonalds",100,500,540,740,"Arial",
  \  40,$FFFFFF,"party..mcDonalds",100,100,540,740,"Arial",40,$FFFFFF)
#
Animate(750,950,"subtitle","Bob",100,500,750,950,"Arial",40,$FFFFFF,
  \  "Bob",100,100,750,950,"Arial",40,$FFFFFF)
Animate(770,970,"subtitle","Jim",100,500,770,970,"Arial",40,$FFFFFF,
  \  "Jim",100,100,770,970,"Arial",40,$FFFFFF)
Animate(790,990,"subtitle","susi",100,500,790,990,"Arial",40,$FFFFFF,
  \  "susi",100,100,790,990,"Arial",40,$FFFFFF)
Animate(810,1010,"subtitle","Ed",100,500,810,1010,"Arial",40,$FFFFFF,
  \  "Ed",100,100,810,1010,"Arial",40,$FFFFFF)
Animate(830,1030,"subtitle","Mag",100,500,830,1030,"Arial",40,$FFFFFF,
  \  "Mag",100,100,830,1030,"Arial",40,$FFFFFF)
Animate(850,1050,"subtitle","Will",100,500,850,1050,"Arial",40,$FFFFFF,
  \  "Will",100,100,850,1050,"Arial",40,$FFFFFF)
Animate(870,1070,"subtitle","Max",100,500,870,1070,"Arial",40,$FFFFFF,
  \  "Max",100,100,870,1070,"Arial",40,$FFFFFF)
Animate(890,1090,"subtitle","Mike",100,500,890,1090,"Arial",40,$FFFFFF,
  \  "Mike",100,100,890,1090,"Arial",40,$FFFFFF)
Animate(910,1110,"subtitle","Cate",100,500,910,1110,"Arial",40,$FFFFFF,
  \  "Cate",100,100,910,1110,"Arial",40,$FFFFFF)
Animate(930,1130,"subtitle","Trent",100,500,930,1130,"Arial",40,$FFFFFF,
  \  "Trent",100,100,930,1130,"Arial",40,$FFFFFF)
Animate(950,1150,"subtitle","Mark",100,500,950,1150,"Arial",40,$FFFFFF,
  \  "Mark",100,100,950,1150,"Arial",40,$FFFFFF)
Animate(970,1170,"subtitle","Tom",100,500,970,1170,"Arial",40,$FFFFFF,
  \  "Tom",100,100,970,1170,"Arial",40,$FFFFFF)
Animate(990,1190,"subtitle","Rick",100,500,990,1190,"Arial",40,$FFFFFF,
  \  "Rick",100,100,990,1190,"Arial",40,$FFFFFF)
Animate(1010,1210,"subtitle","Bruce",100,500,1010,1210,"Arial",40,
  \  $FFFFFF,"Bruce",100,100,1010,1210,"Arial",40,$FFFFFF)
Animate(1030,1230,"subtitle","Laurence",100,500,1030,1230,"Arial",40,
  \  $FFFFFF,"Laurence",100,100,1030,1230,"Arial",40,$FFFFFF)
Animate(1050,1250,"subtitle","Larry",100,500,1050,1250,"Arial",40,
  \  $FFFFFF,"Larry",100,100,1050,1250,"Arial",40,$FFFFFF)
Animate(1070,1270,"subtitle","Andy",100,500,1070,1270,"Arial",40,
  \  $FFFFFF,"Andy",100,100,1070,1270,"Arial",40,$FFFFFF)
Animate(1090,1290,"subtitle","Barry",100,500,1090,1290,"Arial",40,$FFFFFF
  \  ,"Barry",100,100,1090,1290,"Arial",40,$FFFFFF)
Animate(1110,1310,"subtitle","J.R.",100,500,1110,1310,"Arial",40,$FFFFFF
  \  ,"J.R.",100,100,1110,1310,"Arial",40,$FFFFFF)
Animate(1130,1330,"subtitle","Anne",100,500,1130,1330,"Arial",40,$FFFFFF
  \  ,"Anne",100,100,1130,1330,"Arial",40,$FFFFFF)
Animate(1150,1350,"subtitle","Jane",100,500,1150,1350,"Arial",40,$FFFFFF
  \  ,"Jane",100,100,1150,1350,"Arial",40,$FFFFFF)
Animate(1170,1370,"subtitle","Tarzan",100,500,1170,1370,"Arial",40,
  \  $FFFFFF,"Tarzan",100,100,1170,1370,"Arial",40,$FFFFFF)
Animate(1190,1390,"subtitle","David",100,500,1190,1390,"Arial",40,$FFFFFF
  \  ,"David",100,100,1190,1390,"Arial",40,$FFFFFF)
Animate(1210,1310,"subtitle","Don",100,500,1210,1410,"Arial",40,$FFFFFF
  \  ,"Don",100,300,1210,1410,"Arial",40,$FFFFFF)
#
Subtitle("and",200,300,1420,1500,"Arial",20,$FFFFFF)
Subtitle("Josephine",100,360,1420,1500,"Arial",40,$FFFFFF)
#
BilinearResize(448,542).AddBorders(16,17,16,17)


Rolling text (downwards)

:

AVISource("D:\video\jack.avi")
Animate(400,600,"subtitle","editor.......Bob",100,100,400,600,"Arial",
  \  40,$FFFFFF,"editor.......Bob",100,500,400,600,"Arial",40,$FFFFFF)
Animate(420,620,"subtitle","camera.......Jim",100,100,420,620,"Arial",
  \  40,$FFFFFF,"camera.......Jim",100,500,420,620,"Arial",40,$FFFFFF)
Animate(440,640,"subtitle","regie.......susi",100,100,440,640,"Arial",
  \  40,$FFFFFF,"regie.......susi",100,500,440,640,"Arial",40,$FFFFFF)
Animate(460,660,"subtitle","producer......Ed",100,100,460,660,"Arial",
  \  40,$FFFFFF,"producer......Ed",100,500,460,660,"Arial",40,$FFFFFF)
Animate(480,680,"subtitle","drinks.......Mag",100,100,480,680,"Arial",
  \  40,$FFFFFF,"drinks.......Mag",100,500,480,680,"Arial",40,$FFFFFF)
Animate(500,700,"subtitle","breakfast...Will",100,100,500,700,"Arial",
  \  40,$FFFFFF,"breakfast...Will",100,500,500,700,"Arial",40,$FFFFFF)
Animate(520,720,"subtitle","sponsor......mum",100,100,520,720,"Arial",
  \  40,$FFFFFF,"sponsor......mum",100,500,520,720,"Arial",40,$FFFFFF)
Animate(540,740,"subtitle","party..mcDonalds",100,100,540,740,"Arial",
  \  40,$FFFFFF,"party..mcDonalds",100,500,540,740,"Arial",40,$FFFFFF)


Rolling text (left<----right)

:

AVISource("D:\video\jack.avi")
X2=-1500# adjust the speed of the subtitles by changing X2
Animate(400,740,"subtitle",
  \  "editor: Bob       camera: Jim      regie: susi       producer: Ed  etc.",
  \  480,500,400,740,"Arial",40,$FFFFFF,
  \  "editor: Bob       camera: Jim      regie: susi       producer: Ed  etc.",
  \  X2,500,400,740,"Arial",40,$FFFFFF)

________________________________________________________________________________________
Video fade in/out. Dissolve

Source is a home made video 720x576, 25 fps

Simple Fade out (fades the last 150 frames lineary to black at the end
and adds 1 pure black frame, audio also fades lineary to silence)

:

AVISource("D:\video\jack.avi")
FadeOut(150)


Simple Fade in

:

AVISource("D:\video\jack.avi")
Reverse.FadeOut(150).Reverse


Cover a part of the video with fade out/in

:

AVISource("D:\video\jack.avi")
part1=Trim(0,5000).FadeOut(150)
part2=Trim(5001,10000).Reverse.FadeOut(150).Reverse.FadeOut(150)
part3=Trim(10001,0).Reverse.FadeOut(150).Reverse
UnalignedSplice(part1,part2,part3)


Cover a part of the video with fade out/in without fading the sound

:

AVISource("D:\video\jack.avi")
part1=Trim(0,5000).Animate(4850,5000,"Letterbox",0,0,288,288)
part2=Trim(5001,10000).Animate(0,150,"Letterbox",288,288,0,0).
  \  Animate(9850,10000,"Letterbox",0,0,288,288)
part3=Trim(10001,0).Animate(0,150,"Letterbox",288,288,0,0)
UnalignedSplice(part1,part2,part3)


:

AVISource("D:\video\jack.avi")
part1=Trim(0,5000).Animate(4850,5000,"Levels",0,1,255,0,255,0,1,0,0,0)
part2=Trim(5001,10000).Animate(0,150,"Levels",0,1,0,0,0,0,1,255,0,255).
  \  Animate(9850,10000,"Levels",0,1,255,0,255,0,1,0,0,0)
part3=Trim(10001,0).Animate(0,150,"Levels",0,1,0,0,0,0,1,255,0,255)
UnalignedSplice(part1,part2,part3)


Dissolve - Fade the last 150 frames of the first part into the first
150 frames of the next part. Audio is blended as well.
This filter is rather useless, if you have only one source, but it
is great if you want to join several sources. Check the "cut/join" sample.

:

AVISource("D:\video\jack.avi")
part1=Trim(0,5000)
part2=Trim(5001,10000)
part3=Trim(10001,0)
Dissolve(part1,part2,part3,200)


___________________________________________________________________________________________________
Crop and split screen

Source is 720x576.
Crop 20 pixels off the left side.

:

AVISource("e:\cap.avi")
Crop(20,0,700,576)


Crop 20 pixels off the right side.

:

AVISource("e:\cap.avi")
Crop(0,0,700,576)


Crop 20 pixels off the top.

:

AVISource("e:\cap.avi")
Crop(0,20,720,556)


Crop 20 pixels off the bottom.

:

AVISource("e:\cap.avi")
Crop(0,0,720,556)


Split screen. The source resolution is 720x576.
Do nothing.

:

AVISource("e:\cap.avi")
q1=crop(0,0,360,288)
q2=crop(360,0,360,288)
q3=crop(0,288,360,288)
q4=crop(360,288,360,288)
l1=StackHorizontal(q1,q2)
l2=StackHorizontal(q3,q4)
StackVertical(l1,l2)




:

AVISource("e:\cap.avi")
q1=crop(0,0,360,288)
q2=crop(360,0,360,288)
q3=crop(0,288,360,288)
q4=crop(360,288,360,288)
l1=StackHorizontal(q4,q3)
l2=StackHorizontal(q2,q1)
StackVertical(l1,l2)




:

AVISource("e:\cap.avi")
h1=crop(0,0,360,576)
h2=crop(360,0,360,576)
StackHorizontal(h2,h1)




:

AVISource("e:\cap.avi")
h1=crop(0,0,720,288)
h2=h1.FlipVertical
StackVertical(h1,h2)

________________________________________________________________________________________
Resize and add borders

Probably the most used Avisynth filters. Calculate how to resize properly with FitCD.



Read the FitCD dokumentation.

___________________________________________________________________________________________________
Zoom in/out

Zoom into the middle of the picture.

:

AVISource("e:\cap.avi")
Animate(0,150,"BicubicResize",720,576,0,0.5,0,0,720,576,720,576,0,0.5,280,241,160,94)


Zoom out from the middle of the picture.

:

AVISource("e:\cap.avi")
Animate(0,150,"BicubicResize",720,576,0,0.5,280,241,160,94,720,576,0,0.5,0,0,720,576)


Zoom work with Animate, Crop and Resize only. If you want to zoom in/out the entire image,
i.e. without cropping, you have to resize and add borders frame by frame, because Animate
refuses start-args and end-args, that lead to different frame sizes.
__________________________________________________________________________________________
Picture in Picture

The background of this procedure is, that you split the image into several pieces
with the CROP filter and join them again with STACKHORIZONTAL/VERTICAL.


Source is here MPEG-2, dvd2avi project, cropped with dvd2avi 672x424
The 2nd source is AVI (hope you don't mind, that I resized wrong, because it is just an example.)

:

LoadPlugin("mpeg2dec2.dll")
big=mpeg2source("D:\matrix\matrix.d2v").BicubicResize(448,318).
  \  AddBorders(16,129,16,129)# final size 480x576
small=AVISource("D:\video\jack.avi").BicubicResize(68,48).
  \  AddBorders(6,6,6,6)# final size is 80x60
height1=400
height2=60
height3=116
width1=250
width2=80
width3=150
part1=big.crop(0,0,480,height1)
part2a=big.crop(0,height1,width1,height2)
part2b=small
part2c=big.crop(width1+width2,height1,width3,height2)
part2=StackHorizontal(part2a,part2b,part2c)
part3=big.Crop(0,height1+height2,480,height3)
StackVertical(part1,part2,part3)


_________________________________________________________________________________________
Full animated menu

This is an "extended" version of the script above. This sample script creates a full animated menu.
The background is any part of the video (10000 frames). Assuming, that I want to create
9 chapters later, I add 9 thumbnails to the video clip. Each thumbnail contains 10000 frames of the
video, e.g. the first 10000 of each chapter.
All 10 videoclips play simultaneously. After a while it starts to zoom into the first
thumbnail, a message appears (Chapter 1- Jack's first kiss"- please press key 1 ;-)).
The message disappears and it zooms out to the menu. Then it starts to zoom into the 2nd thumbnail
etc. etc.
I did not add audio to the script and I wont even try it. It should be easier with an audio editor.
In practice 6:40 might be too long for a menu and zooming into such a small part (96,108) is not
the best idea, because a from 96x108 to 480x576 resized image is very unsharp. This is just an example.
Loading the AVS into an application takes a couple of minutes, be patient.
Converting takes several hours, be even more patient. :LOL


big=AVIsource("D:\video\jack.avi").BicubicResize(448,542).AddBorders(16,17,16,17).Trim(0,9999)
small=AVIsource("D:\video\jack.avi").BicubicResize(96,108)
small1=Trim(small,0,9999)
small2=Trim(small,10000,19999)
small3=Trim(small,14401,24400)
small4=Trim(small,45000,54999)
small5=Trim(small,48000,57999)
small6=Trim(small,60000,69999)
small7=Trim(small,72000,81999)
small8=Trim(small,65432,75431)
small9=Trim(small,90000,99999)
x=480
height1=48
height2=108
height3=48
height4=108
height5=48
height6=108
height7=108
width1=48
width2=96
width3=48
width4=96
width5=48
width6=96
width7=48
part1=big.crop(0,0,x,height1)
part2a=big.crop(0,height1,width1,height2)
part2b=small1
part2c=big.crop(width1+width2,height1,width3,height2)
part2d=small2
part2e=big.Crop(width1+width2+width3+width4,height1,width5,height2)
part2f=small3
part2g=big.Crop(width1+width2+width3+width4+width5+width6,height1,width7,height2)
part2=StackHorizontal(part2a,part2b,part2c,part2d,part2e,part2f,part2g)
part3=big.Crop(0,height1+height2,x,height3)
part4a=big.crop(0,height1+height2+height3,width1,height4)
part4b=small4
part4c=big.crop(width1+width2,height1+height2+height3,width3,height4)
part4d=small5
part4e=big.Crop(width1+width2+width3+width4,height1+height2+height3,width5,height4)
part4f=small6
part4g=big.Crop(width1+width2+width3+width4+width5+width6,height1+height2+height3,width7,height4)
part4=StackHorizontal(part4a,part4b,part4c,part4d,part4e,part4f,part4g)
part5=big.Crop(0,height1+height2+height3+height4,x,height5)
part6a=big.crop(0,height1+height2+height3+height4+height5,width1,height6)
part6b=small7
part6c=big.crop(width1+width2,height1+height2+height3+height4+height5,width3,height6)
part6d=small8
part6e=big.Crop(width1+width2+width3+width4,height1+height2+height3+height4+height5,width5,height6)
part6f=small9
part6g=big.Crop(width1+width2+width3+width4+width5+width6,height1+height2+height3+height4+height5,width7,height6)
part6=StackHorizontal(part6a,part6b,part6c,part6d,part6e,part6f,part6g)
part7=big.Crop(0,height1+height2+height3+height4+height5+height6,x,height7)
vid=StackVertical(part1,part2,part3,part4,part5,part6,part7)
chap1in=Trim(vid,0,999).Animate(700,900,"BicubicResize",480,576,0,0.5,0,0,480,576,480,576,0,0.5,48,48,96,108)
chap1out=Trim(vid,1000,1499).Animate(100,300,"BicubicResize",480,576,0,0.5,48,48,96,108,480,576,0,0.5,0,0,480,576)
chap2in=Trim(vid,1500,1999).Animate(200,400,"BicubicResize",480,576,0,0.5,0,0,480,576,480,576,0,0.5,192,48,96,108)
chap2out=Trim(vid,2000,2499).Animate(100,300,"BicubicResize",480,576,0,0.5,192,48,96,108,480,576,0,0.5,0,0,480,576)
chap3in=Trim(vid,2500,2999).Animate(200,400,"BicubicResize",480,576,0,0.5,0,0,480,576,480,576,0,0.5,336,48,96,108)
chap3out=Trim(vid,3000,3499).Animate(100,300,"BicubicResize",480,576,0,0.5,336,48,96,108,480,576,0,0.5,0,0,480,576)
chap4in=Trim(vid,3500,3999).Animate(200,400,"BicubicResize",480,576,0,0.5,0,0,480,576,480,576,0,0.5,48,204,96,108)
chap4out=Trim(vid,4000,4499).Animate(100,300,"BicubicResize",480,576,0,0.5,48,156,96,108,480,576,0,0.5,0,0,480,576)
chap5in=Trim(vid,4500,4999).Animate(200,400,"BicubicResize",480,576,0,0.5,0,0,480,576,480,576,0,0.5,192,204,96,108)
chap5out=Trim(vid,5000,5499).Animate(100,300,"BicubicResize",480,576,0,0.5,192,156,96,108,480,576,0,0.5,0,0,480,576)
chap6in=Trim(vid,5500,5999).Animate(200,400,"BicubicResize",480,576,0,0.5,0,0,480,576,480,576,0,0.5,336,204,96,108)
chap6out=Trim(vid,6000,6499).Animate(100,300,"BicubicResize",480,576,0,0.5,336,156,96,108,480,576,0,0.5,0,0,480,576)
chap7in=Trim(vid,6500,6999).Animate(200,400,"BicubicResize",480,576,0,0.5,0,0,480,576,480,576,0,0.5,48,360,96,108)
chap7out=Trim(vid,7000,7499).Animate(100,300,"BicubicResize",480,576,0,0.5,48,360,96,108,480,576,0,0.5,0,0,480,576)
chap8in=Trim(vid,7500,7999).Animate(200,400,"BicubicResize",480,576,0,0.5,0,0,480,576,480,576,0,0.5,192,360,96,108)
chap8out=Trim(vid,8000,8499).Animate(100,300,"BicubicResize",480,576,0,0.5,192,360,96,108,480,576,0,0.5,0,0,480,576)
chap9in=Trim(vid,8500,8999).Animate(200,400,"BicubicResize",480,576,0,0.5,0,0,480,576,480,576,0,0.5,336,360,96,108)
chap9out=Trim(vid,9000,0).Animate(100,300,"BicubicResize",480,576,0,0.5,336,360,96,108,480,576,0,0.5,0,0,480,576)
chap1=UnalignedSplice(chap1in,chap1out)
chap2=UnalignedSplice(chap2in,chap2out)
chap3=UnalignedSplice(chap3in,chap3out)
chap4=UnalignedSplice(chap4in,chap4out)
chap5=UnalignedSplice(chap5in,chap5out)
chap6=UnalignedSplice(chap6in,chap6out)
chap7=UnalignedSplice(chap7in,chap7out)
chap8=UnalignedSplice(chap8in,chap8out)
chap9=UnalignedSplice(chap9in,chap9out)
UnalignedSplice(chap1,chap2,chap3,chap4,chap5,chap6,chap7,chap8,chap9)
Subtitle("Chapter selection",100,500,0,500,"Arial",40,$FFFFFF)
Subtitle("chapter 1",150,150,950,1050,"Arial",40,$FFFFFF)
Subtitle("_press 1_",150,450,950,1050,"Arial",40,$FFFFFF)
Subtitle("chapter 2",150,150,1950,2050,"Arial",40,$FFFFFF)
Subtitle("_press 2_",150,450,1950,2050,"Arial",40,$FFFFFF)
Subtitle("chapter 3",150,150,2950,3050,"Arial",40,$FFFFFF)
Subtitle("_press 3_",150,450,2950,3050,"Arial",40,$FFFFFF)
Subtitle("chapter 4",150,150,3950,4050,"Arial",40,$FFFFFF)
Subtitle("_press 4_",150,450,3950,4050,"Arial",40,$FFFFFF)
Subtitle("chapter 5",150,150,4950,5050,"Arial",40,$FFFFFF)
Subtitle("_press 5_",150,450,4950,5050,"Arial",40,$FFFFFF)
Subtitle("chapter 6",150,150,5950,6050,"Arial",40,$FFFFFF)
Subtitle("_press 6_",150,450,5950,6050,"Arial",40,$FFFFFF)
Subtitle("chapter 7",150,150,6950,7050,"Arial",40,$FFFFFF)
Subtitle("_press 7_",150,450,6950,7050,"Arial",40,$FFFFFF)
Subtitle("chapter 8",150,150,7950,8050,"Arial",40,$FFFFFF)
Subtitle("_press 8_",150,450,7950,8050,"Arial",40,$FFFFFF)
Subtitle("chapter 9",150,150,8950,9050,"Arial",40,$FFFFFF)
Subtitle("_press 9_",150,450,8950,9050,"Arial",40,$FFFFFF)
Subtitle("Chapter selection",100,500,9500,0,"Arial",40,$FFFFFF)
#ResampleAudio(44100)


_________________________________________________________________________________________
Insert a blank clip

Insert a 5 sec blank clip between two scenes of the movie movie. Framesize,
framerate and colour space of the blank clip must match the properties of the movie.

:

LoadPlugin("MPEG2DEC.dll")
AudioDub(mpeg2source("D:\matrix\matrix.d2v"),
  \  WAVSource("D:\matrix\matrix.wav")).
  \  BilinearResize(448,404,0,0,720,576).AddBorders(16,80,16,92)
clip1=Trim(0,999).FadeOut(100)
clip2=Trim(1000,0).Reverse.FadeOut(100).Reverse
black=BlankClip(125,480,576,"YUY2",25,1,44100,true,true,$000000)
UnalignedSplice(clip1,black,clip2)


_________________________________________________________________________________________
Make a video clip from a still image

Source is a 100x100 BMP. This image will be converted to a 10 sec video clip
and inserted between two scenes of the movie movie.

:

LoadPlugin("MPEG2DEC.dll")
AudioDub(mpeg2source("D:\matrix\matrix.d2v"),
  \  WAVSource("D:\matrix\matrix.wav")).
  \  BilinearResize(448,404,0,0,720,576).AddBorders(16,80,16,92)
clip1=Trim(0,999).FadeOut(100)
clip2=Trim(1000,0).Reverse.FadeOut(100).Reverse
LoadPlugin("Avisynth BMP Loader.dll")
BlankClip(250,100,100,"YUY2",25,1,44100,true,true,$000000)
pic=AvisynthBMP_Loader("C:\Pics\","smile.bmp").
  \  BilinearResize(448,404).AddBorders(16,80,16,92).Reverse.
  \  FadeOut(100).Reverse.FadeOut(100)
UnalignedSplice(clip1,pic,clip2)


________________________________________________________________________________________
Clean up a clip captured from VHS tape

Source is 640x480.

Cover garbage on the bottom of the clip.

:

LoadPlugin("MPEG2DEC.dll")
mpeg2source("I:\cap\cap.d2v")
Letterbox(0,16)


Crop garbage off the bottom of the clip. To keep the proper framesize and aspect ratio,
add as many border count lines as you croped before.

:

AVISource("D:\video\jack.avi")
CropBottom(16)
AddBorders(0,0,0,16)


You prefer a centered image....

:

AVISource("D:\video\jack.avi")
Crop(0,0,640,464)
AddBorders(0,8,0,8)


You hate borders at all...., then you have to sacrifice a bit left and/or right and resize
to a valid framesize.

:

LoadPlugin("MPEG2DEC.dll")
mpeg2source("I:\cap\cap.d2v")
BicubicResize(480,480,1/3,1/3,4,0,632,464)

is the same as
:

LoadPlugin("MPEG2DEC.dll")
mpeg2source("I:\cap\cap.d2v")
Crop(4,0,632,464)
BicubicResize(480,480)


If you have a very old and noisy source, you may try to clean it with some denoise
filters. The SpatialSoften plugin work quite well. Try different filters and values.

:

LoadPlugin("MPEG2DEC.dll")
LoadPlugin("AVISynth_Spatial.dll")
Avisource("I:\cap\cap.avi")
Crop(4,0,632,464)
SpatialSoftenMMX(2,4,6,false,false,4,4,6,8)
TemporalSmoother(3,3)
SpatialSoftenMMX(2,4,6,false,false,4,4,6,8)
BicubicResize(480,480)


________________________________________________________________________________________
Cut and join

You have captured a TV show. Cut out the commercials.

:

AVISource("d:\cap\cap.avi")
Trim(0,30000)+Trim(36000,65000)+Trim(71000,0)


Join captured clips in a new order

:

AVISource("d:\cap\cap.avi")
Trim(0,30000)+Trim(71000,0)+Trim(36000,65000)


Join several clips

:

AVISource("d:\cap\cap1.avi")+AVISource("d:\cap\cap2.avi")
  \  +AVISource("d:\cap\cap3.avi")


You have captured several shows and want to extract some scenes of each show and join
it to a new compilation.

:

LoadPlugin("mpeg2dec.dll")
LoadVFAPIPlugin("c:\mpegtool\TMPGEnc\m2v.vfp","m2vsource")
v1=AVISource("d:\cap\cap1.avi").BilinearResize(480,576)
v2=ConvertFPS(AVISource("d:\cap\cap2.avi"),25)
v3=AVISource("d:\cap\cap3.avi")
v4=m2vsource("d:\cap\cap.mpg")
v5=AudioDub(mpeg2source("d:\cap\cap.d2v"),WAVsource("d:\cap\cap.wav")
v6=SegmentedAVISource("d:\cap\cap4.avi")
Trim(v4,4836,8463)+Trim(v1,100,5000)+Trim(v6,10000,0)+Trim(v6,2000,7000)+
  \  Trim(v2,1000,9000)+Trim(v5,0,6543)+Trim(v5,6550,0)+Trim(v3,4836,8463)


You may add some fade in/out/cross effects.

:

LoadPlugin("mpeg2dec.dll")
LoadVFAPIPlugin("c:\mpegtool\TMPGEnc\m2v.vfp","m2vsource")
v1=AVISource("d:\cap\cap1.avi").BilinearResize(480,576)
v2=ConvertFPS(AVISource("d:\cap\cap2.avi"),25)
v3=AVISource("d:\cap\cap3.avi")
v4=m2vsource("d:\cap\cap.mpg")
v5=AudioDub(mpeg2source("d:\cap\cap.d2v"),WAVsource("d:\cap\cap.wav")
v6=SegmentedAVISource("d:\cap\cap4.avi")
c1=Trim(v4,4836,8463).Reverse.FadeOut(100).Reverse.FadeOut(100)
c2=Trim(v1,100,5000).Reverse.FadeOut(100).Reverse.FadeOut(100)
c3=Trim(v6,10000,0).Reverse.FadeOut(100).Reverse
c4=Trim(v6,2000,7000)
c5=Trim(v2,1000,9000)
c6=Trim(v5,0,6543)
c7=Trim(v5,6550,0)
c8=Trim(v3,4836,8463).FadeOut(100)
c3_8=Dissolve(c3,c4,c5,c6,c7,c8,100)
UnalignedSplice(c1,c2,c3_8)


Another way to cross fade... At the end of the first clip the image moves to the left
side followed by the image of the 2nd clip. The sound of both clips is faded linearly
into each other.

:

Split the video and audio to separate files.
videoclip1=AVIsource("D:\cap1.avi")# no audio
videoclip2=AVIsource("D:\cap2.avi")# no audio
audioclip1=WAVsource("D:\cap1.wav")
audioclip2=WAVsource("D:\cap2.wav")
v1=Trim(videoclip1,0,3849)
a1=Trim(AudioDub(videoclip1,audioclip1),0,3849)
v2=Trim(videoclip1,3850,3999)
a2=Trim(AudioDub(videoclip1,audioclip1),3850,3999)
v3=Trim(videoclip2,0,149)
a3=Trim(AudioDub(videoclip2,audioclip2),0,149)
v4=Trim(videoclip2,150,7499)
a4=Trim(AudioDub(videoclip2,audioclip2),6150,7499)
#
s2_3=StackHorizontal(v2,v3)
v2_3=Animate(0,299,"CROP",s2_3,0,0,720,576,s2_3,1440,0,720,576)
video=UnalignedSplice(v1,v2_3,v4)
audio=Dissolve(a1+a2,a3+a4,150)
AudioDub(video,audio)


zoom

:

v1=AVISource("e:\cap1.avi")
v2=AVISource("e:\cap2.avi")
c1=Animate(10000,10150,"BicubicResize",v1,720,576,0,0.5,0,0,720,576,v1,720,576,0,0.5,280,241,160,94)
c2=Animate(0,150,"BicubicResize",v2,720,576,0,0.5,280,241,160,94,v2,720,576,0,0.5,0,0,720,576)
Dissolve(c1,c2,50)


letterbox

:

LoadPlugin("C:\WINNT\system32\MPEG2DEC2.dll")
v1=AVISource("e:\cap1.avi").
  \  Animate(9949,10000,"subtitle","________________________",0,0,9949,10000,"Arial",60,$000000,
  \  "________________________",0,288,9949,10000,"Arial",60,$000000).
  \  Animate(9949,10000,"subtitle","________________________",0,576,9949,10000,"Arial",60,$000000,
  \  "________________________",0,288,9949,10000,"Arial",60,$000000)
v2=AVISource("e:\cap2.avi").
  \  Animate(0,49,"letterbox",288,288,0,0)
UnalignedSplice(v1,v2)



________________________________________________________________________________________
Add a logo

There is no Avisynth logo filter. That's why I use Donald Graft's logo filter for
VirtualDub. Also I added this example to show how to use VirtualDub plugins.

Static logo fades in (frame #100-199) and fades out (frame #401-500). It will appear
in the very upper left corner of the image.

:

LoadPlugin("mpeg2dec.dll")
AudioDub(mpeg2source("D:\matrix\matrix.d2v").BicubicResize(448,318).
  \  AddBorders(16,129,16,129).Trim(0,9999),WAVSource("D:\matrix\matrix.wav"))
function VD_Logo(clip clip, int "x", int "y", int "alpha", bool "transparent",
  \  int "xr", int "xg", int "xb", int "tolerance", string "filename",
  \  bool "animate", int "start", int "duration", int "loops",
  \  int "fadeinlen", int "fadeoutend", int "fadeoutlen")
{
  LoadVirtualdubPlugin("c:\program files\VirtualDub-1_4_10\plugins"
    \  +"\logo.vdf", "_VD_Logo", 1)
  return clip._VD_Logo(default(x,0), default(y,0), default(alpha,128),
    \  default(transparent,true)?1:0, default(xr,0), default(xg,0),
    \  default(xb,255),default(tolerance,0), default
    \  (filename,VirtualDub_plugin_directory+"\logo.bmp"),
    \  default(animate,false)?1:0, default(start,0), default(duration,0),
    \  default(loops,0),default(fadeinlen,0),
    \  default(fadeoutend,200), default(fadeoutlen,0))
}
ConvertToRGB()
VD_logo(0,0,128,true,0,0,0,0,"D:\MyLogo.bmp",false,100,500,0,100,500,100)
ConvertToYUY2()


Static logo (100x100) appers in the middle of the image (480x576). It is flashing 1 time
per second and will disappear after 12 seconds.

:

LoadPlugin("mpeg2dec.dll")
AudioDub(mpeg2source("D:\matrix\matrix.d2v").BicubicResize(448,318).
  \  AddBorders(16,129,16,129).Trim(0,9999),WAVSource("D:\matrix\matrix.wav"))
Import("D:\vdub_filters.avs")
ConvertToRGB
VD_logo(190,238,128,true,0,0,0,0,"D:\MyLogo.bmp",false,1,25,0,12,25,12)
VD_logo(190,238,128,true,0,0,0,0,"D:\MyLogo.bmp",false,26,25,0,12,50,12)
VD_logo(190,238,128,true,0,0,0,0,"D:\MyLogo.bmp",false,51,25,0,12,75,12)
VD_logo(190,238,128,true,0,0,0,0,"D:\MyLogo.bmp",false,76,25,0,12,100,12)
VD_logo(190,238,128,true,0,0,0,0,"D:\MyLogo.bmp",false,101,25,0,12,125,12)
VD_logo(190,238,128,true,0,0,0,0,"D:\MyLogo.bmp",false,126,25,0,12,150,12)
VD_logo(190,238,128,true,0,0,0,0,"D:\MyLogo.bmp",false,151,25,0,12,175,12)
VD_logo(190,238,128,true,0,0,0,0,"D:\MyLogo.bmp",false,176,25,0,12,200,12)
VD_logo(190,238,128,true,0,0,0,0,"D:\MyLogo.bmp",false,201,25,0,12,225,12)
VD_logo(190,238,128,true,0,0,0,0,"D:\MyLogo.bmp",false,226,25,0,12,250,12)
VD_logo(190,238,128,true,0,0,0,0,"D:\MyLogo.bmp",false,251,25,0,12,275,12)
VD_logo(190,238,128,true,0,0,0,0,"D:\MyLogo.bmp",false,276,25,0,12,300,12)
ConvertToYUY2


To make an animated logo, create a series of bitmap files *0000.bmp, *0001.bmp, *0002.bmp, etc.
Here the logo will appear from start to the end of the movie, because it loops forever.

:

AviSource("e:\movie.avi")
Import("D:\vdub_filters.avs")
ConvertToRGB
VD_Logo(20,20,255,true,0,0,0,0,"D:\logo0001.bmp",true,0,1,0,0,0,0)
ConvertToYUY2



________________________________________________________________________________________________
Video/audio Reverse SlowMotion FastMotion

Simple reverse

:

Avisource("c:\video.avi")
Reverse


Simple slow motion (5 times as slow)

:

Avisource("c:\video.avi")
ConvertFPS(125).AssumeFPS(25,sync_audio=true).ResampleAudio(44100)


Simple fast motion (5 times as fast)

:

Avisource("c:\video.avi")
ConvertFPS(5,zone=80,vbi=49).AssumeFPS(25,sync_audio=true).ResampleAudio(44100)


The following sample scrip combines the 3 scripts above.
The video starts and plays 5 minutes with normal speed. Then the image freezes 2 seconds.
Fast motion back to 4:00 followed by slow motion to 5:00.
Fast motion back to 4:00 followed by fast motion to 5:00.
After that it plays normally till the end (6:40).
You will end with a 10:26 clip. Audio is in sync all the time.
Also try ChangeFPS instead of ConvertFPS.

:

vid=AudioDub(AVIsource("c:\video.avi"),WAVSource("c:\audio.wav"))
clip1=Trim(vid,0,7499)# 7500 frames
clip2=FreezeFrame(Trim(vid,0,49),0,49,7499)# 50 frames
clip3=Trim(vid,6500,7499).Reverse.ConvertFPS(5,zone=80,vbi=49).AssumeFPS(25,sync_audio=true)
  \  .ResampleAudio(44100)# 200 frames
clip4=Trim(vid,6500,7499).ConvertFPS(125).AssumeFPS(25,sync_audio=true)
  \  .ResampleAudio(44100)# 5000 frames
clip5=Trim(vid,6500,7499).Reverse.ConvertFPS(5,zone=80,vbi=49).AssumeFPS(25,sync_audio=true)
  \  .ResampleAudio(44100)# 200 frames
clip6=Trim(vid,6500,7499).ConvertFPS(5,zone=80,vbi=49).AssumeFPS(25,sync_audio=true)
  \  .ResampleAudio(44100)# 200 frames
clip7=Trim(vid,7500,9999)# 2500 frames
UnalignedSplice(clip1,clip2,clip3,clip4,clip5,clip6,clip7)


___________________________________________________________________________________________________



asnamlar posted 2002 Jun 28 13:02
Hi Truman, I use Avisynth to prepare my captured videos so I don't need to cut after TMPGEnc. This works fine all the time.

I would like to do the same with the project file generated by DVD2AVI but I don't know how to open this file from Avisynth, can you help me?

Thanks



Truman posted 2002 Jun 28 14:55
asnamlar :
Hi Truman, I use Avisynth to prepare my captured videos so I don't need to cut after TMPGEnc. This works fine all the time.

I would like to do the same with the project file generated by DVD2AVI but I don't know how to open this file from Avisynth, can you help me?

Thanks


Copy MPEG2DEC.dll to winnt\system32 (windows\system).
Create the dvd2avi project.

LoadPlugin("mpeg2dec.dll)
mpeg2source("C:\dir\filename.d2v")

You have to use avisynth 1.0beta3 or later.



Daagar posted 2002 Jun 28 17:28
Great guide! The links to all the various versions of avisynth and related filters is worth the read alone. There are so many out there it gets very confusing. Thanks!


Truman posted 2002 Jun 28 21:41
****deleted by Truman****


kinneera posted 2002 Jun 28 23:57
Once I changed "mpeg2dec2.dll" to "mpeg2dec.dll" it appeared to be loading successfully until it gave an error on line 84 that said the arguments to function "UnalignedSplice" were wrong.

Does this script require the newest version of Avisynth?



Truman posted 2002 Jun 29 09:47
Hi Kinneera, thank you for testing the script. I used mpeg2dec2.dll instead of mpeg2dec.dll. Avisynth version is 1.0beta6. Well, I re-read the script and have found a bunch of errors. I will update it soon. Currently I am encoding to MPEG. It takes about 8 hours ! Remember, the clip is 6min 40sec only. :lol:

edit: I have added it to first post.



Big_Jit posted 2002 Jun 30 16:38
Wow! what a GREAT guide! This is one I've been waiting for! Thankyou!...


phelix posted 2002 Jul 01 00:36
Nice Guide. I would have never though making menus were possible with the available filters in avisynth.

I guess now would be a good time to mention that I'm working on new set of avisynth filters to make making menus simple. THe following script is an example:


background=AVISource("background.avi")
clip1=AVIsource("clip1.avi").BicubicResize(252,168)
clip2=AVIsource("clip2.avi").BicubicResize(252,168)
clip3=AVIsource("clip3.avi").BicubicResize(252,168)

#let's make this one circular
clip4=AVIsource("clip4.avi").BicubicResize(252,168).AlphaMask("circle_alpha_mask.png",0,0)

# lay out four clips on a background video stream, and then superimpose
# a PNG image containing the chapter titles
tmp=background.VideoOverlay4(clip1,70,30,clip2,400,30,clip3,70,280,clip4,400,280)
tmp.StillFrameOverlay("mytitles.png",0,0)

The picture below is a sample of how far I've gotten. All three images are full video streams. Notice the overlap and the shape of the center video (featuring that lovable zim character, 'the blotch').




The_Flash posted 2002 Jul 01 01:36
This is perhaps one of the most worthwhile guides posted here. Great source of information and the added links put the icing on tha cake. Terrific intro for anyone looking to get rid of the vfapi turtle. Thanks for putting in the time.


offline posted 2002 Jul 01 10:12
Impressive. This is the style of guide we should have more of on
this site - well done!



Truman posted 2002 Jul 01 11:12
phelix :

I guess now would be a good time to mention that I'm working on new set of avisynth filters to make making menus simple.

Wow, that looks very promising. I would love to test it.



ABS posted 2002 Jul 01 19:28
Great article and wel written!
And speaking of old VHS tapes, I have a very old VHS tape that has some broken fields (eg. odd lines ok, but even lines are just noise). So I converted the thing to 50fps uncompressed AVI, sized 352x288 and did all the cleaning/editing needed. Now, I understand that I could Re-interlace it from 50fps progressive to 25fps Interlace using the Weave command, but for some reason I just get a 352x288 25fps file without re-interlacing. I use the following:


a = avisource ("e:\test.avi")
AssumeFieldBased(a)
Weave(a)


Any idea what I'm doing wrong?



Truman posted 2002 Jul 02 10:16
@ ABS

a = avisource ("e:\test.avi")
AssumeFieldBased(a)
Weave

or

avisource ("e:\test.avi")
AssumeFieldBased
Weave

should work fine.



ABS posted 2002 Jul 02 11:00
Great! Works as charm! :D
Thanks!



Truman posted 2002 Jul 02 18:05
ABS, I am not an expert on interlaced video, but i was surprised to hear that the odd fields are OK and the even fields are noisy. Is that a common problem with interlaced video or old VHS tapes?
btw, hope you did the editing/cleaning with Avisynth :wink:



ABS posted 2002 Jul 03 04:27
Truman :
ABS, I am not an expert on interlaced video, but i was surprised to hear that the odd fields are OK and the even fields are noisy. Is that a common problem with interlaced video or old VHS tapes?
btw, hope you did the editing/cleaning with Avisynth :wink:


Well, I was giving it an All-too-perfect description! :)
It's actually a Compact VHS tape from my old videocamera (tape is about 7 years old) and for some reason you have alot of frames where one field (not necceraly the odd or the even) is quite ok, and the other field is just noise. Now, it was easy if there was a simple repeating pattren, but there wasn't, so I had to split it into 50fps and simply remove all the noisey fields, filling them up with interpulation of the Previous and next field. (Did it in Ulead MSP6.5) and the result was quite good.

I might put up a page on my site with small "before and after" video clips to show extactly how it is...

ABS



Tommyknocker posted 2002 Jul 19 17:51
Dear Truman:
I tried to get your animated menu to run. Since I do not have Jack.avi, I decided to use some avi clips from my Civilization II game.

I received some address erors, so I tried to change the values in the first two lines. Now it tells me the StackHorizontal Values are wrong. The avi files I want to use are 320x240. Can you help me?



Truman posted 2002 Jul 20 00:05
Frame size of "big" is 480x576.
x= width1+width2+width3+width4+width5+width6+width7=480.
height1+height2+height3+height4+height5+height6+height7=576.

If you did not change a StackHorizontal value, the script is correct.
To test the script you can simply replace d:\video\jack.avi with your path\filename.
Well, at the beginning the framesize may be wrong, but you can load it into an application without error message. Then you have to adjust the values of the resize filters.
btw, there are typo's in line 63, 65 and 67. Replace 156 with 204.



Tommyknocker posted 2002 Jul 20 01:15
I did as you said and left the values as they were, only changing the path and file names and the typos you listed. I get this error message. What am I doing wrong?



Truman posted 2002 Jul 20 02:04
:-? the infamous access violation message... I don't know, make sure, you use Avisynth 1.0 beta6 and try to load a different AVI, maybe there is a corrupt frame. Also try to load the avs into TMPGEnc or an other app.


TerryToonz posted 2002 Oct 08 11:53
Is it possible to use DeLogo in an Avisynth script?


Tommyknocker posted 2002 Oct 08 12:00
You should be able to use any VDub tool.


TerryToonz posted 2002 Oct 08 22:46
The problem is that the VD Delogo filter has a rather extensive GUI and I don't know how to apply it via Avisynth.


Truman posted 2002 Oct 09 11:31
The VirtualDub filters import file contains a sample script and a description of DeLogo 1.2.1.
Also have a look at the online manual.



TerryToonz posted 2002 Oct 10 13:49
Many thanks


tigerten posted 2002 Oct 21 22:54
dear truman.

I am trying to use this guide to make my own animated menu. As you know i am realy new to the Avisynth thing. I hope you don't laught at my question.

can you possible explain to me the those arguments numbers(what they represent) in the following line to me?

vid=StackVertical(part1,part2,part3,part4,part5,part6,part7)
chap1in=Trim(vid,0,999).Animate(700,900,"BicubicResize",480,576,0,0.5,0,0,480,576,480,576,0,0.5,48,48,96,108)
chap1out=Trim(vid,1000,1499).Animate(100,300,"BicubicResize",480,576,0,0.5,48,48,96,108,480,576,0,0.5,0,0,480,576)

Thank you very much.



Truman posted 2002 Oct 22 10:17
The filters work as follows:

Animate(start-frame,end-frame,"filtername",start-argument,end-argument)

BicubicResize(frame-target-width,frame-target-height[,b,c],
crop-sorce-left,crop-source-top,
frame-source-width,frame-source-height)

b and c are parameters to adjust the properties of two-part cubic (by Mitchel and Netravali read more about it if you like).
:

chap1in=Trim(vid,0,999).Animate(700,900,"BicubicResize",480,576,0,0.5,
0,0,480,576,480,576,0,0.5,48,48,96,108)
chap1out=Trim(vid,1000,1499).Animate(100,300,"BicubicResize",480,576,
0,0.5,48,48,96,108,480,576,0,0.5,0,0,480,576)

Frame 0-700 the framesize is 480*576
From frame 701 to 900 the frame will get cropped lineary to a frame size of 96*108 of the original framesize. (crop left48,top48,right336,bottom420). At the same time the cropped frame will get resized lineary to keep a framesize of 480*576.

Short said, it zooms into a small part of the frame.

chap1out=zoom out this way.

It is quite hard to understand, because there are hundreds of numbers in the script. Also I think there might be a better solution than using the original Avisynth filters, because this method is damn slow. I am still testing Avisynth2. Maybe it is easier to do with the layer filter or even a logo filter. However, working with this script (a lot of trial and error, I know) will help to understand how Avisynth works.

Hope it helps so far.



eatin sammiches for lunch posted 2002 Oct 22 12:00
HOLY CHEESECAKES BATMAN,

THIS IS SOME GREAT INFO!!!!


Thanx



tigerten posted 2002 Oct 22 13:50
thank you so much for the explanation. It helps a lot. I have figured everything else except for this. I checked the reference guide for the arguments formats of both animation and bicubicresize, but couldn't figure out what is what. Now it is under my control cause i know what they are now.

thanks again.

Yes it is very slow. if you ever come up with something faster, please let us know.

This is by far the best guide i have ever seen in this forum. I am trying on other example you put here, hope they all work out. I also hope you will produce more guides like this for this forum.


I have another question regarding the "trim" filter of Avisynth. It started as i designed. But it won't stop until the whole clip is finished. for example, in the animated menu. the 6 small pictures. they don't finish at the same time ( they are of the same number of frames). in stead, the number 9 finishes first (cause it starts last), the number 1 will finish last. And they all will end up at the same frame?

Can you help me with that as well?


big=AVIsource("F:\video\Clips\sanxia.avi").Trim(0,600)
small=AVIsource("F:\video\Clips\sanxia.avi").BicubicResize(180,120)
small1=Trim(small,0,150)
small2=Trim(small,151,300)
small3=Trim(small,301,450)
small4=Trim(small,451,600)
x=720
height1=80
height2=120
height3=80
height4=120
height5=80
width1=120
width2=180
width3=120
width4=180
width5=120
part1=big.crop(0,0,x,height1)
part2a=big.crop(0,height1,width1,height2)
part2b=small1
part2c=big.crop(width1+width2,height1,width3,height2)
part2d=small2
part2e=big.Crop(width1+width2+width3+width4,height1,width5,height2)
part2=StackHorizontal(part2a,part2b,part2c,part2d,part2e)
part3=big.Crop(0,height1+height2,x,height3)
part4a=big.crop(0,height1+height2+height3,width1,height4)
part4b=small3
part4c=big.crop(width1+width2,height1+height2+height3,width3,height4)
part4d=small4
part4e=big.Crop(width1+width2+width3+width4,height1+height2+height3,width5,height4)
part4=StackHorizontal(part4a,part4b,part4c,part4d,part4e)
part5=big.Crop(0,height1+height2+height3+height4,x,height5)
vid=StackVertical(part1,part2,part3,part4,part5)
chap1in=Trim(vid,0,75).Animate(5,55,"BicubicResize",720,480,0,0.5,0,0,720,480,720,480,0,0.5,120,80,180,120)
chap1out=Trim(vid,76,150).Animate(5,55,"BicubicResize",720,480,0,0.5,120,80,180,120,720,480,0,0.5,0,0,720,480)
chap2in=Trim(vid,151,225).Animate(5,55,"BicubicResize",720,480,0,0.5,0,0,720,480,720,480,0,0.5,420,80,180,120)
chap2out=Trim(vid,226,300).Animate(5,55,"BicubicResize",720,480,0,0.5,420,80,180,120,720,480,0,0.5,0,0,720,480)
chap3in=Trim(vid,301,375).Animate(5,55,"BicubicResize",720,480,0,0.5,0,0,720,480,720,480,0,0.5,120,280,180,120)
chap3out=Trim(vid,376,450).Animate(5,55,"BicubicResize",720,480,0,0.5,120,280,180,120,720,480,0,0.5,0,0,720,480)
chap4in=Trim(vid,451,525).Animate(5,55,"BicubicResize",720,480,0,0.5,0,0,720,480,720,480,0,0.5,420,280,180,120)
chap4out=Trim(vid,526,600).Animate(5,55,"BicubicResize",720,480,0,0.5,420,280,180,120,720,480,0,0.5,0,0,720,480)
chap1=UnalignedSplice(chap1in,chap1out)
chap2=UnalignedSplice(chap2in,chap2out)
chap3=UnalignedSplice(chap3in,chap3out)
chap4=UnalignedSplice(chap4in,chap4out)
UnalignedSplice(chap1,chap2,chap3,chap4)
Subtitle("Chapter selection",200,450,0,45,"Arial",40,$FFFFFF)
Subtitle("chapter 1",250,150,50,100,"Arial",40,$FFFFFF)
Subtitle("_press 1_",250,450,50,100,"Arial",40,$FFFFFF)
Subtitle("chapter 2",250,150,200,250,"Arial",40,$FFFFFF)
Subtitle("_press 2_",250,450,200,250,"Arial",40,$FFFFFF)
Subtitle("chapter 3",250,150,350,400,"Arial",40,$FFFFFF)
Subtitle("_press 3_",250,450,350,400,"Arial",40,$FFFFFF)
Subtitle("chapter 4",250,150,500,550,"Arial",40,$FFFFFF)
Subtitle("_press 4_",250,450,500,550,"Arial",40,$FFFFFF)
Subtitle("Chapter selection",200,450,551,600,"Arial",40,$FFFFFF)
#ResampleAudio(44100)



Truman posted 2002 Oct 22 15:44
In your example you have the "big" clip, that has 601 frames. Small 1 =151 frames. Small 2-4 =150 frames each. Make sure all clips have the same number of frames.
But you are right, the small clips do not stop at the end frame. I did not notice that until now. I am not sure, why the clips do not stop and probably it would take a couple of hours to figure it out. So I have a different solution, that requires Avisynth 2.02 or newer.

big=AVIsource("F:\video\Clips\sanxia.avi").Trim(0,599)
small=AVIsource("F:\video\Clips\sanxia.avi").BicubicResize(180,120)
small1=Trim(small,0,149).loop(-1,0,149)
small2=Trim(small,150,299).loop(-1,0,149)
small3=Trim(small,300,449).loop(-1,0,149)
small4=Trim(small,450,599).loop(-1,0,149)
....etc.....etc....



Truman posted 2002 Oct 22 16:17
Yes, I think I have found a faster and easier way. Again it requires at least Avisynth 2.02 (2.06 is recommended).

big=AVIsource("F:\video\Clips\sanxia.avi").Trim(0,599)
small=AVIsource("F:\video\Clips\sanxia.avi").BicubicResize(180,120)
small1=Trim(small,0,149).loop(-1,0,149)
small2=Trim(small,150,299).loop(-1,0,149)
small3=Trim(small,300,449).loop(-1,0,149)
small4=Trim(small,450,599).loop(-1,0,149)
v1=Layer(big, small1,"add",255,120,80)
v2=Layer(v1, small2,"add",255,420,80)
v3=Layer(v2, small3,"add",255,120,280)
v4=Layer(v3, small4,"add",255,420,280)
chap1in=Trim(v4,0,75).Animate(5,55,"BicubicResize",720,480,0,0.5,0,0,720,480,720,480,0,0.5,120,80,180,120)
chap1out=Trim(v4,76,150).Animate(5,55,"BicubicResize",720,480,0,0.5,120,80,180,120,720,480,0,0.5,0,0,720,480)
chap2in=Trim(v4,151,225).Animate(5,55,"BicubicResize",720,480,0,0.5,0,0,720,480,720,480,0,0.5,420,80,180,120)
chap2out=Trim(v4,226,300).Animate(5,55,"BicubicResize",720,480,0,0.5,420,80,180,120,720,480,0,0.5,0,0,720,480)
chap3in=Trim(v4,301,375).Animate(5,55,"BicubicResize",720,480,0,0.5,0,0,720,480,720,480,0,0.5,120,280,180,120)
chap3out=Trim(v4,376,450).Animate(5,55,"BicubicResize",720,480,0,0.5,120,280,180,120,720,480,0,0.5,0,0,720,480)
chap4in=Trim(v4,451,525).Animate(5,55,"BicubicResize",720,480,0,0.5,0,0,720,480,720,480,0,0.5,420,280,180,120)
chap4out=Trim(v4,526,600).Animate(5,55,"BicubicResize",720,480,0,0.5,420,280,180,120,720,480,0,0.5,0,0,720,480)
chap1=UnalignedSplice(chap1in,chap1out)
chap2=UnalignedSplice(chap2in,chap2out)
chap3=UnalignedSplice(chap3in,chap3out)
chap4=UnalignedSplice(chap4in,chap4out)
UnalignedSplice(chap1,chap2,chap3,chap4)
#text as above
8)



tigerten posted 2002 Oct 22 17:03
Thanks again truman,

I just gave the script (above) a try. unfortunately, it said "layer only support RGB32 and YUY2). My DV clip is RGB24.

Can I still use this method after some modification to my clip or what?

My Avisynth is the lates. (2.0.6)



tigerten posted 2002 Oct 22 17:36
I tried to convert it to RGB32 with Lead RGB converter. It worked after. But the resolution has reduced to about quarter(360*240, and i have no control of this) and the audio track (I chosed the PCM codec) is gone. The result is it animates but chopped to only a quarter of the original. Are you aware of any RGB converters that does this job well?


Truman posted 2002 Oct 22 17:46
big=AVIsource("F:\video\Clips\sanxia.avi").Trim(0,599).ConvertToRGB32
small=AVIsource("F:\video\Clips\sanxia.avi").BicubicResize(180,120).ConvertToRGB32

If you plan to convert it to MPEG, I suggest to ConvertToYUY2 instead.



tigerten posted 2002 Oct 22 19:19
HI, truman, you are realy knowledgable on this and HELPFUL as well.
I know so little but am very willing to learn. I just started this time consuming hobby in about a month. I learned to use Philips VCD2TK (and I did it well. I figured out a better way write that image). I have also learned the VCDimager and xml stuff ( i did it not bad either). I am a biologist by profession though and have no background in computer. I was fortunate to have joined this forum. The people here are very helpful and willing to share. Without all these inputs from these genius. I would never be able do anything. The bad side of this is this intriguing and addictive thing has taken so much of my time that is meant to be for the family.



tigerten posted 2002 Oct 23 14:42
yes, they work perfectly, except for the "trim" function.


Truman posted 2002 Oct 23 15:07
tigerten :
yes, they work perfectly, except for the "trim" function.

Even if you loop the short small clips? :-?



tigerten posted 2002 Oct 23 16:11
yes. They all loop as designed(within the ranges the trims define, so they do not play beyong the end-frame as it happened previously).

But TMPGenc (2.58 plus) won't open the newer script anymore (unsupported?). I have to frameserve it with VirtualDUB in order to encode it.

BTW, the trimming function does not work in the "cut and join" scipt either, if i still remember it correctly when i first tried it. I will give them another try and let you know. You can also test it and let me know.



tigerten posted 2002 Oct 23 16:25
I test some the cut and join scripts (not all though, can't see why other won't). they work perfectly.

I have tested the "rolling text" they are great.

Thanks.



batman0105 posted 2002 Nov 05 13:34
Regarding the following sample:

LoadPlugin("MPEG2DEC.dll")
LoadPlugin("AVISynth_Spatial.dll")
Avisource("I:\cap\cap.avi")
Crop(4,0,632,464)
SpatialSoftenMMX(2,4,6,false,false,4,4,6,8)
TemporalSmoother(3,3)
SpatialSoftenMMX(2,4,6,false,false,4,4,6,8)
BicubicResize(480,480)

Just curious, but is there a reason for the second 'SpatialSoftenMMX()' entry?



Truman posted 2002 Nov 05 16:04
As mentioned before, I do not use these soften filters that often.
I wont recommend any denoise filter or any filter setup, because every source requires a different filter adjustment.
The sript above is an example. If you have a very very noisy source you may try that. If you have a "normal" noisy source a single TemporalSoften might do the job, but of course you can chain as many soften filters as you like.



ejp posted 2003 Feb 05 04:56
for some weird reason...

when i try to open a *.avs scipt in vdub or windows media player, it just closes it. like, i try to open the script in one of those applications, and a moment later, it closes. i've used avisynth scipts before successfully.

anyone have any ideas why it's not working anymore?



wgamer posted 2004 Jan 12 07:49
HI CAN I EDIT MPEGS USING AVISYNTH

BASICALLY I HAVE GOT MPEGS WITH BAD FRAMES AND I WANT
TO REMOVE THOSE FRAMES.
COULD YOU PLZ(REPEAT PLZ) GIVE ME A STEP BY STEP GUIDE

1) I HAVE TO CREATE AN AVS FILE WITH DIRECTSHOW(OK)
2) I HAVE TO USE THE TRIM COMMAND GIVING THE BAD FRAMES(DONT KNOW HOW)
IS IT LIKE THIS "
c=DirectShowSource("myclip.mpg")
f=1234 #your 1st bad frame
c.deleteframe(f).duplicateframe(f-1)
f=4567 #your 2nd bad frame
c.deleteframe(f).duplicateframe(f-1)
.
.
.
return c

3) I HAVE TO OPEN THE AVS IN VDUB??
4) THEN ..................WHAT SHOULD I DO?(WILL IT REENCODE AGAIN?)
5) CAN I DO STEP 3) IN TMPGENC?
6) THANKS A LOOOOOOOOOOOOOOOOT.



klavijatura posted 2009 Aug 27 08:27
Same question...I have mpg files, recorded from dreambox (or originaly ts files) and i would like to put logo on it when I am encoding file in mkv format. Can anyone explain to me what to do ? I tried with codes but always says some errors :(
PLEASE HELP !!!




Login/Register to our forum to be able to post here.








DVDFab DVD to DVD and Blu-ray to Blu-ray offers a 20% discount until Nov 22, 2009. More info or download trial!
About   Advertise   Forum Archive   RSS Feeds   Statistics