Log in

View Full Version : Manipulating frame order on all files in a folder


yimmie
3rd August 2007, 23:02
I have a very common task: manipulating frame order.
I save short video parts and I have something called 'AVI constructor' to extract the frames, append them in reverse order, delete the middle and last, and make a movie from it.
The movie then appears as continous when repeating.
For example, suppose it is a 10 frames sequence AVI I saved, the frame order of the output AVI is 1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2.

I wonder if this can be automated.
Alike selecting a folder and produce for every movie in it the 'continous repeating' version of it, according to given frame handling commands.

I would save me from a huge amount manual work I have to do.

Someone on virtualdub forum said:

This is easy with an Avisynth script.

## numbering from 0: 012345678987654321
vid=avisource("yourvid.avi")
vid2=vid.trim(1,8).reverse()
vid1+vid2

So I downloaded Avisynth, and so far I wrote this with the AvsP script editor:

SetWorkingDir("L:\")
file = "I:\SmallMovies-S\S_15-Love01.avi"
clip1 = AVISource(file)
count = Framecount(clip1) - 2
clip2 = clip1.Trim(1,count).reverse()
clip2 = UnalignedSplice(clip clip1,clip clip2)

and it says Script error: expected a , or ) (Repeat.avs, line 6, column 34).
And I'm stuck on it. I can't find something in the help under \Docs that describes what exactly this is.

I have some experience with scripting in an IRC client named mIRC.
There, a function is called with either /functionname parameter1 parameter2 either $functioname(parameter1,parameter).optionalpropertyhere, where that property is then available inside the function as $prop.

This looks like something similar.
I tried deleting the () after reverse but the error remained.

Also, since my goal is batch processing, ie, I want to process a whole folder with such small AVI clips, I downloaded ScriptWriter, I had to find and download that mscoree.dll and placed it into the ScriptWriter.exe folder but it popups that it could be damaged and has an invalid format.
I read on the forum that it requires a .NET framework, I downloaded it and tried to install but it says I have to install some version of Internet Explorer and that I refuse to do, I don't want that crap anymore on my PC.
But it might be possible without.

Can someone help me on the path to my goal?

IanB
3rd August 2007, 23:32
clip2 = UnalignedSplice(clip clip1,clip clip2)This is wrong, the declaration form is used when declaring functions.
clip2 = UnalignedSplice(clip1, clip2)This is how is should be.
clip2 = clip1 + clip2Or more conventionally we use + and ++ to invoke the splice filters. (internally the 2 syntaxes are identical)

Alain2
4th August 2007, 02:17
IanB, is there an advantage of using + instead of ++ when we don't care about audio/video sync ? Speed ? I tend to use ++ all the time just in case I modify later my script, but I never checked if there was a speed penalty.. ?

yimmie
4th August 2007, 03:20
Great!
This works:

SetWorkingDir("L:\")
file = "I:\SmallMovies-S\S_15-Love01.avi"
clip1 = AVISource(file)
count = Framecount(clip1) - 2
clip2 = clip1.Trim(1,count)
clip2 = reverse(clip2)
clip2 = clip1 + clip2
clip2 = FlipVertical(clip2)
return clip2

I wrote now a script in the mIRC client to generate script files for a whole folder AVI's.
All the manual parrot work I did in the past now done with one command.
Can't believe I never discovered this before.

Thanks!

Guest
4th August 2007, 03:23
Someone on virtualdub forum said: That was me. Why didn't you follow up there?

IanB
4th August 2007, 10:54
@Alain2,

AlignedSplice and UnAlignedSplice are both zero cost filters. i.e. they mearly adjust the parameters of the GetFrame and GetAudio chains, they do not actually process any data.

yimmie
4th August 2007, 13:57
That was me. Why didn't you follow up there?
At that moment all I knew about Avisynth was its name, from seeing it here and there on the VirtualDub site.
In the following days I searched information about it and found this forum, and I asked here about the problem I ran into, since it's directly related to Avisynth, that is the reason. You pointed me in the direction I needed.