Our website is made possible by displaying online advertisements to our visitors. Consider supporting us by disable your adblocker or Try ConvertXtoDVD and convert all your movies to DVD. Free trial ! :)

# How to edit with Avisynth

Thread
1. 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....
2. 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,18 0,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,72 0,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,18 0,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,72 0,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,1 80,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,7 20,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,1 80,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,7 20,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)
3. 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)
4. 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?
5. 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.
6. 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.
7. yes, they work perfectly, except for the "trim" function.
8. Originally Posted by tigerten
yes, they work perfectly, except for the "trim" function.
Even if you loop the short small clips?
9. 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.
10. 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.
11. 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?
12. 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.
13. 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?
14. 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.
15. 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 !!!
16. Total noob here. Had the following script to edit SD clips in the past:
**********
Loadcplugin("c:\program files\avisynth 2.5\plugins\yadif.dll")
Clip1=DirectShowSource("M:\UnconvertedVideo\Clip 017.m2t").Trim(160,320)
Clip2=DirectShowSource("M:\UnconvertedVideo\Clip 015.m2t").Trim(50,350)+Trim
Dissolve(clip1,clip2,10)
yadif()
**********
Now trying to use same scipt on HD clips (*.m2t) files. VirtualDub doesn't load this script.

My questions:
1.Why doesn't VirtualDub load my script?
2.Which filter do you recommend for voiceovers (to replace original bad audio) and what would be its usage?
17. Sorry, if I'm asking in wrong topic. I need to edit the Avisynth => Edit filtering script many times. So, how or where do I have to edit and then make as the new edited as default? I don't want to edit before all encoding, it really sucks. Thanks and sorry!
18. Hello guys sorry to ask here Bt I am really stuck some where..
I am new user of Avisynth I need some help and stuck for last one month. Coming to the point.
#1: I am using AVisynth with avspmod (there is also Virtualdub but not working for me. Thanks GOD avspmod working well) and created stalling (freezing frame) with command line
Directshowsource("C:\xxxxx.mp4")
FreezeFrame(1000,1125,1000)
This command freeze frames well. But there is no audio now (Neither in smooth video nor in freeze frames). I need both audio and video. how to do this??? any command line or anything else?? please help

#2. I want to show an indicator (spinner) when video freezes Like we normally see in YouTube videos when there is loading or buffering. my question is How is it possible to create this indicator (spinner) during video freeze (frame freeze)??

Your reply will be highly appreciated.
19. 1. I extract the audio, work on it separately, and then add it back during the encode or later during muxing. There's no need to have the audio in the script. By the way, you should use a different source filter, not directshowsource. FFMPEGSource or LSmash. In your DirectShowSource you can get audio by adding 'audio = true',

2. A spinner or for when you use the Freezeframe filter? Forget it. And you should be able to use VDub if you're successfully working using AvsPMod. You open scripts using File->Open Video File. If that doesn't work, what error message do you get?
20. You can add a spinner pretty easily with Animate()

Code:
```function ShowSpinner(clip bg, clip spinner, float angle)
{
Overlay(bg, spinner.Rotate(angle), mask=Spinner.Rotate(angle).ColorYUV(cont_y=50), x=bg.width/2-spinner.width/2, y=bg.height/2-spinner.height/2)
}

# build a clip of frame numbers (easy to identify frames)
BlankClip(length=1500, width=640, height=480, pixel_type="YV12", fps=30).ShowFrameNumber()
Crop(width-80,0,-0,-0)
StackHorizontal(last, last)
StackHorizontal(last, last)
StackHorizontal(last, last)

# get the spinner image
spinner = ImageSource("spinner.png", start=0, end=23, fps=23.976).ConvertToYV12()

#add the freeze frame
FreezeFrame(1000,1125,1000)

# break the clip into three parts, add spinner to freezeframe section
p1 = Trim(0,1000)
p2 = Trim(1001,1124)
p2 = Animate(0,124, "ShowSpinner", p2,spinner,0.0, p2,spinner,1000.0)
p3 = Trim(1125,0)

# put the three parts back together
p1+p2+p3```

In this example the image is a static semicircle that rotates at the center of the frame. An animated spinner (ie, the spinner changes shape as well as rotating) would be a little more difficult. This script runs without a source video (it creates its own). You just need to put spinner.png (included above) in the same folder.

Are you sure you want to use FreezeFrame there? That will freeze at frame 1000 but when the freeze is over it resumes with frame 1125. A "buffering" problem would resume at frame 1001 and extend the length of the clip by 125 frames. Use Loop(125,1000,1000) instead to get the latter.
21. Originally Posted by jagabo
You can add a spinner pretty easily with Animate()

Code:
```function ShowSpinner(clip bg, clip spinner, float angle)
{
Overlay(bg, spinner.Rotate(angle), mask=Spinner.Rotate(angle).ColorYUV(cont_y=50), x=bg.width/2-spinner.width/2, y=bg.height/2-spinner.height/2)
}

# build a clip of frame numbers (easy to identify frames)
BlankClip(length=1500, width=640, height=480, pixel_type="YV12", fps=30).ShowFrameNumber()
Crop(width-80,0,-0,-0)
StackHorizontal(last, last)
StackHorizontal(last, last)
StackHorizontal(last, last)

# get the spinner image
spinner = ImageSource("spinner.png", start=0, end=23, fps=23.976).ConvertToYV12()

#add the freeze frame
FreezeFrame(1000,1125,1000)

# break the clip into three parts, add spinner to freezeframe section
p1 = Trim(0,1000)
p2 = Trim(1001,1124)
p2 = Animate(0,124, "ShowSpinner", p2,spinner,0.0, p2,spinner,1000.0)
p3 = Trim(1125,0)

# put the three parts back together
p1+p2+p3```

[Attachment 46780 - Click to enlarge]

In this example, the image is a static semicircle that rotates at the center of the frame. An animated spinner (ie, the spinner changes shape as well as rotating) would be a little more difficult. This script runs without a source video (it creates its own). You just need to put spinner.png (included above) in the same folder.

Are you sure you want to use FreezeFrame there? That will freeze at frame 1000 but when the freeze is over it resumes with frame 1125. A "buffering" problem would resume at frame 1001 and extend the length of the clip by 125 frames. Use Loop(125,1000,1000) instead to get the latter.

Thank you for your quick reply. the code can help me a lot. But it gives an error: There is no function named "Rotate" I tried to declare Rotate in function but could not succeed. Sorry for any stupid question I am new work on AviSynth.
Another question Do I need to add my video path in the code because you have not mentioned anything...
Once again thanks for your reply
22. Originally Posted by manono
1. I extract the audio, work on it separately, and then add it back during the encode or later during muxing. There's no need to have the audio in the script. By the way, you should use a different source filter, not directshowsource. FFMPEGSource or LSmash. In your DirectShowSource you can get audio by adding 'audio = true',

2. A spinner or for when you use the Freezeframe filter? Forget it. And you should be able to use VDub if you're successfully working using AvsPMod. You open scripts using File->Open Video File. If that doesn't work, what error message do you get?
Thanks..
It only works with Directshowsource whenever I try in VirtualDub it gives an error: FFmpeg dll reading error frame= ERROR UNKNOWN.
So I prefer AvsPmod and it works for me well.
23. Originally Posted by Ghouri
But it gives an error: There is no function named "Rotate"
You need to download and install the Rotate plugin: http://www.avisynth.org.ru/rotate/rotate.html
24. Originally Posted by jagabo
Originally Posted by Ghouri
But it gives an error: There is no function named "Rotate"
You need to download and install the Rotate plugin: http://www.avisynth.org.ru/rotate/rotate.html
@Jagabo You solved my problem. Everything is working perfectly. Thank you
25. Here's a script that builds an animated spinner:

Code:
```blank = BlankClip(length=35, width=96, height=96, pixel_type="RGB32", fps=30, color=\$000000)
box = BlankClip(length=120, width=12, height=12, pixel_type="RGB32", fps=30, color=\$ffffff)

Overlay(blank, box, x=42, y=10)
Blur(1.0)
Animate(0,35, "Rotate", last,0, last,360)

b = blankclip(last)
ScriptClip("""
b = b.Loop(2,0,0).Overlay(last, mode="lighten")
return b
""")
last+last.Reverse().FlipHorizontal() # 70 frames
last+last+last+last # 280 frames```
It has to be run linearly to work correctly. Save the result as spinner.avi.

Here's a function to simulate buffering at an indicated frame, for an indicated length (number of frames). The original video's length is increased by the number of frames.

Code:
```function SimulateBuffering(clip c, clip spinner, int start, int length)
{
p1 = c.Trim(0,start)
p2 = c.Trim(start,start).Loop(length,0,0)
p2 = Overlay(p2, spinner, mask=spinner.ColorYUV(cont_y=50), x=c.width/2-spinner.width/2, y=c.height/2-spinner.height/2)
p3 = c.Trim(start+1,0)
p1+p2+p3
}```
Use it like this:

Code:
```WhateverSource("filename.ext")
spinner = AviSource("spinner.avi").ConvertToYV12()
SimulateBuffering(spinner,1000,125)
SimulateBuffering(spinner,500,100)```
26. Now it seems much better. The indication of the spinner is full 360.
Thank you Jagabo

Statistics