View Full Version : How to edit Correctly in AviSynth
Cunhambebe
8th May 2007, 04:14
I've got a script here that seems not working as it should be. One of the questions is: Does Trim support more than 60 arguments?
LoadPlugin("C:\unzipped\dgmpgdec148\DGDecode.dll")
LoadPlugin("c:\avs_filters\TomsMoComp\TomsMoComp_Avisynth\Debug\TomsMoComp.dll")
LoadPlugin("C:\avs_filters\ColorMatrix\colormatrix.dll")
MPEG2Source("C:\brazil.d2v").AudioDub(WavSource("C:\brazil.wav"))
ColorMatrix(d2v="brazil.d2v")
Trim(424,690) + Trim(29544,29594) + Trim(29775,30862) + Trim(695,2231) + Trim(2475,2682) + Trim(3037,3138) + Trim (3303,4796) + Trim(4962,5595) + Trim(5638,5886) + Trim(6035,6130) + Trim (6530,6605) + Trim(6225,6262) + Trim(6333,6472) + Trim(6609,6962) + Trim(7010,7858) + Trim(7935,7975) + Trim(8209,8319) + Trim(8376,8637) + Trim (8659,8763) + Trim(9168,9250) + Trim(10406,10619) + Trim(10911,11146) + Trim(11204,11983) + Trim(12233,12526) + Trim(12746,13276) + Trim(13422,15204) + Trim(15452,15662) + Trim(15782,16163) + Trim (16227,16958) + Trim(16982,17073) + Trim(17203,17274) + Trim(17425,18033) + Trim(18396,19412) + Trim(19426,19632) + Trim(19636,19796) + Trim(19845,20386) + Trim(20390,21004) + Trim(21064,21269) + Trim (21370,21436) + Trim(21748,21846) + Trim (26380,26493) + Trim (22062,22283) + Trim(21368,21437) + Trim(22287,22456) + Trim(22511,22807) + Trim(22833,23005) + Trim(23150,23183) + Trim(23347,24745) + Trim(24938,25539) + Trim(25646,26207) + Trim(26498,26985) + Trim(26990,28162) + Trim(43875,44673) + Trim(55187,55237) + Trim (52011,52189) + Trim(55082,59320) + Trim(59420,59518) + Trim(28167,28473) + Trim(59523,59591) + Trim(28478,28538) + Trim(29549,29590) + Trim(28682,29468) + Trim(30866,42946) + Trim(43016,43272) + Trim (44355,44490) + Trim(44895,52003) + Trim (52281,52926) + Trim(53000,53350) + Trim(53699,53995) + Trim (54261,54665) + Trim (54714,54893) + Trim(59595,59952) + Trim(60003,60438) + Trim(60545,63488) + Trim(63508,63902) + Trim (63916,65526) + Trim(65572,67102) + Trim(79036,80075) + Trim(67107,69033) + Trim(69170,70510) + Trim(70516,74042) + Trim(74098,78976) + Trim(80077,80153) + Trim(43330,43462) + Trim(90,337) + Trim (44898,47172) + Trim (47241,49062) + Trim (49198,59913) + Trim (54930,54981) + Trim(43467,43680)
FadeIn(35)
TomsMoComp(1,5,1) # video is TFF
Crop(8,4,-8,-4)
Lanczos4Resize(640,480)
FadeOut(135)
ConvertToYv12()
I see that the sequences in VDMod don't match the figures beyond a certain point, only keeping the final sequence untouched. Why? Can anyone help me please? Thanks in advance.
techreactor
8th May 2007, 05:21
Thats a lot of trims, havent tried it myself but can you open this script successfully in mediaplayer classic ???, that should give you a hint.
Fizick
8th May 2007, 05:36
Do you use backslash for long line continuation?
+ is a synonym for alignedsplice which only takes 60 args.
Try...
X = X + Trim(123,456)
X = X + Trim(789,1234)
....
X
+ is a synonym for alignedsplice which only takes 60 args.
Try...
X = X + Trim(123,456)
X = X + Trim(789,1234)
....
X
Not to mention that it's much more readable... ;)
Cunhambebe
8th May 2007, 17:58
Thanks to all who have responded!
techreactor:
Thats a lot of trims, havent tried it myself but can you open this script successfully in mediaplayer classic ???, that should give you a hint.
-Yes, I can... it works...
Fizick:
Do you use backslash for long line continuation?
-I'm still learning AviSynth. Never heard about backslash... thanks for the input. How does it worlk? :rolleyes:
IanB:
+ is a synonym for alignedsplice which only takes 60 args.
-Well, I know that. Anyway I can count more than 60. Can you? But it's still working :confused:
Leak:
Try
Code:
...
X = X + Trim(123,456)
X = X + Trim(789,1234)
....
X
Not to mention that it's much more readable..
-Thanks so much for your help. That's definitely a more intelligible way to write the whole thing! Thank you very much for the input! :)
Anyway, in fact, that was my fault. I had repeated some sequences (that's a bit tricky editing using VDMod as a visual reference, but I'll get used to), that's why the final result was not working as it should. Besides, Leak's suggestion is much easier for seeing what you're writting.
But there's still one thing that puzzles me: I can count more than 60 arg. How can the script still work? Edit: (note: haven't checked out the whole final result yet).
One more thing: I've noticed that since the video runs at 29,97, cutting, for instance, at frame 43256, will show some more frames in the final result (so you have to get bak and alter the figures for that final frame on the sequence). I was just wondering - Why? (maybe because it's not absolute frames??? - 29,97???)
Thanks.
Cheers,
Mark
Besides, Leak's suggestion is much easier for seeing what you're writting.
Ummm... just for the record - the suggestion was IanB's, I just commented on it...
But there's still one thing that puzzles me: I can count more than 60 arg. How can the script still work? Edit: (note: haven't checked out the whole final result yet).
Because a long line in the form
a + b + c + d + e + ...
is actually transformed into
UnalignedSplice(a,b,c,d,e,...)
and a single function call (like the "UnlignedSplice(...)" above) can't take more than 60 arguments.
x=x+a
x=x+b
x=x+c
...
is transformed into
x=UnalignedSplice(x,a)
x=UnalignedSplice(x,b)
x=UnalignedSplice(x,c)
...
which are just 2 arguments each, so it won't cause problems.
np: Salz - Jon & Teh Knightriders (Stadtmusik (Disc 1))
Fizick
8th May 2007, 19:28
backslash is line continuation mark:
trim(1,10) + \
trim(22,122)
it is same as:
trim(1,10) + trim(22,122)
trim(1,10) +
\ trim(22,122)Or you can put the '\' at the front of lines.
The 60 args is an old limit. I attempted to increase it to 1024 but didn't quite find all the places it haunts, so you may get 1024 args in some places but come unstuck at 61 on others.
Cunhambebe
9th May 2007, 03:25
Thanks to all who took time to respond. It seems you guys are too involved in programming. Definitely too advanced for a simple newbie like me. Thanks to all for the detailed explanations.
Leak:
Ummm... just for the record - the suggestion was IanB's, I just commented on it...
-So thank you very much, IanB! But it doesn't work (Avisynth says: don't knpow what X means lol lol - neither do I - sorry :)
Because a long line in the form
Code:
a + b + c + d + e + ...
is actually transformed into
Code:
UnalignedSplice(a,b,c,d,e,...)
and a single function call (like the "UnlignedSplice(...)" above) can't take more than 60 arguments.
Code:
x=x+a
x=x+b
x=x+c
...
is transformed into
Code:
x=UnalignedSplice(x,a)
x=UnalignedSplice(x,b)
x=UnalignedSplice(x,c)
...
which are just 2 arguments each, so it won't cause problems.
-Thanks for the explanation, but it seems it's not working here.
Fizick and IanB: thanks for the input on backslash "\"
Still don't know why...
X = X + Trim(123,456)
X = X + Trim(789,1234)
...is not working here
Help will be greatly appreciated.
Cheers,
mark
Still don't know why...
X = X + Trim(123,456)
X = X + Trim(789,1234)
...is not working here
Ummm... X is nothing other than a variable that's storing a clip (you've surely read the AviSynth manual, didn't you? ;)), but of course it doesn't store a clip in the very beginning.
So for the first trim you can't do
X=X + Trim(...)
since X doesn't store a clip yet.
Use
X=Trim(...)
for your first line instead, i.e. just store your first trim in X instead of splicing it together with the (then non-existing) previous contents of X.
Cunhambebe
9th May 2007, 12:51
Thank you very much for the input, Leak. In fact, I've read the manual, but as a newbie some detailed information is difficult to understand.
Would you like an example?
Smooth (0.2,0.2) # since I am deinterlacing the video with TomsMoComp I don't have any idea where to write the line on the script. I used once (1,0), it worked - in a certain way...
Another example: I wanted to deblock a source. I used this script;
LoadPlugin("C:\unzipped\dgmpgdec148\DGDecode.dll")
LoadPlugin("c:\avs_filters\TomsMoComp\TomsMoComp_Avisynth\Debug\TomsMoComp.dll")
LoadPlugin("C:\deblock_qed\dctfilter\DctFilter.dll")
LoadPlugin("c:\deblock_qed\mt_masktools.dll")
Import("C:\deblock_qed\Deblock_QED_MT2.avs")
LoadPlugin("C:\avs_filters\ColorMatrix\Release\colormatrix.dll")
MPEG2Source("C:\vacation.d2v", info=3).AudioDub(WavSource("C:\clodo.wav"))
ColorMatrix(hints=true, interlaced=true)
Trim(0,403)+Trim(2395,15174)+Trim(16857,17305)
TomsMoComp(0,5,1)
deblock_qed( quant1=20,quant2=24, aOff1=2,bOff1=4,aOff2=4,bOff2=8 ) # don't know anything about these figures. I've read the manual, tried deblock_qed ( quant1=25 ) and it seemed to work, but I know there must be much, much more here!
Crop(4,0,-4,0)
Lanczos4Resize(640,480)
FadeOut(30)
Please understand this is not a case of being lazy of bad will. I really enjoy learning how to work with AviSynth.
Cheers,
Mark
(PS: if you have any suggestions for deblocking vaues, please let me know :)
Thank you very much for the input, Leak. In fact, I've read the manual, but as a newbie some detailed information is difficult to understand.
Hmmm... maybe I should have added a few more smilies up there... :)
Cunhambebe
9th May 2007, 13:30
LOL - a few more smiles :)
Well, the script works:
X = Trim(424,690)
X = X + Trim(29544,29594)
X = X + Trim(29775,30862)
X = X + Trim(695,2231)
X = X + Trim(2475,2682)
X = X + Trim(3037,3138)
X = X + Trim(3303,4796)
X = X + Trim(4962,5595)
X = X + Trim(5638,5886)
X = X + Trim(6035,6132)
X = X + Trim(6530,6605)
X = X + Trim(6225,6258)
X = X + Trim(6333,6472)
X = X + Trim(6609,6964)
X = X + Trim(7010,7858)
X = X + Trim(7935,7975)
X = X + Trim(8209,8637)
X = X + Trim(8659,8763)
X = X + Trim(9168,9250)
X = X + Trim(10406,10619)
X = X + Trim(10911,11146)
X = X + Trim(11204,11983)
X = X + Trim(12233,12526)
X = X + Trim(12746,13276)
X = X + Trim(13422,15204)
X = X + Trim(15452,15662)
X = X + Trim(15782,16163)
X = X + Trim(16227,16958)
X = X + Trim(16982,17073)
X = X + Trim(17203,17274)
X = X + Trim(17425,18033)
X = X + Trim(18396,19412)
X = X + Trim(19426,19632)
X = X + Trim(19636,19796)
X = X + Trim(19845,20386)
X = X + Trim(20390,21004)
X = X + Trim(21064,21269)
X = X + Trim(21370,21436)
X = X + Trim(21748,21846)
X = X + Trim(26380,26493)
X = X + Trim(22062,22283)
X = X + Trim(22287,22456)
X = X + Trim(22511,22807)
X = X + Trim(22833,23005)
X = X + Trim(23150,23183)
X = X + Trim(23347,24745)
X = X + Trim(24938,25539)
X = X + Trim(25646,26207)
X = X + Trim(26498,26985)
X = X + Trim(26990,28162)
X = X + Trim(43875,44673)
X = X + Trim(55187,55237)
X = X + Trim(52011,52188)
X = X + Trim(57633,57881)
X = X + Trim(55133,55163)
X = X + Trim(59030,59310)
X = X + Trim(55805,57478)
X = X + Trim(57912,59020)
X = X + Trim(59431,59518)
X = X + Trim(28167,28473)
X = X + Trim(59523,59591)
X = X + Trim(28478,28538)
X = X + Trim(29549,29590)
X = X + Trim(28682,29468)
X = X + Trim(30866,42946)
X = X + Trim(43016,43272)
X = X + Trim(44355,44490)
X = X + Trim(52281,52926)
X = X + Trim(53000,53350)
X = X + Trim(53676,53995)
X = X + Trim(54261,54665)
X = X + Trim(54714,54892)
X = X + Trim(59595,59950)
X = X + Trim(60006,60442)
X = X + Trim(60546,63488)
X = X + Trim(63508,63902)
X = X + Trim(63916,65526)
X = X + Trim(65572,67100)
X = X + Trim(79036,80072)
X = X + Trim(67108,69033)
X = X + Trim(69172,70510)
X = X + Trim(70516,74042)
X = X + Trim(74098,78964)
X = X + Trim(80077,80153)
X = X + Trim(44898,52003)
X = X + Trim(43330,43462)
X = X + Trim(54930,54981)
X = X + Trim(90,337)
X = X + Trim(43467,43714)
But the video is non edited, I mean the non linear editing was lost... :confused: Any ideas?
But the video is non edited, I mean the non linear editing was lost... :confused: Any ideas?
Errr...
Each time you run a filter, you can either assign the result to a clip, like this:
someClip=Filter(...)
or you can omit the "someClip=" part and have the result automatically assigned to a variable named "last".
Also, each filter you use is applied to a clip. You can either specify the clip as the first parameter of the filter, like this:
Filter(someClip,...)
or, alternatively, like this:
someClip.Filter(...)
but if you don't specify a filter, it uses the "last" clip instead.
So all your trims in your script above implicitely take frames from the "last" clip and get assigned to the clip called "X".
After them, the result is in "X", but all further statements in your script probably continue to work on the "last" clip.
So the easiest way to fix this would be by assigning the clip stored in "X" to the "last" variable, like this:
X=Trim(...)
X=X+Trim(...)
...
X=X+Trim(...)
X # same as last=X
I guess that's the complete "How do I use variables?" tutorial now... :D
Cunhambebe
11th May 2007, 12:44
I guess that's the complete "How do I use variables?" tutorial now...
-Thank you very much Leak. AS a newbie I guess it would take a long time to find out how to make this work. Thanks to make things easier.
-Since you mention the word tutorial :D , did you remember that script when we joind three clips? Well, now, I'm joining this clip to other 2 ones this way:
LoadPlugin("C:\unzipped\dgmpgdec148\DGDecode.dll")
LoadPlugin("c:\avs_filters\TomsMoComp\TomsMoComp_Avisynth\Debug\TomsMoComp.dll")
LoadPlugin("C:\avs_filters\ColorMatrix\colormatrix.dll")
MPEG2Source("D:\globo_intro.d2v").AudioDub(WavSource("D:\globo_intro.wav"))
ColorMatrix(d2v="globo_intro.d2v")
Sharpen(1,0)
Trim(0,360)
TomsMoComp(1,5,1) # video is TFF
Crop(8,4,-8,-4)
Lanczos4Resize(640,480)
a=FadeOut(100) #please take a look here
ConvertToYv12()
LoadPlugin("c:\avs_filters\TomsMoComp\TomsMoComp_Avisynth\Debug\TomsMoComp.dll")
LoadPlugin("C:\avs_filters\ColorMatrix\colormatrix.dll")
MPEG2Source("D:\savage amazon.d2v").AudioDub(WavSource("D:\savage amazon.wav"))
ColorMatrix(d2v="savage amazon.d2v")
Sharpen(1,0)
Trim(17,23364)
FadeIn(20)
TomsMoComp(1,5,1) # video is TFF
Crop(8,4,-8,-4)
Lanczos4Resize(640,480)
b=FadeOut(60)# please tale a look here...
ConvertToYv12()
return a++b
My simple question is: is there any other way to join the clips or we always have to use the fade out funcion to do it? I mean, can't we put these a= and b= somewhere else?
Thanks so much in advance,
Mark
My simple question is: is there any other way to join the clips or we always have to use the fade out funcion to do it? I mean, can't we put these a= and b= somewhere else?
Like I said above, you can assign the result of any filter to a variable - what made you think it was just FadeOut? :confused:
You could also just put "a=last" anywhere between or after your filters, which assigns the result of the last filter to "a"...
Cunhambebe
11th May 2007, 17:49
Thanks again for your help "and being so patient" :) Now, the tutorial is complete!
Each time you run a filter, you can either assign the result to a clip, like this:
Code:
someClip=Filter(...)
or you can omit the "someClip=" part and have the result automatically assigned to a variable named "last".
Also, each filter you use is applied to a clip. You can either specify the clip as the first parameter of the filter, like this:
Code:
Filter(someClip,...)
or, alternatively, like this:
Code:
someClip.Filter(...)
-I understand. It's just that sometimes it's dificult to understand some statements when related to AviSynth. That was just a newbie's question :)
-I trully hope this topic can help other people who wanna start learning AviSynth.
Thanks again,
Mark
Cunhambebe
7th June 2007, 03:11
There's still one more question:
Suppose I've got 2 videos for the first part of the script but wanna fade out the first video and fade in the second video, keeping the original audio from the first one between both, untill the end of the second one; like this:
fist video fades in...fades out/fades in second one... end
(keeping all the first video soundtrack here, untill the end)
# have you got it guys?
#script starts here
LoadPlugin("C:\unzipped\dgmpgdec148\DGDecode.dll")
LoadPlugin("c:\avs_filters\TomsMoComp\TomsMoComp_Avisynth\Debug\TomsMoComp.dll")
LoadPlugin("C:\avs_filters\ColorMatrix\colormatrix.dll")
MPEG2Source("D:\globo_intro.d2v").AudioDub(WavSource("D:\globo_intro.wav"))
ColorMatrix(d2v="globo_intro.d2v")# i wonder how to wright this part of the script
Sharpen(1,0)
Trim(0,360)
TomsMoComp(1,5,1) # video is TFF
Crop(8,4,-8,-4)
Lanczos4Resize(640,480)
a=FadeOut(100)
ConvertToYv12()
Thanks in advance!
foxyshadis
7th June 2007, 05:03
Full fade out or crossfade?
Full fade:
a=first.trim(600,840).fadeout0(40)
aaudio=first.trim(600,840+50)
b=second.trim(7249,4811).fadein0(50)
baudio=second.trim(7249+50,4811)
AudioDubEx(a+b,aaudio+baudio)
crossfade:
a=first.trim(600,840)
aaudio=first.trim(600,840+50)
b=second.trim(7249,4811)
baudio=second.trim(7249+50,4811)
AudioDubEx(Dissolve(a,b,50),aaudio+baudio)
May not be exactly correct, I'm tired, but I think that's the idea. You can swap in variables to keep things straight, 'course.
ajp_anton
9th June 2007, 15:37
I once had two versions of a movie, one better quality but very glitchy which I repaired using the other one.
107 trims, no problems. They were all on the same line.
Cunhambebe
13th June 2007, 02:47
Foxyshadis:
First of all, sorry for so many spelling mistakes. Sometimes I get in this forum late at night - and a little tired. :)
Second of all, thanks for taking time to respond (and sorry for the late reply).
I know you must/might have seen any of the episodes of Star Wars. So, we are making a small video compositing for the Sony Vegas Community at Orkut (very useful here in Brazil). Do you remember that intro showing the 20th Century Fox logo in the beginning? It fades out, the music/soundtrack keeps playing and then we see the Lucasfilm logo. That's what we wanna do (of course with the logos for the community and "the king of quatis productions" lol lol. BTW, this is a pic showing a quati (means big nose in the ancient Tupi language). I hope you like it :)
http://img169.imageshack.us/img169/51/quatiwebrx8.jpg (http://imageshack.us)
I haven't tested your part of the script. Hope it works, though :)
Thanks so much for your help. I really appreciate it. Just in time, I'll upload the video for you, showing the logo...
Edit: here's the video (XviD; about 800 KB)
The King of Quatis (http://www.litoralsulvirtual.com.br/king_quatis_final.zip)
Enjoy it :) lol
ajp_anton:
-Thanks for the input.
Cheers,
Mark
Cunhambebe
25th July 2007, 12:51
foxyshadys and other friends;
First of all, sorry for the late reply but, I haven't tested foxyshady's script yet (but I'll do as soon as I finish rendereing the whole video).
My doubt is: what if my audio is AC-3 (as it is in my project)? Is there any way to handle AC-3 files in AviSynth or I have to use the old and good WAV file? If there's no way, no problem. I guess I can drop the final result (vídeo) as a reference in another NLE through VFAPI - for instance -, when I'll sync. and make a definitive soundtrack for the whole thing.
Now, this takes me to another question:
Waht about editing a++b++c etc, keeping the same soundtrack? What would this script look like? :)
Cheers,
Mark
ChiDragon
25th July 2007, 22:36
audio = NicAC3Source("filename.ac3") #part of NicAudio.dll, or you can also use regular AC3Source
#stuff here...
A++B++C
AudioDub(last,audio)
Cunhambebe
26th July 2007, 03:21
Thanks for taking time to respond and thanks for the tip. I'll try your part of the script and foxyshadi's. Let's see what I can find as "NicAC3Source" - since I'm a newbie and have never heard about it.
Cheers,
Mark
Edit: I mean, it is part of mkvaudio, isn't it?
bidmead
27th July 2007, 09:44
There's another way of stacking those Trims that no-one's mentioned so far. It's the method I use, but I've never stacked as many Trims as Cunhambebe, so I'd like to hear if there's a downside.
The script would look something like this
rawmovie #that's the whole original uncut thingie
#we just make the first cut
Trim(0, 27768) ++ Trim(35570, 0) # or whatever
#use the output of the first cut and impose the second cut
Trim(0, 62556) ++ Trim(70558, 0)
#and so on...
The disadvantage is that, eg, the cut between frames 62556 and 70558 in the last Trim line don't relate to the original frame numbers of rawmovie, because the previous cuts have shifted them. You need to be aware of this if you should decide, for example, to go back and convert one of these Trims to a Dissolve (which will fu all the following Trims).*
But it's a very useful way of working if you're using AVsP, making the cuts one at a time, viewing the cut in realtime, deciding there and then whether to convert it into a Dissolve, and then moving on to the next cut.
(*Working backwards through rawmovie might be a way round this (it's too early in the morning for my brain to analyse this properly). Ie if there are n cuts to be made in rawmovie, start with cut n, then cut n-1, cut n-2 and so on. I think this should ensure that frame x in whatever you're going to cut next will be the same as frame x in rawmovie.)
--
Chris
Cunhambebe
29th July 2007, 13:26
Chris, thanks so much for the input. I hope it can be useful to other newbies too. BTW, I've downloaded BeHappy from where the .dll previously mentioned by ChiDragon can be extrated. It was kind of boring finding a link that was still working. Anyway, here it is:
http://www.box.net/shared/nkihizx1dh
Main thread is located here:
http://forum.doom9.org/showthread.php?t=104686
On the other hand, people working with NLEs such as Sony Vegas (it's not freeware) can get the final result and drop it in Vegas (works only for MPEG2 - if it's an XviD video file, VFAPI can be helpful) and there, make the AC-3 soundtrack, if that's the option/case.
Cheers,
Mark
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.