View Full Version : How to edit MPEG2 files in AviSynth
Cunhambebe
29th April 2007, 18:05
I swear I've searched around here and at some other sites on the web, but I could not find an answer for my doubt.
I've got 2 clips redered as MPEG2 and I'd like to deinterlace, trim and fade each one, making only one file as the output (I mean: editing). I know the AviSynth function for editing with arguments, but I can't figure out how to do it this time:
Here's one of the scripts I wrote this morning:
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")) # where to put fadeout here?
ColorMatrix(d2v="globo_intro.d2v")
Trim(0,360) # Trim A - last figure is bigger thant the file, i'll fix it.
FadeOut(68) # it's very good here for the image (not the soundtrack that keeps playng
MPEG2Source("D:\savage amazon.d2v").AudioDub(WavSource("D:\savage amazon.wav"))
LoadPlugin("c:\avs_filters\TomsMoComp\TomsMoComp_Avisynth\Debug\TomsMoComp.dll")
LoadPlugin("C:\avs_filters\ColorMatrix\colormatrix.dll")
ColorMatrix(d2v="savage amazon.d2v")
Trim(387,23364)
TomsMoComp(1,5,1) # video is TFF
Crop(8,4,-8,-4)
Lanczos4Resize(640,480)
FadeOut(60)
MPEG2Source("D:\globo_intro.d2v") + MPEG2Source("D:\savage amazon.d2v")
# How can I deinterlace both and join both clips, includding the audio? thanks
Problems:
a) no audio at all;
b) no deinterlace at all;
c)no effects such as fade either.
Can anyone please help me to write the correct script? Any help will be greatly appreciated. I'll keep searching on the foruns.
Thanks in advance.
~bT~
29th April 2007, 18:13
u shud take a look at the avs cutter in megui.
maybe this will help, i found it on some other site.
http://www.sendspace.com/file/lw40mr
Leak
29th April 2007, 19:59
What you did was
* open the first video, add sound, process it, throw away the result
* open the second video, add sound, process it, throw away the result
* open both videos AGAIN (sans sound) and splice them
which probably wasn't exactly what you had in mind... :)
What you have to do is to assign the final versions of both clips to a variable (in my example below "a" and "b") and add/splice those at the end:
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")
Trim(0,360)
a=FadeOut(68)
MPEG2Source("D:\savage amazon.d2v").AudioDub(WavSource("D:\savage amazon.wav"))
LoadPlugin("c:\avs_filters\TomsMoComp\TomsMoComp_Avisynth\Debug\TomsMoComp.dll")
LoadPlugin("C:\avs_filters\ColorMatrix\colormatrix.dll")
ColorMatrix(d2v="savage amazon.d2v")
Trim(387,23364)
TomsMoComp(1,5,1) # video is TFF
Crop(8,4,-8,-4)
Lanczos4Resize(640,480)
b=FadeOut(60)
return a ++ b
(Okay, the "return" is optional... :D)
Still, might I suggest reading the fine manual that comes with AviSynth? It's hidden behind the "AviSynth documentation" link in your "AviSynth" start menu folder... ;)
np: Hug - Tiny Stars (Heroes)
Cunhambebe
30th April 2007, 02:44
Thanks to all who took time to respond.
Leak, thank you very much, realy! I'll try your script. That was very nice of you to have written that one for me. On the other hand, I can assure you I've already read the manual that comes along with AviSynth during my "little" freetime and I couldn't find an easy answer to my doubt. It seems there may be a thousand of ways to edit in AviSynth and also, that AviSynth's learning curve is a little difficult - but we all know what this poweful application can do!
(Okay, the "return" is optional...)
Well, as a newbie, I didn't get it, but I'll try both ways.
-Please notice that you invert the order of some lines here:
MPEG2Source("D:\savage amazon.d2v").AudioDub(WavSource("D:\savage amazon.wav"))
LoadPlugin("c:\avs_filters\TomsMoComp\TomsMoComp_Avisynth\Debug\TomsMoComp.dll")
LoadPlugin("C:\avs_filters\ColorMatrix\colormatrix.dll")
ColorMatrix(d2v="savage amazon.d2v")
-Shouldn't it be this way??
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")
Two questions, please:
1)Is there an easier way to edit MPEG2 files, such as people do with arguments for AVI files?
2)Is there a way to write a single script for each clip and then "call all of them" on a final script, such as A + B + C etc?
Thanks in advance - merci beaucoup :)
Mark
Edit: The script worked 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")
Trim(0,360)
TomsMoComp(1,5,1) # video is TFF
Crop(8,4,-8,-4)
Lanczos4Resize(640,480)
a=FadeOut(100)
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")
Trim(500,23364)
FadeIn(30)
TomsMoComp(1,5,1) # video is TFF
Crop(8,4,-8,-4)
Lanczos4Resize(640,480)
b=FadeOut(60)
return a++b
Thanks again
Leak
30th April 2007, 10:41
Please notice that you invert the order of some lines here:
Actually, late hours make me dumb... :D
You don't need to load any plugin more than once, so it should have been this - I always put all LoadPlugin statements at the top to keep them out of the way, since it makes understanding the actual filtering easier if it isn't broken up needlessly:
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")
Trim(0,360)
a=FadeOut(68)
MPEG2Source("D:\savage amazon.d2v").AudioDub(WavSource("D:\savage amazon.wav"))
ColorMatrix(d2v="savage amazon.d2v")
Trim(387,23364)
TomsMoComp(1,5,1) # video is TFF
Crop(8,4,-8,-4)
Lanczos4Resize(640,480)
b=FadeOut(60)
return a ++ b
I guess loading a plugin more than once gets ignored, but it doesn't help anything.
np: Pole - Huckepack (2)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.