View Full Version : Avisynth Help thread
TheFluff
2007-06-03, 13:02
Since several people have asked me about how to do various things with Avisynth over the last few weeks, I think it's time we had a thread like this. Post your favorite tricks, utility functions, smart ways to do common things, etc.
I'll start off with the absolutely most common question I get:
How do I overlay an AFX clip or a picture on top of a video?
As usual with Avisynth, there's more than one way to do it, but one particularly convenient way is to write a custom function to do it. I did this once and Devastator had his own variant (that I'll let him post himself), but both are hidden deep in the AFX questions thread, so I'll post my version here:
function insertsign(clip mainclip, clip overlayclip, int startframe, int "endframe") {
endframe = default(endframe,startframe+overlayclip.framecount ()-1)
endframe = (endframe == 0) ? startframe+overlayclip.framecount()-1 : endframe
endframe = (endframe >= mainclip.framecount()-1) ? mainclip.framecount()-1 : endframe
begin = (startframe == 1) ? mainclip.trim(0,-1) : mainclip.trim(0,startframe-1)
middle = mainclip.trim(startframe,endframe)
end = (endframe == mainclip.framecount()-1) ? blankclip(mainclip,length=0) : mainclip.trim(endframe+1,0)
middleoverlay = Overlay(middle, overlayclip, mask=overlayclip.showalpha())
final = (startframe == 0) ? middleoverlay ++ end : begin ++ middleoverlay ++ end
return final
}
How to use it:
1. Copy-paste the code into an empty text document and rename it to .avsi (not .avs).
2. Put the .avsi in your Avisynth plugins directory.
3. Use the function insertsign(), like so:
The function takes 3 arguments (and one optional one: endframe):
insertsign(clip, overlayclip, startframe [, endframe])
Clip is the video you want to overlay the picture/AFX sign on. In 99% of all cases, this should be "last" (without the quotes).
Overlayclip is the AFX sign/picture you want to overlay. The function expects this to be a RGB32 clip with a transparency mask. See the AFX thread for details on that, or consult the manual for your image editing programs on how to make transparent PNG's.
Startframe is the frame in "clip" where the overlaying should start.
Endframe is the frame in "clip" where the overlay should end; this parameter is optional and if you don't specify it (or set it to 0), it will default to startframe+length of the overlayclip.
Example usage:
avisource("X:/stuff/source.avi")
sign1 = avisource("X:/stuff/afx-sign.avi")
logo = imagesource("X:/stuff/logo.png", pixel_type="RGB32", end=100)
insertsign(last, logo, 0)
insertsign(last, sign1, 563, 900)
Is there a way to apply a filter to only a part of a video?
Yes, that's pretty simple, but if you want to do this seriously you'd be best off with using YATTA for it. Anyway, here's how you do it (exactly like YATTA does it, but manually):
avisource("X:/stuff/example.avi")
function filterchain1(clip c) {
c
# do some filtering here
return last
}
function filterchain2(clip c) {
c
# NASTY EVIL BLUR OR SOMETHING HERE
return last
}
trim(0,500).filterchain1()+trim(501,550).filtercha in2()+trim(551,0).filterchain1()
Is there a way to filter only part of a frame?
Yes, it's possible, but probably not worth it. If you insist on doing it anyway, here's how:
avisource("X:/stuff/example.avi") # let's assume 640x480
top = crop(0, 0, 0, -400) # top 80 lines
middle = crop(0, 80, 0, -100) # middle 300 lines
bottom = crop(0, 380, 0, 0) # bottom 100 lines (I'm probably off by 1 somewhere here, but I can't be assed to correct it)
middle = middle.crazy_evil_filter()
stackvertical(top, middle, bottom)
For more advanced operations you will simply need to split the frame into more parts, and do something like
stackvertical(stackhorizontal(a, b, c), stackhorizontal(d, e, f), stackhorizontal(g, h, i))
but the exact details are left as an exercise to the reader.
How do I insert a logo/picture before the actual video starts?
Simplest way to do it, if the video isn't VFR:
avisource("X:/stuff/episode.avi")
logo = imagesource("X:/stuff/logo.png", end=200).converttoyv12().assumefps(last)
logo = audiodub(logo, blankclip(last, length=200))
logo ++ last
How do I change the speed of a clip?
This one is just for lols, but say you wanted a video to play 50% faster:
avisource("X:/stuff/slow.avi")
assumefps(last.framerate*1.5)
assumesamplerate(int(last.samplerate*1.5))
And that's what I can come up with today. Everyone else feel free to post other contributions or ask questions.
Okay, here's a question. Is it possible to append a single repeating frame onto a video using ImageSource?
Until now, I've been doing it this way.
ImageSource("image.png", end=72, pixel_type="RGB32").ConvertToYV12()and then appending it as an avi in a separate script.
partA=AviSource("encode.avi").AssumeFPS(23.976)
partB=AviSource("image.avi").AssumeFPS(23.976)
fin=partA++partBIs there an easier way to do this?
Is there a way to filter only part of a frame?
Yes, it's possible, but probably not worth it. If you insist on doing it anyway, here's how:
avisource("X:/stuff/example.avi") # let's assume 640x480
top = crop(0, 0, 0, -400) # top 80 lines
middle = crop(0, 80, 0, -100) # middle 300 lines
bottom = crop(0, 380, 0, 0) # bottom 100 lines (I'm probably off by 1 somewhere here, but I can't be assed to correct it)
middle = middle.crazy_evil_filter()
stackvertical(top, middle, bottom)
For more advanced operations you will simply need to split the frame into more parts, and do something like
stackvertical(stackhorizontal(a, b, c), stackhorizontal(d, e, f), stackhorizontal(g, h, i))
but the exact details are left as an exercise to the reader.
Another way of doing this, though I haven't tested it, would be to crop out the part to be filtered (or crop out from a filtered copy) and use the Overlay function to put it back in. This is probably easier for non-simple cases.
You can also load an alpha mask image with ImageReader and use that mask for the Overlay, if you want non-rectangular areas filtered.
How do I insert a logo/picture before the actual video starts?
Simplest way to do it, if the video isn't VFR:
avisource("X:/stuff/episode.avi")
logo = imagesource("X:/stuff/logo.png", end=200).converttoyv12().assumefps(last)
logo = audiodub(logo, blankclip(last, length=200)
logo ++ last
I think this can be simplified:
avisource("X:/stuff/episode.avi")
logo = imagesource("X:/stuff/logo.png", end=200).converttoyv12().assumefps(last)
logo + last
Exploiting that AlignedSplice (single +) will insert silence as needed.
As for Starks's question, there shouldn't be anything preventing you from just:
partA=AviSource("encode.avi").AssumeFPS(23.976)
partB=ImageSource("image.png", end=72, pixel_type="RGB32", fps=23.976).ConvertToYV12()
fin=partA++partB
I think this can be simplified:
avisource("X:/stuff/episode.avi")
logo = imagesource("X:/stuff/logo.png", end=200).converttoyv12().assumefps(last)
logo + lastYou can also do:
avisource("X:/stuff/episode.avi")
logo = imagesource("X:/stuff/logo.png").converttoyv12().loop(200).assumefps(last)
logo + lastWhere instead of using "end=200" you use "loop(200)" to do the trick. Same output, just slightly different syntax.
Anyone know any good sites that list (and possibly explain) syntax that AviSynth can read?
You should take a look at the AviSynth Documentation that comes with it, then maybe AviSynth's website (now they have a new MediaWiki which is still being worked on so some stuff is still missing) might have some more stuff, but generally it's the same as in the documentation AFAIK.
(hopefully I understood correctly what you meant there)
You should take a look at the AviSynth Documentation that comes with it, then maybe AviSynth's website (now they have a new MediaWiki which is still being worked on so some stuff is still missing) might have some more stuff, but generally it's the same as in the documentation AFAIK.
(hopefully I understood correctly what you meant there)
I guess... <_<
I've been seeing some unfamiliar chains and syntax over the past week or so...
TheFluff
2007-06-03, 17:04
I think this can be simplified:
avisource("X:/stuff/episode.avi")
logo = imagesource("X:/stuff/logo.png", end=200).converttoyv12().assumefps(last)
logo + last
Exploiting that AlignedSplice (single +) will insert silence as needed.
Eh, aligned splice is ++, single + is unaligned. And it doesn't work anyway, because Avisynth doesn't let you splice two clips together where one has audio and the other doesn't, you will get an error message "Splice: one clip has audio and the other doesn't (not allowed)", which is the reason I wrote it like that in the first place. :V
As for Starks's question, there shouldn't be anything preventing you from just:
partA=AviSource("encode.avi").AssumeFPS(23.976)
partB=ImageSource("image.png", end=72, pixel_type="RGB32", fps=23.976).ConvertToYV12()
fin=partA++partB
Actually there IS something that prevents you from doing that, namely the fact that ImageSource's fps argument only takes integer numbers. Which is retarded, but that's the way it is, so you have to do imagesource(...).assumefps(). Otherwise yes, that works.
EDIT: ok, it didn't USE to take floats, but it does now. So yes, it works as advertised.
edogawaconan
2007-06-03, 19:21
my favorite (very simple) script:
a=directshowsource("a.avi")
b=directshowsource("b.wmv",convertfps=true)
c=directshowsource("c.mp4",convertfps=true)
d=directshowsource("d.mkv",convertfps=true)
stackhorizontal(stackvertical(a,b),stackvertical(c ,d))
basically plays 4 video at once. just make sure all the specs are same (or do manual adjustment as needed).
nice and easy way to compare encodes :p
my favorite (very simple) script:
a=directshowsource("a.avi")
b=directshowsource("b.wmv",convertfps=true)
c=directshowsource("c.mp4",convertfps=true)
d=directshowsource("d.mkv",convertfps=true)
stackhorizontal(stackvertical(a,b),stackvertical(c ,d))basically plays 4 video at once. just make sure all the specs are same (or do manual adjustment as needed).
nice and easy way to compare encodes :p
Trippy... I gotta try that now. <_<
nice and easy way to compare encodes :p
Not really if you are using DirectShowSource() since in most cases the frames will not match, might be good enough for basic comparisons, but if you want to be really accurate load avss.dll from Haali's splitter directory and use DSS2() for input. It's frame accurate, but audio input doesn't work with it.
Furthermore you can also do:
a = AviSource("clip1.avi").ConvertToRGB()
b = AviSource("cllip2.avi").ConvertToRGB()
Compare(a,b)And it will show the differences in a more "mathematical" way.
edogawaconan
2007-06-04, 09:18
Not really if you are using DirectShowSource() since in most cases the frames will not match, might be good enough for basic comparisons, but if you want to be really accurate load avss.dll from Haali's splitter directory and use DSS2() for input. It's frame accurate, but audio input doesn't work with it.
I know, but it looks accurate enough for my recent compares (which basically a video I encoded three times then load them at once with that script). Will try DSS2() :)
by the way, is dss2()'s frame accuracy comparable to normal xvid encodes in avi? :)
Furthermore you can also do:
a = AviSource("clip1.avi").ConvertToRGB()
b = AviSource("cllip2.avi").ConvertToRGB()
Compare(a,b)And it will show the differences in a more "mathematical" way.
I've seen enough math in my daily life though :heh: (that is, being having math as major :eyespin: )
I know, but it looks accurate enough for my recent compares (which basically a video I encoded three times then load them at once with that script). Will try DSS2() :)
by the way, is dss2()'s frame accuracy comparable to normal xvid encodes in avi? :)
It should have the same accuracy as when VfW is used, I only tried one sample (mkv and re-encoded to xvid in AVI) and the frames did match wherever I scrolled (IIRC, it's been a while since).
I've seen enough math in my daily life though :heh: (that is, being having math as major :eyespin: )
Ouch... /me puts his hat down :)
What is the difference between AviSource, DirectShowSource, and DSS2?
TheFluff
2007-06-05, 03:24
Avisource uses VfW codecs and the VfW framework only. Think of it like VirtualDub but in Avisynth. As long as the AVI in question doesn't have any particularly funky hacks, it will always have frame-accurate seeking.
Directshowsource uses Directshow codecs and is hence the Avisynth equivalent of Windows Media Player. It's usually NOT frame-accurate, but it does support VFR, kind of; either through converting to CFR (convertfps=true) or by just reading all frames and ignoring timecodes.
DSS2 is Haali's implementation of Directshowsource. It has the advantage of being frame-accurate, but only supports VFR by converting it to CFR; at least that was the case when I tried it last time, it might have changed.
Quarkboy
2007-06-06, 13:53
I might mention that Graft (author of dvd2avi i.e. dgindex) is almost to the beta stages for DGAVCDec, a similar program which allows preindexing and then frame accurate seeking in AVC (i.e. h.264) encoded files, in the exact same manner that dgindex indexes mpeg2 .vob streams.
It's in alpha right now but it works pretty well already. Not only will it improve encoding speed considerably for such sources, but it will make using AVC sources a lot easier to work with in avisynth.
http://forum.doom9.org/showthread.php?t=122598
About the applying filters only to certain parts, there's this dude called "stickyboy" and he has a pretty good thing I use lots of times, 's called "RemapFrames" I think...
Here's how you use it:
ReplaceFramesSimple(Tcomb(mode=2,fthreshl=12, othreshl=19),
\ mappings= "[106 218]
[492 540]
[31815 33226]
[33283 33334]
[33420 33434]
[33479 33558]
[33588 33614]
[33851 33947]")
What percent of encoders in the fansub community use Avisynth to the extent that Fluff, quark, or eek do?
skystrife
2007-06-06, 23:41
Hello all,
I'm just starting to get into the fansubbing scene, mainly doing work on my own in order to get more experienced before actually applying for a job. I'm interested in doing timing and encoding.
Bah, enough about me.
I've got myself a HD RAW, but it's got some flaws that are really quite irritating. Rather than try to describe it using endless gobs of words that make no sense, I'll just show you. This image isn't blown up at all, and hopefully Paint doesn't barf with PNGs as much as it does with JPEGs. >_<
http://skystrife.com/images/weird_edges.png
It's on a(n?) H.264 encode, and it's quite frustrating trying to get rid of. If I aWarpSharp it to death I can get rid of most of the problem, but that in itself causes issues of its own. Would I be best off just applying the heavy aWarpSharp-ing to any areas in the video I see this issue (basically anything that has dark lines that move... -_-)? Have any of you come across this issue before (I'd bet someone has, judging by the sheer amount of experience some of the well-known people here have)?
Quarkboy
2007-06-07, 04:12
Hello all,
I'm just starting to get into the fansubbing scene, mainly doing work on my own in order to get more experienced before actually applying for a job. I'm interested in doing timing and encoding.
Bah, enough about me.
I've got myself a HD RAW, but it's got some flaws that are really quite irritating. Rather than try to describe it using endless gobs of words that make no sense, I'll just show you. This image isn't blown up at all, and hopefully Paint doesn't barf with PNGs as much as it does with JPEGs. >_<
http://skystrife.com/images/weird_edges.png
It's on a(n?) H.264 encode, and it's quite frustrating trying to get rid of. If I aWarpSharp it to death I can get rid of most of the problem, but that in itself causes issues of its own. Would I be best off just applying the heavy aWarpSharp-ing to any areas in the video I see this issue (basically anything that has dark lines that move... -_-)? Have any of you come across this issue before (I'd bet someone has, judging by the sheer amount of experience some of the well-known people here have)?
That's not a problem with the encoding. It's either a problem with the original broadcast source (bad de-interlacing or upsizing) or a problem with the capture from the source itself.
The best thing to do is to find another raw without the issue. If all the raws have the same problem then it's the fault of the broadcaster themselves, and you have 2 choices:
1. Try warpsharping it to death, or some other solution such as tisophate (one of tritical's avisynth filters that's supposed to help jagged lines like that. Personally I never got it to produce satisfactory results).
2. Ignore it and blame the issue on the broadcasting company.
1. is a lot of work and might end up doing more harm then good. 2. is kind of like a cop out, but hey, you can only do so much.
Quarkboy
2007-06-07, 04:16
Oh, one more thing that's possible. It might be the ANIMATORs fault.
From that screen shot, it looks like the bullet is overlayed on some background. I've seen cases in other anime broadcast in HD that you get jagged lines sometimes on very zoomed in objects. This is probably the fault of the animators not rendering their images at a fine enough resolution, and then zooming in on them too much.
It wouldn't be noticeable on old SD resolutions but with HD it gets pretty obvious. Kind of a side-effect of using digital compositing designed for SD resolutions with an HD output.
skystrife
2007-06-07, 14:16
I think it's likely an issue with the capture itself then. Oddly, though, the same raw provider (for who knows why) seems to alternate between DivX 6.5.1 and x264 encodes (funny thing about the x264: it's VFW in MKV, which makes me cry) for the HD and the issue is more apparent in the x264 encode. That might just be because the x264 encode is higher quality in general, but it's worth noting. The issue is kind of present in the DivX 6.5.1 episodes, but it's less clear than in the x264 which leads me to believe that it's likely the capture and that the x264 encode is clear enough that the issue in the capture comes through more than in the DivX version. I might be totally wrong, though. =P
Argh. =P
I'll try tisophote some, but I'm about ready to just encode the jaggies. =P
skystrife
2007-06-07, 14:38
----------
dj_tjerk
2007-06-12, 08:26
It seems you fixed the startframe=0 problem TheFluff.. but today I walked into the rare case of the endframe being the last frame of the clip, then it fucks up too (I think you know why). Maybe you can add another if statement in your script for that :) ..
And ehmm.. shouldn't endframe be surrounded by quotes in the function? So:
function insertsign(clip mainclip, clip overlayclip, int startframe, int "endframe") {
---EDIT
a null clip is an option maybe?
function insertsign(clip mainclip, clip overlayclip, int startframe, int "endframe") {
endframe = default(endframe,startframe+overlayclip.framecount-1)
begin = (startframe == 1) ? mainclip.trim(0,-1) : mainclip.trim(0,startframe-1)
middle = mainclip.trim(startframe,endframe)
end = mainclip.trim(endframe+1,0) # BUG: setting endframe=0 doesn't do what you think it does.
middleoverlay = Overlay(middle, overlayclip, mask=overlayclip.showalpha())
begin = (startframe == 0) ? BlankClip(mainclip, length=0) : begin
end = (endframe == mainclip.framecount-1) ? BlankClip(mainclip, length=0) : end
return begin ++ middleoverlay ++ end
}
Not sure if you got my message on IRC, but the version that you posted dj_tjerk works just fine with fixing the bug when endframe is the last frame of the clip. Works fine under other circumstances too from what I've tested so far. *thumbs up*
EDIT: When endframe is not specified, and it's not the last frame of the mainclip then the last frame of the overlayclip is not overlayed.
Maybe change line 2 to:
endframe = default(endframe,startframe+overlayclip.framecount )But then it defeats the purpose of the last frame fix... I can see a fix using IF conditions, but I think that there could be an easier way of doing it. (/me stabs himself for sucking at scripting)
EDIT2: function insertsign(clip mainclip, clip overlayclip, int startframe, int "endframe") {
number = (mainclip.framecount==overlayclip.framecount) ? -1 : 0
endframe = default(endframe,startframe+overlayclip.framecount +number)
begin = (startframe == 1) ? mainclip.trim(0,-1) : mainclip.trim(0,startframe-1)
middle = mainclip.trim(startframe,endframe)
end = mainclip.trim(endframe+1,0) # BUG: setting endframe=0 doesn't do what you think it does.
middleoverlay = Overlay(middle, overlayclip, mask=overlayclip.showalpha())
begin = (startframe == 0) ? BlankClip(mainclip, length=0) : begin
end = (endframe == mainclip.framecount+number) ? BlankClip(mainclip, length=0) : end
return begin ++ middleoverlay ++ end
}This should address the problem, might need some testing though. And you don't have to point out the obvious, I suck at assigning variable names.
EDIT3: After some testing I got it to work fine. However dj_tjerk says that he can't reproduce the same problem as me... :/
EDIT4: Going through the logic I found out that it's a stupid fix, since it only works when the overlayclip has the same number of frames than the mainclip, which isn't always gonna happen. Which would lead me to this, but it just looks stupid to me, and hasn't been tested AT ALL;
function insertsign(clip mainclip, clip overlayclip, int startframe, int "endframe") {
endframe = default(endframe,startframe+overlayclip.framecount )
number = (mainclip.framecount==endframe) ? -1 : 0
endframe = default(endframe,startframe+overlayclip.framecount +number)
begin = (startframe == 1) ? mainclip.trim(0,-1) : mainclip.trim(0,startframe-1)
middle = mainclip.trim(startframe,endframe)
end = mainclip.trim(endframe+1,0) # BUG: setting endframe=0 doesn't do what you think it does.
middleoverlay = Overlay(middle, overlayclip, mask=overlayclip.showalpha())
begin = (startframe == 0) ? BlankClip(mainclip, length=0) : begin
end = (endframe == mainclip.framecount+number) ? BlankClip(mainclip, length=0) : end
return begin ++ middleoverlay ++ end
}
TheFluff
2007-06-12, 19:12
Excellent, now people are fixing my bugs for me!
(Actually I've been meaning to fix that endframe=0 or endframe=last frame of the clip bug since forever, but never got around to it because I never had to use the function for that. Lazy fluff!)
mad_cracker
2007-07-27, 08:04
Hi ppl, is there any function like trim to cut audio?
Sorry if this is stupid.
Yes, it's called Trim.
I'm not sure how it works if you have a clip with audio but no video, but I believe you'll still work in video frames. Maybe AssumeFPS the audio to whatever is convenient and trim it then.
mad_cracker
2007-07-27, 08:31
DirecShowSource("path\audio.wav").AssumeFPS(23.976)
Trim(start, end)
So this will work?
checkers
2007-07-27, 09:22
It isn't much work to try
edogawaconan
2007-08-14, 00:13
try it? :rolleyes:
They should. (http://avisynth.org/mediawiki/ImageSource)
There is no such thing as animated PNG, so that obviously won't work. If you're thinking about MNG, that's not supported. Neither is SVG.
It just happens than the DevIL library has a homepage: http://openil.sourceforge.net/features.php
Edit: Hmm, another part of the website says they do support MNG files...
mad_cracker
2007-09-06, 07:03
How do I delete every 3 frame of the clip? Because every 3 frame the image gets noisy and it's the same of frame 2.
Tks
That video sounds strange. Either way, it's the SelectEvery function you want to use. I'll rather not give an example as I can never remember how it works myself and it's always trial and error when I do use it :)
TheFluff
2007-09-06, 10:40
How do I delete every 3 frame of the clip? Because every 3 frame the image gets noisy and it's the same of frame 2.
Tks
The Avisynth manual says something to the effect of (I don't have it nearby at the moment so I'm quoting from memory):
SelectEvery(clip, cycle, frame1, ..., frameN)
So in your case:
selectevery(3,0,1)
would take every 3 frames and keep the first (0th) and the second (1st) frames, effectively deleting every third frame. Depending on which frame it is that's noisy you may want to experiment with the latter two parameters (they decide which frames are kept).
mad_cracker
2007-09-06, 13:22
Thanks, I will check if it works and report here later.
Hi~
I've been translating, timing and typesetting in a few fansub groups by now, and I've decided to learn avisynth as an extra too (as a typesetter, that might come in handy). I want to overlay a picture (in this case: the logo of the fansub group I'm translating/typesetting for now) during the opening of the anime when the anime's logo is shown, and thanks to TheFluff's script I've managed to do so! Thank you very much for this easy technique! <3
But now here's the question. The PNG appears, but it's positioned in the upper left corner! Is there any way to center it, or use zoom or something? I'm still pretty new to avisynth, and I've looked in the Wiki and all, but so far no result T_T.
If anyone would be able to help me with this, I'd really appreciate it! Thanks in advance.
The easy way would of course be to make the PNG the same size as the video frame. I think that's the way it's supposed to be used. Otherwise you'd have to hack the function to take an upper-left X/Y coordinate pair too and use those.
It's probably easier to just make the PNG the size of the video frame :)
... D'oh!
I feel so stupid now XD. Thank you!
Argh I really need to start using my head from now on haha
TheFluff
2007-09-26, 13:41
Well, the overlay() function DOES have x and y offset parameters, so you could do something like this:
function insertsign(clip mainclip, clip overlayclip, int startframe, int endframe, int xoffset, int yoffset) {
endframe = default(endframe,startframe+overlayclip.framecount-1)
xoffset = default(xoffset,0)
yoffset = default(yoffset,0)
begin = (startframe == 1) ? mainclip.trim(0,-1) : mainclip.trim(0,startframe-1)
middle = mainclip.trim(startframe,endframe)
end = mainclip.trim(endframe+1,0) # BUG: setting endframe=0 doesn't do what you think it does.
middleoverlay = Overlay(middle, overlayclip, mask=overlayclip.showalpha(), x=xoffset, y=yoffset)
final = (startframe == 0) ? middleoverlay ++ end : begin ++ middleoverlay ++ end
return final
}
But really, as jfs says it's much easier to just make the image the same size as the video frame.
Onniguru
2007-09-26, 13:42
[QUOTE=TheFluff;976257]Since several people have asked me about how to do various things with Avisynth over the last few weeks, I think it's time we had a thread like this. Post your favorite tricks, utility functions, smart ways to do common things, etc.
I'll start off with the absolutely most common question I get:
How do I overlay an AFX clip or a picture on top of a video?
As usual with Avisynth, there's more than one way to do it, but one particularly convenient way is to write a custom function to do it. I did this once and Devastator had his own variant (that I'll let him post himself), but both are hidden deep in the AFX questions thread, so I'll post my version here:
function insertsign(clip mainclip, clip overlayclip, int startframe, int endframe) {
endframe = default(endframe,startframe+overlayclip.framecount-1)
begin = (startframe == 1) ? mainclip.trim(0,-1) : mainclip.trim(0,startframe-1)
middle = mainclip.trim(startframe,endframe)
end = mainclip.trim(endframe+1,0) # BUG: setting endframe=0 doesn't do what you think it does.
middleoverlay = Overlay(middle, overlayclip, mask=overlayclip.showalpha())
final = (startframe == 0) ? middleoverlay ++ end : begin ++ middleoverlay ++ end
return final
}
How I used to do the same thing:
LoadVirtualDubPlugin("C:\Program Files\AviSynth 2.5\Logo.vdf","Logo",0)
ConvertToRGB()
Logo(5, 5, 100, 2, 0, 0, 0, 5, "D:\somelogo.bmp", 0, 25, 75, 0, 0, 0, 0)
ConvertToYV12()
The only weakness being that it needs RGB colorspace to work...hence the conversion to RGB, then BACK to YV12. Edit: Actually, a pretty big weakness, unless the video I'm working with starts in RGB colorspace (such as a d2v). For something like a SHARE source that is already yuv12, this would be changing the colorspace 3 times. Better to do it TheFluff's way.
This allows me to use the wonderful Donald Graft Logo filter(tm), which allows one to easily set the duration, location, transparancy background channel to look for, foreground alpha % (separate from the transparancy portion), and even enbed animation in the logo. Fluff's approach also does duration, location, and alpha percent, but not the animation part :D
That being said, you want to learn TheFluff's way of doing it eventually, if you plan of ever doing more than just logos, such as expanding into doing subtitles and the like.
Onniguru
2007-09-26, 14:06
But now here's the question. The PNG appears, but it's positioned in the upper left corner! Is there any way to center it, or use zoom or something? I'm still pretty new to avisynth, and I've looked in the Wiki and all, but so far no result T_T.
If anyone would be able to help me with this, I'd really appreciate it! Thanks in advance.
The Donald Graft filter allows easy movement of the initial position, as well as the duration, transparancy of the forground color, and more.
I'll break apart my example from two posts back:
Logo(5, 5, 100, 2, 0, 0, 0, 5, "X:\somepath\yourlogo.bmp", 0, 25, 75, 0, 0, 0, 0)
5,5 --> This is the upper left corner where the logo is positioned. If you want it in the center of, say, a 704x396, change this to something like: 300, 180 or some such, depending on how big your logo is
100 --> This is the amount of transparancy of the forground color. I like to use 128 so that it is dim, but still clearly visible.
2 --> I don't remember
0,0,0 --> This is the color that we be treated as through it were transparent. Thus in my logo, any black that appears is treated as transparent, and not as black. This is important, because the Donald Graft filter only takes bmps, which do not have a built in alpha channel.
"X:\somepath\yourlogo.bmp" --> the path to your logo, of course :)
0 --> start frame for fade-ins, I think
25 --> frame that your logo first appears, or if your logo "fades in", the frame that it reaches it's maximum alpha.
75 --> the duration, in frames, that logo stays on the screen.
0,0,0,0 --> used in animating the logo and other special effects. I don't know how to use these last four values.
How I do the same thing:
LoadVirtualDubPlugin("C:\Program Files\AviSynth 2.5\Logo.vdf","Logo",0)
ConvertToRGB()
Logo(5, 5, 100, 2, 0, 0, 0, 5, "D:\somelogo.bmp", 0, 25, 75, 0, 0, 0, 0)
ConvertToYV12()
The only weakness being that it needs RGB colorspace to work...hence the conversion to RGB, then BACK to YV12.
This allows me to use the wonderful Donald Graft Logo filter(tm), which allows one to easily set the duration, location, transparancy background channel to look for, foreground alpha % (separate from the transparancy portion), and even enbed animation in the logo. Fluff's approach also does duration, location, and alpha percent, but not the animation part :D
It sure doesn't seem like a bad way of doing it, but AFAIK colorspace conversions are not lossless (or at least not all, though not sure to which ones this applies though).
From what you described, it seems like that Logo plugin does have certain arguments which overlay doesn't, but then if the person who created the logo knew what he/she was doing then you shouldn't really need them either way...
Just seems like a somewhat longer (more complicated?) way of doing things to me if you don't need "kick-ass-tweak-style" features.
EDIT: You do realize by the way that you can edit your own posts after posting? -_^
Hi there,
I'm not really an experienced encoder so I could need a little bit help here:
I'm trying to get a raw from a PAL DVD source, but it seems that it has badly blended NTSC into PAL. In avisnyth I tried a lot of filters and settings and it seems to deliver the best result with this combi:
Telecide(order=1,guide=2,hints=true,post=0,blend=f alse)
Decimate(cycle=5,mode=2,quality=3)
TDeint(1,1,mtnmode=3)
RemoveGrain(mode=1)
Crop(6,6,-6,-4)
LanczosResize(720,576)
deen("a3d",2,7,9)
vmtoon()
tweak(sat=1.5,bright=-10,cont=1.1)
The problem is the result is still looking bad.
I get something like this:
http://img98.imageshack.us/img98/2954/snapshot1tf1.jpg
and whats even worse:
http://img136.imageshack.us/img136/6382/snapshot2vg6.jpg
and it also seems to judder.
BTW: I wanted to use restore24 but I tried a whole day to get this thing running without success.
I hope someone can help me this drives me mad;)
Greetings
Shy
Onniguru
2007-10-30, 10:20
Is there a way to apply a filter to only a part of a video?
Yes, that's pretty simple, but if you want to do this seriously you'd be best off with using YATTA for it. Anyway, here's how you do it (exactly like YATTA does it, but manually):
avisource("X:/stuff/example.avi")
function filterchain1(clip c) {
c
# do some filtering here
return last
}
function filterchain2(clip c) {
c
# NASTY EVIL BLUR OR SOMETHING HERE
return last
}
trim(0,500).filterchain1()+trim(501,550).filtercha in2()+trim(551,0).filterchain1()
I already know a video where this is a useful technique :)
In Higurashi no naku koro ni kai Episode 1, there is a sequence in the middle, during the "spooky UFO scenes", where the animators deliberately pixilated the video...the blocks are supposed to be there. Any deblocking filters will churn this sequence into a blurry mess. However, any other parts of the video that has blocking in it needs to have the blocking removed...so the video could be divided into three parts using this technique, with the first and third parts having deblocking filters, but the middle section (about 1 minute long) having no deblocking :)
How do I insert a logo/picture before the actual video starts?
Simplest way to do it, if the video isn't VFR:
avisource("X:/stuff/episode.avi")
logo = imagesource("X:/stuff/logo.png", end=200).converttoyv12().assumefps(last)
logo = audiodub(logo, blankclip(last, length=200)
logo ++ last
Your missing closing parantheses here, it seems to me ;)...
logo = audiodub(logo, blankclip(last, length=200))
I'm trying to get a raw from a PAL DVD source
Stop right there.
1. Yes, anime PAL DVD sources are known to be horrible. Don't use them. Ever. Actually, just take the DVD to the closest garbage bin, it's probably not worth any better.
2. What kind of unlicensed anime gets released on PAL DVD? Japan is NTSC land. (Aka. "consider the forum you're posting on before posting.")
TheFluff
2007-10-31, 15:55
PAL DVD source
STOP
HAMMER TIME
If it's not a rather high-budget cinematic movie, when it comes to anime the classic answer to this question is, as jfs mentions:
1. Locate trashcan
2. Place DVD in said trashcan
3. Find NTSC equivalent
PAL anime DVD's are, in the overwhelming majority of the cases (read "every PAL anime DVD ever that isn't a Ghibli movie, and even some of those") horribly shitty fieldblended NTSC->PAL conversions that you can't do anything useful with ever. Never buy PAL anime DVD's ever unless you're 100% sure it's a clean progressive 24fps film -> 25fps PAL conversion.
I had no other choice;)
In japan its out of stock, in the us it was never released and I only have these crappy french DVD's.
There's also a bad bootleg shop that sells it on ebay in ntsc, but I think this might be even worse....
Hm, for now I used just tomsmocomp and kicked everything else for deinterlacing. Its not beautiful but at least it doesn't stutter so much.
And be sure I'll never buy PAL DVD again (even though I live in a Pal Zone^^)
A bit off-topic, don't be afraid of buying PAL DVD's of most cinematic movies, especially non-anime productions, as they'll usually be more sensible transfers. Often (well, I hope) they'll actually be in the higher resolution that PAL offers over NTSC and not just upscales from the 480 line transfer.
(Example: Some Pixar films have been produced/rendered in both 16:9 and 4:3 format with actual changes to the frame compositions etc. to make a good version in both formats. Since they can do that, they can probably also render it in different resolutions and framerates for different TV systems.)
Okay, so I have a set of images that produce a moving logo. The code I have works fine when the images start from the initial frame, but when I try to move the initial frame inwards, it doesn't work.
title = imagesource( "C:\Documents and Settings\Greg\My Documents\VirtualDub\grev-logo\beyblade-logo%04d.png", start = 0001, end = 0123, use_devil=true, pixel_type="rgb32").assumefps(last)
applyrange( 153, 276, "overlay", title, 0, 0, showalpha(title) )If the applyrange is set to 1, 123, it works just fine. Too bad I need it to start at 153.
Is there a solution other than creating 152 blank images, and renaming all 276?
TheFluff
2007-11-15, 18:11
Don't use ApplyRange(), it has all sorts of funky limitations and is really tricky to get right.
Use Trim() and +/++ instead. Like this:
title = imagesource( "C:\Documents and Settings\Greg\My Documents\VirtualDub\grev-logo\beyblade-logo%04d.png", start = 0001, end = 0123, use_devil=true, pixel_type="rgb32").assumefps(last)
# the "last" is actually not needed here, I'm being explicit for clarity's sake
pre = last.trim(0,152)
post = last.trim(277,0)
last.trim(153,276) # overwriting the old last here for convenience
# abusing last as implicit argument here
overlay(title, mask=showalpha())
# put it together (overwriting last again)
pre + last + post
Or you could just be really lazy and steal the AFX sign overlay helper function (see the Avisynth help thread (http://forums.animesuki.com/showthread.php?t=48608) for details):
function insertsign(clip mainclip, clip overlayclip, int startframe, int endframe) {
# make the endframe parameter optional (defaulting to where the overlay clip ends)
endframe = default(endframe,startframe+overlayclip.framecount-1)
# make sure the special case startframe=1 is dealt with correctly
# (needed because trim(0,0) returns the entire clip, which is obviously not what we want)
# note that the first frame of the clip is ZER0, _not_ one!
begin = (startframe == 1) ? mainclip.trim(0,-1) : mainclip.trim(0,startframe-1)
middle = mainclip.trim(startframe,endframe)
end = mainclip.trim(endframe+1,0) # BUG: setting endframe=0 doesn't do what you think it does.
middleoverlay = Overlay(middle, overlayclip, mask=overlayclip.showalpha())
# deal with the special case startframe=0 (in which case we don't have anything before the overlay)
# note that trim(-1,0) does nothing (it returns the same as trim(0,0)...)
final = (startframe == 0) ? middleoverlay ++ end : begin ++ middleoverlay ++ end
return final
}
And thereby reduce your script to:
title = imagesource( "C:\Documents and Settings\Greg\My Documents\VirtualDub\grev-logo\beyblade-logo%04d.png", start = 0001, end = 0123, use_devil=true, pixel_type="rgb32").assumefps(last)
insertsign(last, title, 153, 276)
comatose
2007-12-03, 08:35
Hi!
I'm rather new to anime encoding and avisynth, and I've encountered a weird problem.
I'm trying to use DFMDeRainbow() or Derainbow(), both of which require MSharpen.dll. This error happens with both of them.
The thing is that MSharpen seems to cause errors look distorted (and also seems to be the cause of the error itself).
(Reminder: DeRainbow() has two requirements: MSharpen and mt_masktools)
Say I try to use DeRainbow() with MSharpen not loaded and masktools loaded, I get an error saying that MSharpen is missing (the text is readable, of course).
However, if masktools is not loaded and MSharpen is (or, if both are loaded), I get this unreadable error:
http://img227.imageshack.us/img227/5804/snapshot20071203121012ub0.jpg
This is after a clean AviSynth install, with only MSharpen.dll, mt_masktools.dll and DeRainbow.avsi (and the basic stuff that come with AVS - DirectShowSource.dll, TCPDeliver.dll and colors_rgb.avsi) in the plugins folder.
Please help =\
edit: It's not just MSharpen, it's something else. This happens with just mt_masktools.dll and vmtoon().
directshowsource("nosound.mkv")
vmtoon()
Does the same thing. This really sucks. (before anybody asks, commenting the vmtoon() line makes the video play fine.)
Try loading all of your plugins manually, apart from the ones that are installed automatically by AviSynth in its plugins folder. Some WarpSharp (might not be related to your problem at all though) versions apparently cause problems when being autoloaded, but I never came across any problems where autoloading would screw up (either way I manually load them myself apart from a few scripts) so my help is a bit limited. Also have you tried different versions of AviSynth, and what version are you using right now? (The best way of troubleshooting is of course loading one plugin at a time and testing its function. If it works you move on the next and/or combine them, etc...)
My MSharpen gives me a CRC of BC5448D2 and is version 1.10 (should be beta 2 since it works with YV12). Check it against yours and see if you get the same.
Also if you want to de-rainbow, try something like:
FFT3DFilter(sigma=6,plane=3,bw=32,bh=32,bt=3,ow=16 ,oh=16,interlaced=true)
comatose
2007-12-03, 09:15
Same MSharpen CRC.
Loading mt_masktools manually doesn't do any good.
My version of AviSynth is 2.5.7 ><
Anyway, I've got to go right now, but I'll test older versions of AviSynth later.
I'll also try loading plugins manually later, but it could actually be that the problem is with masktools, because just masktools and vmtoon (with no other plugins/scripts) cause this error.
PS, how do I manually load external scripts, other than ending the filename with .avsi and putting them in the plugin folder?
Thanks for your help!
comatose
2007-12-03, 09:50
Hey martino, which version of masktools do you have? Do you by any chance use Vista?
edit: Regarding masktools: v2.0a7 and a8 makes MPC never get past "Opening...", but it's not frozen. v2.0a6 (and below) gives this readable error (http://img231.imageshack.us/img231/9026/snapshot20071203121012ug7.jpg) (probably because this version of masktools is too old). v2.0a9 and higher versions give the unreadable error.
edit2: WTF... a slightly different "blargh" error appears with just vmtoon() (and the vmtoon script loaded), without any masktools DLL loaded. :(
Could this be happening due to some codec?
...now I get this error no matter what I do or whatever I have loaded. -_____-
LoadPlugin("C:\Program Files\AviSynth 2.5\filters\mt_masktools.dll")
Import("C:\Program Files\AviSynth 2.5\filters\vmToon-v0.74.avsi") #loads avs(i) scripts
LoadPlugin("C:\Program Files\AviSynth 2.5\filters\WarpSharp.dll")
DirectShowSource("C:\downloads\[Conclave-Mendoi]_Mobile_Suit_Gundam_00_-_06_[480x272_H.264_AAC][135FBCAF].mp4")
vmToon()mt_masktools - v2.09a
warpsharp - beta 0.2 (B79393FB)
This works just fine here. And no, I'm not using Vista (*shrugs*). And my \plugins autoload folder contains only DGDecode.dll, DirectShowSource.dll, FFMpegSource.dll, MT.dll, TCPDeliver.dll and TDeint.dll.
What if you try it on a clean install (ie making a double boot for simplicity) with just AviSynth, CCCP and the required filters?
(I think that asking on doom9 might be a better place though.)
comatose
2007-12-03, 10:50
Yeah, I know I should go to doom9, but they have a requirement saying you must be registered for at least 5 days before you can post, and I only have 3 :s
Anyway, I just did a System Restore. The Subtitle() error (I used it just to see what would happen) that was jibberish before is readable now. I fear it might be the Pro Tools LE 7.4 install that failed a few days ago.
Let's pray it works now!
edit: Problem solved. It was all the unnecessary drivers that program installed. Thanks martino :)
mipsmooth is one of filters widely available. Download it from the regular spot (http://avisynth.org/warpenterprises/).
comatose
2007-12-03, 11:02
Yeah, I only thought of googling it *after* posting :\ Thanks.
TheFluff
2007-12-03, 11:21
Remove everything from your autoloading dir, load everything manually instead one thing at a time and see what it is that causes it.
Akatsuker
2007-12-21, 15:51
Hi, I have a problem, hope solve this with you guys.
Sorry for bad english, by the way.
I just did my test line of karaoke on afx, just for knowing how i can do this. It has 271 png files, alpha channel, and I'm trying to use the Fluff's script; And so, i want to overlay the animated line of karaoke.
I put the avsi, with the code in the beginning of this thread, on my plugins' folder.
Here's my final script, take a look:
DirectShowSource("E:\Special.avi")
logo=imagesource("E:\Special\Comp 1%03d.png", Start=001, End = 271, pixel_type="rgb32").assumefps(last)
insertsign(last,logo,110)
And finally, I use the AVSP software, for previewing the results at the end. But it returns an error:
Invalid arguments to function insertsign
Am I doing something wrong? As you can see, i'm just a beginner.
Thanks for you help. ^^
Benjamin Hacks
TheFluff
2007-12-21, 17:10
Try manually specifying the end frame for the insertsign call. That is, insertsign(last,logo,110,381). Also try with just the imagesource() line (without logo= before it) to see that it loads properly.
Akatsuker
2007-12-21, 18:25
Try manually specifying the end frame for the insertsign call. That is, insertsign(last,logo,110,381). Also try with just the imagesource() line (without logo= before it) to see that it loads properly.
It worked when I put the endframe parameter.
Do you know why, being the endframe an optional, it didn't work before?
Thanks a lot, man. If i have any issues, I'll be back.
Benjamin
TheFluff
2007-12-21, 19:05
It's probably a bug caused by me being dumb somewhere in the function. I'll look into it.
Tofusensei
2007-12-22, 14:04
I don't know if this is any help at all, but if you can export it to an AVI it here is a simple script I have used in the past to overlay it:
rawfile = "e:\encode\tsubasa\25\tsubasa25-vble-filtered.avi"
logofile = "e:\encode\tsubasa\tsubasa_logo_LE.avi"
AviSource(rawfile)
insertclip(AviSource(logofile), 1, 1200, 1)
function insertclip(clip clip1, clip clip2, int framebefore, int frameafter, int delay) {
begin = clip1.Trim(0,framebefore)
middle = clip1.Trim(framebefore+1,frameafter-1)
end = clip1.Trim(frameafter,0)
clip2 = clip2.Trim(delay,0)
middleoverlay = Overlay(middle, clip2.ConvertToYV12(), 0, 0, clip2.showalpha()).ConverttoYV12()
return begin ++ middleoverlay ++ end
}
#in case you need to adjust the timing, change the 1, 1200, 1
#1 = framebefore
#1200 = frameafter
#1 = delay
TheFluff
2007-12-22, 16:23
Confirming that I'm dumb and never tested properly (since I'm spoiled and always get endframes supplied by the AFX'er); you need quotes around the argument name to make Avisynth understand that the parameter is optional. By the way dj_tjerk mentioned this back on page 2 but I never got around to updating the op. Can you say "lazy"?
Fixed version:
EDIT: REALLY fixed version, incorporating fixes for all previous complaints:
function insertsign(clip mainclip, clip overlayclip, int startframe, int "endframe") {
# make the endframe parameter optional (defaulting to where the overlay clip ends)
endframe = default(endframe,startframe+overlayclip.framecount ()-1) # is endframe not specified?
endframe = (endframe == 0) ? startframe+overlayclip.framecount()-1 : endframe # is it specified but zero?
# is it specified but >= the main clip's last frame? (may have been caused by the previous line or specified by the user)
# in that case make it equal to the last frame of the main clip (this is important later)
endframe = (endframe >= mainclip.framecount()-1) ? mainclip.framecount()-1 : endframe
# make sure the special case startframe=1 is dealt with correctly
# (needed because trim(0,0) returns the entire clip, which is obviously not what we want)
# note that the first frame of the clip is zero, NOT one!
begin = (startframe == 1) ? mainclip.trim(0,-1) : mainclip.trim(0,startframe-1)
middle = mainclip.trim(startframe,endframe)
# make sure the special case endframe = last frame of the clip is handled properly.
end = (endframe == mainclip.framecount()-1) ? blankclip(mainclip,length=0) : mainclip.trim(endframe+1,0)
middleoverlay = Overlay(middle, overlayclip, mask=overlayclip.showalpha())
# deal with the special case startframe=0 (in which case we don't have anything before the overlay)
# note that trim(-1,0) does nothing (it returns the same as trim(0,0)...)
final = (startframe == 0) ? middleoverlay ++ end : begin ++ middleoverlay ++ end
return final
}
Tested and verified to work for all the following special cases:
- endframe undefined
- endframe defined but 0
- endframe >= last frame of the main clip
- startframe == 0
- startframe == 1
and any combination of them. martino's last version back on page 2 was close but I'm pretty sure it had a few bugs (related to the fact that the last frame of a clip is clip.framecount()-1 since the first frame is number 0, not 1). Updated the OP with this as well so we won't run into the same problem again. Thanks dj_tjerk and martino for pointing out the bugs and suggesting how to fix them!
Also, tofu, you don't need to convert to AVI to use that function (which is much like mine). Any RGB32 clip with an alpha channel will work, as mentioned in the OP. And since the problem was already solved, well...
In any case please for the love of god use [code] tags around avisynth scripts, it looks horribly messy without them.
Only recommendation I have is change the line defining the end segment to this...
end = (endframe == mainclip.framecount()-1) ? blankclip(mainclip,length=0) : mainclip.trim(endframe+1,mainclip.framecount()-1)
Just to keep consistency in the flow of your code :). Even though of course Trim(x,0) and Trim(x,clip.framecount()-1) will be the same in the end.
/me concludes with TheFluff that the code is now fool/hoserproof
comatose
2007-12-25, 15:13
Nevermind ;-;
Hey I don't know if this problem has been addressed, but whenever I try to open an rmvb file using an avs script in either vdub or aegisub, I get an error message and the program closes. I am able to get it to work with older versions of avisynth, like 2.55-, but anything higher will have this error. Any ideas?
Hey I don't know if this problem has been addressed, but whenever I try to open an rmvb file using an avs script in either vdub or aegisub, I get an error message and the program closes. I am able to get it to work with older versions of avisynth, like 2.55-, but anything higher will have this error. Any ideas?
Ther actual error and your method of loading it could be useful ;p
Well the avs looks like this...
"#ASYNTHER RMVB 29.97fps
DirectShowSource("C:\Users\Keshav\Desktop\Subbing\TKAep05.rmvb", fps=29.97, convertfps=true)"
and the error that comes out when played in mpc is...
"CAVIStreamSynth: System Exception - Access Violation at 0x0, reading from 0x0"
Does the filename really start with a space? Or is that an artefact of the forum software breaking "long words"?
Either my bad or the forum software, lol. The avs is fine, in that respect.
LacusClyneX
2008-01-29, 17:36
How do I fix the problem 'avisynth factory: Avisynth error: Directshowsource: the filter graph manager won't talk to me'? Whenever I try to load the audio file this pops up.
It means you don't have any combination of filters that wants to decode the file and send it to the virtual output that is Avisynth.
If you expect ffdshow to decode it, check its output settings, you might need to change something there.
Gentatsu
2008-03-04, 16:04
http://img.photobucket.com/albums/v98/jurai/Aegisub.jpg
Anyway to solve? Only happened recently, Tried reinstalling, Using different version of aegisub, So~ I'm fucked~ Or what?
edogawaconan
2008-03-06, 11:55
http://img.photobucket.com/albums/v98/jurai/Aegisub.jpg
Anyway to solve? Only happened recently, Tried reinstalling, Using different version of aegisub, So~ I'm fucked~ Or what?
more details would be appreciated.
script, type of file
Gentatsu
2008-03-06, 14:53
more details would be appreciated.
script, type of file
Happens with any script, and any file type, Ass, Ssa, Srt. Or perhaps you mean Video? If so, Avi, wmv, Any file, It'll do that, Like, zip, rar, mp3, wav, This counts on audio also
The error can be caused by lots of things, but first of all check your Avisynth plugin directory, the place where it automatically loads any and all plugins placed, you might have something in there that causes it to blow up. It's one of the most common causes for Avisynth errors in Aegisub (and other applications) from my experience.
TheFluff
2008-03-06, 17:58
See if you can load an .avs with only a version() call in it (test in both aegisub and, say, virtualdub). If that fails it's most likely what jfs says. Empty the plugins directory and it should work; then you can start putting things back in one by one and see what makes it blow up.
Gentatsu
2008-03-07, 10:26
See if you can load an .avs with only a version() call in it (test in both aegisub and, say, virtualdub). If that fails it's most likely what jfs says. Empty the plugins directory and it should work; then you can start putting things back in one by one and see what makes it blow up.
Yeah, As I said, Any file, Every file works in anything else, Wmp, Mpc, Vlc, etc. So ~ I'll try what jfs said then >:D~ But~ I tried reinstalling Avisynth, So ~ w/e~ I'll try this first and get back to you =P
Worked E>~ *hugs and sexes jfs*
lindylex
2008-03-13, 03:12
TheFluff, thanks for this great resource. I am trying to place an image before my Quicktime video starts playing and it works fine for an .avi file but does not work well for a Quicktime/.mov video file. Any suggestions would be great. This is the code below.
This is my attempt.
The QuickTime Videos are from my Nikon S2 640 X 480
test_clip=QTInput("C:\Documents and Settings\Administrator\Desktop\gymnastics_vid\DSCN 3076.MOV", color = 2, quality = 100, audio = false, mode = 0, raw = "yuyv", info = 0, dither = 0)
logo = imagesource("C:\Documents and Settings\Administrator\Desktop\video_editing\brand .jpg", end=200).ConvertToYUY2 ().assumefps(test_clip)
logo = audiodub(logo, blankclip(test_clip, length=150))
Return logo + test_clip + test_clip
TheFluff
2008-03-13, 03:49
In what way does it not work well?
In any case the audio for the logo is shorter than the logo itself (the logo is 200 frames but the audio only 150). I'd suggest replacing logo = audiodub(logo, blankclip(test_clip, length=150))
with logo = audiodub(logo, blankclip(test_clip, length=logo.framecount()))
You could also try using ffmpegsource instead of the QT input plugin, that may or may not work better.
lindylex
2008-03-13, 12:11
TheFluff, I have attached a link to the file.
This works exp_this_works.avs but the other does not. I want to get it to work with the Quicktime/.mov video file.
Link to the project.
www.mo-de.net/d/insert_image_video_test.zip
This is my development environment.
Windows 2000
AvsP_v1.3.7 editor
AviSynth 2.5
Mplayer for preview
Thanks
lindylex
2008-03-13, 13:29
[SOLUTION, SOLVED]
test_clip=QTInput("C:\Documents and Settings\Administrator\Desktop\gymnastics_vid\DSCN 3076.MOV", color = 2, quality = 100, audio = true, mode = 0, raw = "RGB", info = 0, dither = 0)
logo = imagesource("C:\Documents and Settings\Administrator\Desktop\video_editing\brand .jpg", end=100).ConvertToYUY2 ().assumefps(test_clip)
logo = audiodub(logo, blankclip(test_clip, length=logo.FrameCount()))
Return test_clip+logo + test_clip
#you can arange this any how you like.
#and even add different like quictime files
What I learned. When you concat video using plus "+" you need to check that they both have video and/or audio, same frame rate fps, color mode, and dimension. I hope I am correct about this.
Thanks again I love this language.
lindylex
2008-03-14, 04:59
How do I stop my audio/sound mp3 file from playing when the video is finished playing? This my code below.
a = QTInput("C:\Documents and Settings\Administrator\Desktop\gymnastics_vid\DSCN 3076.MOV", color = 2, quality = 100, audio = false, mode = 0, raw = "yuyv", info = 0, dither = 0)
b = QtInput("C:\Documents and Settings\Administrator\Desktop\gymnastics_vid\DSCN 3075.MOV", color = 2, quality = 100, audio = false, mode = 0, raw = "yuyv", info = 0, dither = 0)
c = QtInput("C:\Documents and Settings\Administrator\Desktop\gymnastics_vid\DSCN 3074.MOV", color = 2, quality = 100, audio = false, mode = 0, raw = "yuyv", info = 0, dither = 0)
the_audio=DirectShowSource ("C:\music\Club_Break_Beats_Techno\(Armand_Van_Helde n)_-_Witch_Doktor.mp3")
combined= a+b
test_clip=AudioDub(combined, the_audio)
logo = imagesource("C:\Documents and Settings\Administrator\Desktop\video_editing\proje cts\gymnastics\Brand\brand_blank_ver_0.png", end=100).ConvertToYUY2 ().assumefps(test_clip)
logo = audiodub(logo, blankclip(test_clip, length=logo.FrameCount()))
logo + test_clip
My ideas are something to do with KillAudio() at the last frame of the movie. I am not sure how to construct this. Any help would be appreciated, thanks.
trim(0,last.FrameCount()-1)
Shouldn't the audio finish playing once the video does anyway? IIRC AviSynth will not let you to have an audio stream longer than the video after AudioDub... or will it?
lindylex
2008-03-14, 16:57
Yumi, trim(0,last.FrameCount()-1)
Wow I feel stupid. This works like a charm. I can't thanks you enough.
When do they plan to release version 3.0 of this language, I can't wait?
martino,
"Shouldn't the audio finish playing once the video does anyway?"
You would think it would but it does not. It continues playing with the code I used. I am not sure if the encoder is the problem I am using Super @ as the encode. Maybe this might be the problem.
[Question]
When should I use Return? I am so confused when to use this. Sometimes when I use things breaks like Subtitles. Any insight on this would be greatly appreciated.
This is how I originally was going to use it in the script above but it breaks things.
main_movie=logo + test_clip
Return main_movie
Is this not good practice?
TheFluff
2008-03-14, 17:08
Shouldn't the audio finish playing once the video does anyway? IIRC AviSynth will not let you to have an audio stream longer than the video after AudioDub... or will it?
Not only does it let you, there isn't even an option to make AudioDub cut off the stream. However, Virtualdub has a setting "cut off audio stream when video stream ends" (found under video->select range) which is enabled by default so that's why a lot of people think otherwise. Try unticking it and encoding a file with an audio stream significantly longer than the video stream; the video will freeze at the last encoded frame while the audio continues playing to the end.
In case you're not using Vdub to encode, what Yumi suggests will solve the problem in Avisynth.
Edit: beaten.
When do they plan to release version 3.0 of this language, I can't wait?
Probably never unless something miraculous happens. Avisynth 3 has been "almost done" since 2004 or so. There have been no SVN commits and no talk about it on doom9 in the last 7 months or so and I doubt it will ever revive.
When should I use Return? I am so confused when to use this. Sometimes when I use things breaks like Subtitles. Any insight on this would be greatly appreciated.
I've never really seen a reason to use it actually, except in recursive functions. Since both functions and scripts always returns last implicitly, the only thing you need to do is make sure the last line in your script/function assigns the return value to last. It is somewhat useful for clarity reasons though (as seen in the insertsign function).
I am... no encoder. At all. But yeah, I'm trying to do this solo project, and I'm using the following avs script:
DirectShowSource("C:\sysreset\download\raw.mp4", fps=29.97, convertfps=true)
LanczosResize(640,480)
TextSub("C:\Documents and Settings\Owner\My Documents\fb01[main-framefix].ass")
However, when I'm trying to open it in vdub to do a quick QC encode to check everything over, my frames keep getting messed up.
For instance (and the one that's given me the most trouble) is frame 1555/1556. It's a scene change there, and when I set my line to end on 1555, it says that it's ending a frame early; there's a frame between the end of the line and the scene change. However, when I set it to 1556, it says it's bleeding over into the next frame.
And to top it all off, sometimes when I "Reopen Video File" while sitting on one of those frames, it'll appear as though it's actually right, but without changing anything in the avs or the ass file, I Reopen the video and it's off again. I have NO clue what's going on.
Can someone please explain to me what to do? :/
Try using a different video source filter. DirectShowSource isn't very reliable if getting every frame is important to you, for an MP4 file try using FFMpegSource instead. (Google it, it's easy to find.)
There's DSS2 as well. All you'll need to will be load avss.dll from Haali's splitter directory and then just call dss2("C:\sysreset\download\raw.mp4",fps=29.97).
Just note that dss2 converts to a constant framerate and has no audio input.
FFmpegSource seems to have solved it :)
Thank you very much ^_^
lindylex
2008-04-23, 13:37
I am trying to insert a png for 100 frame before the avi's start playing. But I think something might be wrong with colors or something else because I can not concat them.
If you have time could you explain when to use these color methods/parameters
"pixel_type = "RGB24").ConvertToYV12()"
I can not figure these out and have not seen any good documentation.
The video is 640 X 480 Avi using MJPG encoding from a Canon Point and shoot.
a=avisource ("C:\Documents and Settings\Administrator\Desktop\gymnastics_2008_Apr il_23\DCIM\101CANON\MVI_0001.AVI", false )
b=avisource ("C:\Documents and Settings\Administrator\Desktop\gymnastics_2008_Apr il_23\DCIM\101CANON\MVI_0002.AVI", false)
c=avisource ("C:\Documents and Settings\Administrator\Desktop\gymnastics_2008_Apr il_23\DCIM\101CANON\MVI_0003.AVI", false)
the_audio=DirectShowSource ("C:\Documents and Settings\Administrator\Desktop\Firewall.mp3")
combined= a+b+c
test_clip=AudioDub(combined, the_audio)
logo = imagesource("C:\Documents and Settings\Administrator\Desktop\video_editing\proje cts\gymnastics\Brand\brand_blank_ver_0.png", end=100, pixel_type = "RGB24").ConvertToYV12().assumefps(test_clip)
return logo + test_clip
Thanks, Lindylex
Mind telling us what the exact error is that AviSynth gives you? (I'm guessing it is an audio issue, but hard to deduce the exact cause just from that.)
In order to trim two or more clips together they need to have the same framerate, colorspace, width and height, neither have audio or all have audio... and I think that's about it unless I missed something.
If it is an audio issue then this should fix it;
logo = AudioDub(imagesource("C:\Documents and Settings\Administrator\Desktop\video_editing\proje cts\gymnastics\Brand\brand_blank_ver_0.png", end=100, pixel_type = "RGB24").ConvertToYV12().assumefps(test_clip),Blackness(1 00,combined.width,combined.height,"YV12",combined.framerate).KillVideo())Basically you are just creating a "dummy" audio clip from Blackness to satisfy the "both clips need audio" trim requirement. You may need to adjust the audio_rate as required based on what the mp3 has. There is one more way around it, and that'd be putting logo+test_clip into AudioDub together with the_audio, which will make the audio play for the whole clip, and not just for the test_clip part as my previous approach since logo would contain silence.
lindylex
2008-04-23, 14:26
"AviSynth gives you? " No error is being given.
"same framerate, colorspace, width and height, neither have audio or all have audio"
Framerate is being inherited to the logo with ".assumefps(test_clip)"
height and width are all the same for the video and png.
The png is going to be inserted with no audio.
The audio will be added using "AudioDub(combined, the_audio)" only to the concated avi clips.
"neither have audio or all have audio" This might be the problem.
I muted the audio from the avi using "false".
"a=avisource ("C:\Documents and Settings\Administrator\Desktop\gymnastics_2008_Apr il_23\DCIM\101CANON\MVI_0001.AVI", false )"
The logo has no audio, maybe this is the problem. I tried your suggestion martino it does not work.
Lex
Yes, you did mute the audio, but added it back to the merged clips with AudioDub(combined, the_audio). What is the colorspace of the a,b,c clips? You can find out by using Info(), so for example a.Info().
However how come you are not given an error when it doesn't work? If it doesn't work, in the sense that it will not output any video and/or audio, then it will give you an error (or should anyway). Else, what exactly is not working as it should? ("can not concat?")
Also try combined= a+b.AssumeFPS(a.framerate)+c.AssumeFPS(a.framerate ) I guess...
lindylex
2008-04-23, 14:58
Martino it says that color space is rgb32.
"However how come you are not given an error when it doesn't work?" good question.
I am using AVSp and usually I get errors at the bottom. But I am not receiving any.
It should output the video and audio but I get nothing. When I hit F6 or play I am using mplayer to preview it just open then close the terminal. They work separately the logo by it's self the concating the avis video but when I do "return logo + test_clip" this is where it break so something is not right with the color or audio as you pointed out.
Lex
OK, problem found I think. You are making the video from the picture into YV12, therefore you will have to do the same for the video clips that you are joining with ConvertToYV12(), or remove the colorspace conversion for the logo and set the pixel_type for the ImageSource to "RGB32". At the end you will still have to use what I posted earlier on since you cannot join one video which has audio and a second one which does not.
lindylex
2008-04-23, 15:12
Martino guess what I almost got it to work.I change the color space to RGB32 for each and added some audio to the logo.
The problem was the color space and the audio. As a test the following below works. How to I add no sounds to logo? This only work when I add audio tot he logo. I don't want any audio when the logo is being displayed.
a=avisource ("C:\Documents and Settings\Administrator\Desktop\gymnastics_2008_Apr il_23\DCIM\101CANON\MVI_0001.AVI", false )
b=avisource ("C:\Documents and Settings\Administrator\Desktop\gymnastics_2008_Apr il_23\DCIM\101CANON\MVI_0002.AVI", false)
c=avisource ("C:\Documents and Settings\Administrator\Desktop\gymnastics_2008_Apr il_23\DCIM\101CANON\MVI_0003.AVI", false)
the_audio=DirectShowSource ("C:\Documents and Settings\Administrator\Desktop\Firewall.mp3")
combined= a+b+c
test_clip=AudioDub(combined, the_audio)
logo = imagesource("C:\Documents and Settings\Administrator\Desktop\video_editing\proje cts\gymnastics\Brand\brand_blank_ver_0.png", end=300, pixel_type = "RGB32").assumefps(test_clip)
logo = AudioDub(logo, the_audio)
return logo + test_clip
http://forums.animesuki.com/showpost.php?p=1554718&postcount=98
a=avisource ("C:\Documents and Settings\Administrator\Desktop\gymnastics_2008_Apr il_23\DCIM\101CANON\MVI_0001.AVI", false )
b=avisource ("C:\Documents and Settings\Administrator\Desktop\gymnastics_2008_Apr il_23\DCIM\101CANON\MVI_0002.AVI", false)
c=avisource ("C:\Documents and Settings\Administrator\Desktop\gymnastics_2008_Apr il_23\DCIM\101CANON\MVI_0003.AVI", false)
the_audio=DirectShowSource ("C:\Documents and Settings\Administrator\Desktop\Firewall.mp3")
combined= a+b+c
test_clip=AudioDub(combined, the_audio)
logo = AudioDub(imagesource("C:\Documents and Settings\Administrator\Desktop\video_editing\proje cts\gymnastics\Brand\brand_blank_ver_0.png", end=300, pixel_type = "RGB32").assumefps(test_clip),Blackness(300,combined.widt h,combined.height,"RGB32",combined.framerate).KillVideo())
return logo + test_clip
lindylex
2008-04-23, 16:56
[SOLUTION SOLVED]
If you ever try to stitch images with video us .info() to match the proper color and audio specs.
Thanks, Martino for all the help.
a=avisource ("C:\Documents and Settings\Administrator\Desktop\gymnastics_2008_Apr il_23\DCIM\101CANON\MVI_0001.AVI", false )
b=avisource ("C:\Documents and Settings\Administrator\Desktop\gymnastics_2008_Apr il_23\DCIM\101CANON\MVI_0002.AVI", false)
c=avisource ("C:\Documents and Settings\Administrator\Desktop\gymnastics_2008_Apr il_23\DCIM\101CANON\MVI_0003.AVI", false)
the_audio=DirectShowSource ("C:\Documents and Settings\Administrator\Desktop\Firewall.mp3")
combined= a+b+c
test_clip=AudioDub(combined, the_audio)
logo = imagesource("C:\Documents and Settings\Administrator\Desktop\video_editing\proje cts\gymnastics\Brand\brand_blank_ver_0.png", end=100, pixel_type = "RGB32").assumefps(test_clip)
blank_audio=BlankClip(test_clip, audio_rate=44100, length=logo.FrameCount())
logo = AudioDub(logo, blank_audio)
return logo + test_clip
atlantiza
2008-04-26, 19:35
All right, I bet this is a fairly simple problem, but I'm terrible at Avisynth, so here it is.
When I try encoding my video using Avisynth, there seems like the color of the fansubs is drained. Bright colors are pale, and light colors look almost white. Nothing happens to the colors of the original video, however. I'm not completely sure if it's an Avisynth or issue or just general encoding issue. Thanks in advance.
Post the script please... and maybe an example picture too. So the colours are drained when you encode the video through AviSynth and then watch the final encode, but when you watch the original they look fine... if I'm understanding correctly, right?
atlantiza
2008-04-26, 19:43
When I preview with video in Aegisub, it's quite fine.
AviSource("C:\Documents and Settings\Owner\Desktop\WOF_No Audio_Test 1.avi")
LoadPlugin("C:\Program Files\AvisynthEditor\VSFilter.dll")
TextSub("C:\Documents and Settings\Owner\Desktop\wof.ass")
As you can see, it's not much, so I dunno what the problem is really. xD
Edit: Pics for you now. Left is aegisub preview, right is after encode.
http://img168.imageshack.us/img168/9400/aegisubpreviewba8.pnghttp://img293.imageshack.us/img293/9113/videogq7.png
That looks like compression of a lossy encoder (Xvid/H.264?) kicking in to me (unless something actually is wrong, I may not be right). If you don't want it to look like that you will have to increase the bitrate of the video, but it will never look the same as in Aegisub when you were previewing it, unless you will be encoding with a lossless codec.
Well, preview in Aegisub is not always the same as play back with your favourite media player. It may be that your media player is set to use the VMR renderer (MPC or ZP if you are using CCCP) which may be causing those faded colours during playback. But only you'd know that... If it is an AviSynth issue for sure, then the best step would be to remove all filters from your (autoloading) AviSynth plugins directory, since sometimes certain combinations of filters can cause pretty strange things to happen (although I'm not sure whether that is the case too when you are not using any of them) and move them to some other one (next time you'll be using them you will just have to load them manually).......
Dark Shikari
2008-04-26, 20:40
That looks like chroma subsampling (YV12).
Don't use ApplyRange(), it has all sorts of funky limitations and is really tricky to get right.
Use Trim() and +/++ instead. Like this:
title = imagesource( "C:\Documents and Settings\Greg\My Documents\VirtualDub\grev-logo\beyblade-logo%04d.png", start = 0001, end = 0123, use_devil=true, pixel_type="rgb32").assumefps(last)
# the "last" is actually not needed here, I'm being explicit for clarity's sake
pre = last.trim(0,152)
post = last.trim(277,0)
last.trim(153,276) # overwriting the old last here for convenience
# abusing last as implicit argument here
overlay(title, mask=showalpha())
# put it together (overwriting last again)
pre + last + post
Or you could just be really lazy and steal the AFX sign overlay helper function (see the Avisynth help thread (http://forums.animesuki.com/showthread.php?t=48608) for details):
function insertsign(clip mainclip, clip overlayclip, int startframe, int endframe) {
# make the endframe parameter optional (defaulting to where the overlay clip ends)
endframe = default(endframe,startframe+overlayclip.framecount-1)
# make sure the special case startframe=1 is dealt with correctly
# (needed because trim(0,0) returns the entire clip, which is obviously not what we want)
# note that the first frame of the clip is ZER0, _not_ one!
begin = (startframe == 1) ? mainclip.trim(0,-1) : mainclip.trim(0,startframe-1)
middle = mainclip.trim(startframe,endframe)
end = mainclip.trim(endframe+1,0) # BUG: setting endframe=0 doesn't do what you think it does.
middleoverlay = Overlay(middle, overlayclip, mask=overlayclip.showalpha())
# deal with the special case startframe=0 (in which case we don't have anything before the overlay)
# note that trim(-1,0) does nothing (it returns the same as trim(0,0)...)
final = (startframe == 0) ? middleoverlay ++ end : begin ++ middleoverlay ++ end
return final
}
And thereby reduce your script to:
title = imagesource( "C:\Documents and Settings\Greg\My Documents\VirtualDub\grev-logo\beyblade-logo%04d.png", start = 0001, end = 0123, use_devil=true, pixel_type="rgb32").assumefps(last)
insertsign(last, title, 153, 276)
Hi, I keep getting this error every time I try and open my script in VirtualDub:
Script error: imagesource does not have a named argument "pixel_type"
I'm trying out the code you gave Koroku, by the way.
My script also includes MPEG2source for my D2V file, Crop, LanczosResize, and Telecide & Decimate.
TheFluff
2008-04-29, 07:52
Hi, I keep getting this error every time I try and open my script in VirtualDub:
Script error: imagesource does not have a named argument "pixel_type"
I'm trying out the code you gave Koroku, by the way.
My script also includes MPEG2source for my D2V file, Crop, LanczosResize, and Telecide & Decimate.
What is your Avisynth version?
What is your Avisynth version?
2.5, from the AMVapp and AdvancedAVS Pack.
TheFluff
2008-04-29, 18:11
2.5.what?
(also, if you don't need the alphamask you can skip the pixel_type argument and use converttoColorspaceOfYourChoice() later instead)
Um, I believe it's 2.56beta1.
TheFluff
2008-04-29, 20:33
Um, I believe it's 2.56beta1.
That's your problem then, the pixel_type argument was added in 2.56. Update to 2.56a (the final version) or even better 2.57.
LacusClyneX
2008-04-29, 21:01
I keep getting this error: "Avisynth open failure: AVIsource autodetect: couldn't open file 'C:\ccs\ep57.avi' Error code: 2 (C:\ccs\blah.avs.avs, line 2)" whenever I try to put in the avisynth script in the virtualdub. my verison of avisynth is 2.5.7 does anyone know whats wrong?
Maybe you're using Vista and have trouble due to file endings being removed from filenames?
Your error message seems to indicate that your AVS is already misnamed (blah.avs.avs). If the same might be true for the avi (C:\ccs\ep57.avi.avi), this would explain why your script wouldn't find it, leading to the error you described.
Let vista display all file endings properly, then you can avoid errors like these.
Let vista display all file endings properly, then you can avoid errors like these.
lol Vista is dumb... Even when you have the extensions displayed in Explorer and when you select a filename (click then F2, or click-hold-click on the filename), Vista only selects the filename (select: filename) instead of everything (select: filename.ext) unlike Windows XP and lower. :/
------ Aside from this, people really should use my overlaying script to overlay mainly signs...
http://pichu.org/overlays
(don't worry, no information you input in the forms is sent to the server; I was going to write a PHP script for this, but I figured that since JavaScript is equally as powerful as PHP for this kind of job, I've decided to code it as a static index.html. :))
[[[ AND, I DO wish that AVISynth supports RegEx, so that I don't need to do all this stuff hehe ]]]
This is particularly useful for signs typesetters, who have to do a lot of signs at a time--such as myself. :)
Format:
filename_12345.avi
filename_12345v2.avi
filename_12345-23456.png
filename_12345-23456.avi
12345.avi
12345-23456.png
(note that last frame number is optional for avi)
Both IE and FireFox can do drag-and-drop after some procedures. I think I covered most of the basics here based on my TS work. Although the script allows video splices, I have not really implemented them into index.html. :D
------ Aside from this, people really should use my overlaying script to overlay mainly signs...
Mind telling us why in that case? Something wrong with TheFluff's script that we don't know about?
I don't think I should answer that question, and I'm pretty sure the answer would have been clear when you visit the link (http://pichu.org/overlays). I don't judge other people's work... But do tell me, what's wrong with MY script? :)
The reason I made those scripts is that I do not want to type out so much avisynth codes when overlaying my signs, and that I want a way to overlay a lot of signs in one overlay by having them spliced continuously in one video (which is why I deal with global variables--since avisynth doesn't support object-oriented scripting)... This is really only for me, but then I've decided to share it with fellow typesetters.
The script will cause memory faults in AVISynth 2.55 and under, which is why I suggest to use 2.56 and above. heh It also might take long to parse due to the conditions, but once it's finished parsing, everything will run normally.
PS:
His -
title = imagesource( "C:\Documents and Settings\Greg\My Documents\VirtualDub\grev-logo\beyblade-logo%04d.png", start = 0001, end = 0123, use_devil=true, pixel_type="rgb32").assumefps(last)
insertsign(last, title, 153, 276)
Mine -
imgsign("C:\Documents and Settings\Greg\My Documents\VirtualDub\grev-logo\beyblade-logo%04d.png").sign(153,276)
---
Sorry, another shameless promotion of my work :(
I can see most (or least the most obvious ones) differences myself, it was mostly aimed to help others who may not know from looking at the code/etc... but fine. Either way, you've given a simple explanation which should suffice to most I guess.
But do tell me, what's wrong with MY script? :)
Nothing by just looking at it, apart from the fact that it looks somewhat complicated -- mainly when compared to the other one. Comes down to personal preference (laziness? :D) which one you want to use I suppose.
P.S. You don't need the .assumefps(last) for overlaying IIRC ;)
dragon5152
2008-05-04, 00:28
P.S. You don't need the .assumefps(last) for overlaying IIRC ;)
If the overlay is 23.976 and the source is 29.97 which occurs on VFR sources a lot, it might be needed ;)
TheFluff
2008-05-04, 02:08
Wrong, overlay() doesn't care about timestamps and hence not about framerates, it just pairs up frames from the input clip with frames from the overlay.
Also jesus christ pichus that is a hilariously overcomplicated way to overlay signs.
Also jesus christ pichus that is a hilariously overcomplicated way to overlay signs.
Define: "Complicated"
It can be as simple as:
avisource( "op.avi" )
avisign( "afx_karaoke.avi" ).sign
avisign( "credits.avi" ).sign( 100 )
imgsign( "logo.png" ).sign( 500 , 700 )
then an afx karaoke with credits and logo starting later is overlayed correctly on top of an opening sequence. How much simpler you can get?
fireshark
2008-05-05, 00:40
I think he means your code
Well, instead of being so egotistical over this, why not spend the time to put my link on the first post in the FAQ?
http://pichu.org/overlays
And, I am opened to suggestions anyways. And, trust me... This is one of the simplest scripts I wrote. :)
dj_tjerk
2008-05-05, 12:36
function insertsign(clip mainclip, string filename, int startframe, int "endframe") {
overlayclip = avisource(filename)
endframe = default(endframe,startframe+overlayclip.framecount-1)
begin = (startframe == 1) ? mainclip.trim(0,-1) : mainclip.trim(0,startframe-1)
middle = mainclip.trim(startframe,endframe)
end = mainclip.trim(endframe+1,0)
middleoverlay = Overlay(middle, overlayclip, mask=overlayclip.showalpha())
begin = (startframe == 0) ? BlankClip(mainclip, length=0) : begin
end = (endframe == mainclip.framecount-1) ? BlankClip(mainclip, length=0) : end
return begin ++ middleoverlay ++ end
}
Usage: insertsign("blabla.avi", 400)
One extra line and fluff's script basically does the same. Making one big clip of signs hasnt proven useful for me, as I often need to upload v2's of specific signs (not that matters much.. it's more work for the encoder to remove and add some lines though with one big clip).. and I don't like working in one big composition. I also never use still images, i always make clips in AE, even if the scene is static.. Also, I don't like dragging and dropping, I prefer some weird .jar that i double click on and it generates the .avs script, and maybe even 7z's all the files.
In the end.. who cares.. pichu's script works, fluff's script works, and if I may believe avisynth's mediawiki:
Input for overlay is any colorspace, and colorspaces of different clip doesn't matter! The input clips are internally converted to a general YUV (with no chroma subsampling) format, so it is possible for the filter to output another colorspace than the input. It is also possible to input video in different colorspaces, as they will be converted seamlessly. It is however not recommended to use overlay only for colorspace conversions, as it is both slower and with slightly worse quality.
the colorspace of your overlay clip doesnt even matter..
colorspace only matters when you have to deal with video splices... But, thanks for reminding me this... I just removed colorspace and automatically set colorspaces for the video clips splices over here (http://pichu.org/overlays/Signs_Overlay.avsi). :)
(and the only part I haven't bother checking is the audio portion of the video clips splices, so one will have to convert them manually -- but it's an easy task to convert though in my avisign function... I just never encountered problems with it though)
To splice in a video or part of the video clip in replacement of the video portion -- very much like overlay without the Alpha channel - only faster.
avisign( "sign.avi" ).sign( 100 , mode="splice" )
Sometimes you need to use splices because how AFX transfer blending modes work differently from AVISynth, so overlay will not always work. :)
Also, you can use v1b codec if you want to with a separate RGB and Alpha channel, defined... or jpg with a separate grayscale mask file.
dj_tjerk
2008-05-05, 14:20
In the days when i didnt have much space, i even encoded a separate xvid alpha video lol xD (and the rgb also in xvid). Anyway, I don't see what splices have to do with blending modes in avisynth? I thought it was just your way of making one big clip.
In the days when i didnt have much space, i even encoded a separate xvid alpha video lol xD (and the rgb also in xvid). Anyway, I don't see what splices have to do with blending modes in avisynth? I thought it was just your way of making one big clip.
no it doesn't... but i just set that as a condition... I can even put an option like "Add" so that it adds to the clip (addclip, addbefore, addafter)... but i don't think it's needed for any of the work i did. If i want to do this, I'd just trim/avisource manually.
comatose
2008-05-07, 22:18
I think what pichu means is that sometimes AFX doesn't create clips that Avisynth can properly overlay with transparency, so a complete AFX render is required.
Then, you have to use splice. e.g. trim(before)+afx+trim(after)
mad_cracker
2008-05-09, 05:05
Hi minna. I was wondering if there is a way to overlay videos without re-encoding. I mean, like a video layer that we can switch off and on whenever we want. Just like DVD subs.
Thanks
Nope, there isn't.
Actually I think DirectShow (using Video Media Renderer 9, possibly also 7) allows to build graphs that can do something like that, but there isn't any user friendly way to achieve it.
Dark Shikari
2008-05-10, 03:49
Hi minna. I was wondering if there is a way to overlay videos without re-encoding. I mean, like a video layer that we can switch off and on whenever we want. Just like DVD subs.
ThanksAvisynth will do the trick.
mad_cracker
2008-05-10, 06:45
Can you please suggest some tutorial for that?
Thanks jfs and thanks Dark Shikari.
Overlay()...
I don't think that's quite what they want, they're describing something that works like subtitles do in a DVD. That is, from the player, you can say, show the extra video layer on screen, or turn it off at any given time, so say the end user could watch the whole thing with that video layer on, then go back and re-watch it with it off.
If that is what in fact they want, I don't think it's something you can do in avisynth.
TheFluff
2008-05-10, 12:20
If you feel like being very annoying, I'm pretty sure it can actually be done (with Avisynth, no less).
The process would be something like this:
1) encode a multi-segment MKV file where the first segment contains what you want to overlay and the second segment contains the actual video to overlay on.
2) mux it with ordered editions so anyone with a proper splitter will only see the second segment.
3) tick the "Avisynth" box in ffdshow, input code to load the mkv file you're playing with ffmpegsource (will read the first segment) and do the appropriate overlay()'ing on what's currently actually being played.
4) untick the avisynth box to disable overlaying.
(ps: don't actually try this at home, kids)
edit: obviously, if you don't mind distributing multiple files you can of course provide the overlay as a separate file together with an Avisynth script that does the overlaying; you can play that in a video player directly to get the overlayed version, and the ordinary video file to get the non-overlayed version.
Dark Shikari
2008-05-10, 15:18
I don't think that's quite what they want, they're describing something that works like subtitles do in a DVD. That is, from the player, you can say, show the extra video layer on screen, or turn it off at any given time, so say the end user could watch the whole thing with that video layer on, then go back and re-watch it with it off.
If that is what in fact they want, I don't think it's something you can do in avisynth.If they just need it for personal use, its really easy to do with a simple Avisynth script. Comment out the overlay line to disable the overlay.
MoonLight-
2008-08-30, 20:50
DVD resolution is 480x704, but when watching it appears like 848x480 res
and same goes to mkv-dvdrip..
How do I do that?
Medalist
2008-08-30, 22:06
DVD resolution is 480x704, but when watching it appears like 848x480 res
and same goes to mkv-dvdrip..
How do I do that?
I'm sure hope you mean 704x480
And the actual NTSC scan on this resolution is actually 848x480 or something like that, I'm not a major encoder though so I don't know how to explain it exactly, I'd be quite interested to know specifically myself.
It's the same, just ignore it x.x
TheFluff
2008-08-30, 23:23
DVD resolution is 480x704, but when watching it appears like 848x480 res
and same goes to mkv-dvdrip..
How do I do that?
I'm sure hope you mean 704x480
And the actual NTSC scan on this resolution is actually 848x480 or something like that, I'm not a major encoder though so I don't know how to explain it exactly, I'd be quite interested to know specifically myself.
It's the same, just ignore it x.x
NTSC resolution is 720x480. This is usually cropped to 704x480 for somewhat obscure reasons (http://lipas.uwasa.fi/~f76998/video/conversion/).
Now, a picture with the resolution 704x480 has an aspect ratio of 3:2 (or 1.5:1), which isn't very common anywhere (4:3 and 16:9 are the by far most common aspect ratios for video). However, NTSC does not have square pixels, and the image is not supposed to be displayed at 3:2. As explained in the page previously linked, NTSC has an x:y PAR (Pixel Aspect Ratio) of 10:11 (to be completely exact it's actually 4320:4739 but seriously who cares), or 1:1.1, which means that to properly display a 704x480 NTSC image on a monitor with square pixels (i.e. PAR 1:1; pretty much all computer monitors have square pixels) it needs to be stretched by 10% in the vertical direction to make the aspect ratio correct. That is to say, it's should be displayed at 704x528, which coincidentally happens to be 4:3. How convenient.
Additionally, NTSC images may also be 16:9, in which case they should be stretched horizontally instead, to a resolution of 853x480 (usually rounded down to 852, since most renderers require a mod2 image).
This stretching can either be done at encoding time (i.e. you stretch the image with a resizing filter and encode it at 704x528 or 848x480 (rounded down to 848 for mod16 reasons)) or at playback time (i.e. you encode the image as 704x480 and set a flag either in the video bitstream or in the container that tells the player to display the image at the given resolution). The latter is usually preferable since the original image is 704x480 anyway and upscaling it before encoding wastes space. Also, if you assume that most people watch in fullscreen or at least in a player window bigger than the original resolution, resizing at playback time lets you get away with one resizing of the image, while resizing at encoding time makes the image get resized twice (once at encoding time and once at playback time).
Further reading:
http://www.hometheaterhifi.com/volume_6_4/feature-article-enhanced-widescreen-november-99.html
http://www.widescreen.org/aspect_ratios.shtml
http://en.wikipedia.org/wiki/Aspect_ratio_(image)
http://en.wikipedia.org/wiki/Anamorphic_widescreen
http://lipas.uwasa.fi/~f76998/video/conversion/
tl;dr:
http://uppcon.se/thefluff/randompics/mkvanamorphic.png
comatose
2008-08-31, 03:18
Very informative.
But just one question. Is the video you're muxing something*480?
If so, why not set the aspect ratio to 16/9 instead of setting the display width/height to 852x480? That way, you can achieve perfect 16:9 (I don't know if it happens in practice, but hey...)
TheFluff
2008-08-31, 04:02
But just one question. Is the video you're muxing something*480?
If so, why not set the aspect ratio to 16/9 instead of setting the display width/height to 852x480? That way, you can achieve perfect 16:9 (I don't know if it happens in practice, but hey...)
The renderer will still round to closest mod2 image size. I usually set the display resolution explicitly because then you can at least be sure your softsubs render right (if you only set the AR the player might decide to downscale vertically instead of upscaling horizontally, which can affect subtitle size). It also gives you more freedom to compensate for extra cropping or oddball aspect ratios.
comatose
2008-08-31, 07:22
Meh. Crappy renderers.
Also, I was under the impression that only the width is ever modified. I've never seen a player resize the height, hardware or software.
I guess if you say that then you probably have, though.
TheFluff
2008-08-31, 10:04
Meh. Crappy renderers.
Also, I was under the impression that only the width is ever modified. I've never seen a player resize the height, hardware or software.
MPlayer (or at least some of its renderers) occasionally decides to resize in the vertical direction, but on the other hand it doesn't care about the display resolution (actually most players don't but don't tell anyone about that, it'd ruin my reasons for having an odd habit); 704x528, 640x480 and AR 4:3 all render the same.
comatose
2008-08-31, 16:45
Ugh. Yeah. I've noticed it was used as a ratio and not as a resolution once, but it didn't really bother me so I didn't test it :X
MoonLight-
2008-09-08, 02:38
Thnaks TheFluff and comatose for helping :)
just wandering..
How do you encode .ts file exactly ? ;o
starting with .avs and everything :P
thanks in advance !
Uh, "encode .ts file", do you mean use whatever as input and produce a TS as output, or use a TS as input and produce whatever as output?
Trust me, you don't want to produce transport streams, it's a format designed for heavy fault tolerance in digital broadcast systems, so it doesn't matter if the signal drops out for several seconds at a time. This means it has a huge overhead; if you mux the same elementary streams as TS and as MP4 you will see that the TS file is significantly larger.
If you want to use a TS as a source, what I prefer is using a program such as ProjectX (there's also another one I can't remember the name of) to demux the transport stream into elementary streams which can then be handled by regular tools, eg. parse an M2V file with DGIndex and then source it into Avisynth with DGDecode.
TheFluff
2008-09-08, 05:38
If you want to use a TS as a source, what I prefer is using a program such as ProjectX (there's also another one I can't remember the name of) to demux the transport stream into elementary streams which can then be handled by regular tools, eg. parse an M2V file with DGIndex and then source it into Avisynth with DGDecode.
DGIndex can read transport streams directly these days. Which means encoding a TS is pretty much like encoding a DVD:
1) acquire TS
2) create .d2v with DGIndex, and note coding type (interlaced/progressive) and presence of hybrid material
3) write Avisynth script with suitable field matching/deinterlacing/decimating filters depending on state of source video as detected in 2) (alternative: pull source through YMC and do stuff in YATTA)
4) determine suitable cropping and resizing settings and add to Avisynth script
5) add suitable filtering
6) encode to lossless
7) encode lossless with x264
8) mux to MKV
9) release
Or eac3to (http://forum.doom9.org/showthread.php?t=125966) instead of DGIndex for avc video (and all kinds of very useful HD disc audio conversion/extraction). Or xport and dgavcindex/graphedit, but those are less handy imo.
comatose
2008-09-08, 11:14
DGAVCIndex works great and lets you keep the convenient DGIndex-style workflow :)
Buuuut I guess if you're dealing with Blu-ray you gotta do what you gotta do >_>
TheFluff: YMC?
MoonLight-
2008-09-08, 11:53
using DGIndex to create d2v file is easier for me.
6) encode to lossless
7) encode lossless with x264
I don't get this.. why should I encode to lossless b4 encoding lossless with x264,
why not x264 directly ? :)
if that very necessary, think 250GB will be enough? <_<
Usually you encode to lossless if you intend to do any filtering, as then you only have to run the filters once, not multiple times (like if you were doing 2-pass encode with x264, you'd have to run your filters twice while doing heavy encoding, slowing the process down).
And regarding the lossless format, I would suggest lossless H.264 with no CABAC (--qp 0 --no-cabac) as it compresses very well for a lossless format and also gives the fastest decoding speeds, especially if you have CoreAVC.
TheFluff
2008-09-08, 12:57
TheFluff: YMC?
Yatta Metrics Collector (http://www.ivtc.org)
As for lossless sizes, 250 GB is definitely enough. With ffvhuff at fastest settings (worst compression) 25 minutes of anime at NTSC resolution takes 4-5 GB at most; at 720p you're looking at 12-15 GB for the same length.
MoonLight-
2008-09-09, 00:06
thanks again..
1st stage encoding to lossless:
I use lagarith to create lossless file
and LanczosResize, TDeint, TDecimate and toon with default setting
*everything goes ok till now*
then, 2nd stage encoding with x264
i use DeVeed, levels and MSmooth!
bitrate: 3700
but.. unfortunately I face some issue *block* :\
like this screen.. everything was ok till I add "ConvertToYV12()"
http://xs231.xs.to/xs231/08372/1st_issue734.png
http://xs231.xs.to/xs231/08372/2nd_issue603.png
my .ts source is [justanotherdouche]_Gundam_00_S2_Teaser
+ DeNoise and DeBlock didn't help that much :(
Dark Shikari
2008-09-09, 01:29
gradfun2db() ;)
with low bitrates the blocks will be revived like zombies anyway.
Use gradfun2db() @ postprocessing instead.
I dont think it is blocking. I would say it ist colorbending through over smoothing. So like Dark Shikari sayd use Gradefun() preencoding to get some Grain in the encode, or dont denoise that strong. If u plan to do a xvid encode u have to use some other "Noiser", and encode with more bitrate then the 1pass would sugest to keep it...
Dark Shikari
2008-09-09, 05:15
with low bitrates the blocks will be revived like zombies anyway.Not if you use psy-RD ;)
TheFluff
2008-09-09, 07:34
MSmooth
don't do this
edogawaconan
2008-09-09, 10:37
<snip>
tell the watcher to use gradfun. and pray that their system is powerful enough :D
tell the watcher to use gradfun. and pray that their system is powerful enough :D
Yes tell the crowd who think avi is the same think like divx, to use a postprocesor filter:confused:... Yes gradefun() ist postprocesing Filter, but with enough bitrate some off the grain will be keept in a x264 encode, and its looks nicer then addgrain()....
Dark Shikari
2008-09-09, 12:42
Yes tell the crowd who think avi is the same think like divx, to use a postprocesor filter:confused:... Yes gradefun() ist postprocesing Filter, but with enough bitrate some off the grain will be keept in a x264 encode, and its looks nicer then addgrain()....Gradfun2db() compensates for a lack of precision in the YV12 colorspace... its not really related to any particular video format.
I tested gradefun2db() with some colorbanding heavy source, it was fine for the x264 encode, but xvid never keept enough of the grain, even with 150% of the average bitrate of the 1pass, to compensate the colorbanding.
edogawaconan
2008-09-09, 13:20
Yes tell the crowd who think avi is the same think like divx, to use a postprocesor filter:confused:... Yes gradefun() ist postprocesing Filter, but with enough bitrate some off the grain will be keept in a x264 encode, and its looks nicer then addgrain()....
tell them to right-click that cute red FFv icon on systray and click on gradfun?
*and tell anyone else whom doesn't use windows/ffdshow that they are out of luck :p
MoonLight-
2008-09-09, 13:47
blocks get better atm ^^
I didn't know that 3600 is low bitrate, anyway I switched to 4200..
but.. blocks still existied in darky clips T_T
I think darky animes is the most annoying for encoders, especially when darky clip
and blur comes together imo
With a bitrate of 4200 in x264 ther should be some serious decoding issues and one episdoe with 24 minutes should have a size around 800mb...
TheFluff
2008-09-09, 15:32
With a bitrate of 4200 in x264 ther should be some serious decoding issues
what kind of issues?
what kind of issues?
I dont think i realy have to tell you.
Some thing on the line of heavy slow downs on playback on most systems because of to high cpu usage at the decoding time. You know x264 is not mpeg2 or a lossless codec:p, it has more complex compresion algorithm, thats why files can be mouch smaller with good quality, but need more cpu power to encode and to decode. And the bitrate is the next bigest factor how hard a file is to decode.
(I should really try a to high bitrate encode in x264 myself, i dont know if x264 realy stops if he dont can use the bitrate anymore, like xvid would do. And how hard the surplus informations are to decode. I did a automated 2pass at a bitrate of 1500 with a source that would reach quant16 at 600, and he used all the bitrate so i thought the x264 codec whould use all the bitrate u give him at any time. Is it wrong?)
Dark Shikari
2008-09-09, 18:32
I tested gradefun2db() with some colorbanding heavy source, it was fine for the x264 encode, but xvid never keept enough of the grain, even with 150% of the average bitrate of the 1pass, to compensate the colorbanding.Well of course, Xvid doesn't have the kind of AQ or psy RD that x264 has, which basically makes it impossible to retain the dithering from gradfun2db at any sane settings.
I dont think i realy have to tell you.
Some thing on the line of heavy slow downs on playback on most systems because of to high cpu usage at the decoding time. You know x264 is not mpeg2 or a lossless codec:p, it has more complex compresion algorithmActually, most lossless formats are much slower to decode than H.264. Also, its called H.264, not x264; x264 is just the encoder, not the name of the format.
Actually, most lossless formats are much slower to decode than H.264.
But thats more on the line of the bitrate they need to be lossless and not on the line of compresion algorithm, or?
Dark Shikari
2008-09-10, 04:40
But thats more on the line of the bitrate they need to be lossless and not on the line of compresion algorithm, or?Well yes, the main reason is because they have to compress (and decompress) a whole lot more information. Though, for example, FFV1 uses a very similar entropy coder to H.264.
TheFluff
2008-09-10, 04:59
I dont think i realy have to tell you.
Some thing on the line of heavy slow downs on playback on most systems because of to high cpu usage at the decoding time. You know x264 is not mpeg2 or a lossless codec:p, it has more complex compresion algorithm, thats why files can be mouch smaller with good quality, but need more cpu power to encode and to decode. And the bitrate is the next bigest factor how hard a file is to decode
You make a logical argument but it's actually most likely wrong. You make the mistaken assumption that the bitrate is mostly evenly distributed and that 4mbps is a lot; this is wrong. Even with much lower bitrates (~1800kbps) x264's rate control can happily throw 10-15mbps or more at short (10-30 seconds) sequences (see f.ex. the kurenai op, which peaked at something dumb like 20mbps for a few seconds). It's true that doubling the average bitrate would give it more bits to allocate and in theory raise the bitrate peaks even more, but while this will happen to some extent, most of the extra bits will probably go to raising the average bitrate of the rest of the clip, at least with a sane minimum QP.
(I should really try a to high bitrate encode in x264 myself, i dont know if x264 realy stops if he dont can use the bitrate anymore, like xvid would do. And how hard the surplus informations are to decode. I did a automated 2pass at a bitrate of 1500 with a source that would reach quant16 at 600, and he used all the bitrate so i thought the x264 codec whould use all the bitrate u give him at any time. Is it wrong?)
see --qpmin, set it to 1 to allow essentially infinite bitrates
(actually coding as lossy with qpmin 1 most likely allows a lot higher bitrates than coding as lossless (qp 0) in many cases. funny how that works.)
I not thought that that the "bitrate is mostly evenly distributed"(I did mouch xvid encopding in VfW, so i know how the bitrate distruption can look in a vbr encode). But i did make the failure to think : If i raise the average bitrate, that the "hard to compress scens" would get more bitrate near this factor.
Is ther a way to go sure that i dont get complains from leachers, that thought they can look the h264 720p Denou Coil encode, until the explosions scens start to kick in in episode 5, and bring the first real "bitrate peaks" of this series?
TheFluff
2008-09-10, 06:47
You can use the VBV buffer settings (intended to make sure the encoder doesn't encode streams with bitrate peaks that a DVD player or streaming device are too slow to read) to limit bitrate peaks of an encode.
Dark Shikari
2008-09-10, 11:16
see --qpmin, set it to 1 to allow essentially infinite bitrates
(actually coding as lossy with qpmin 1 most likely allows a lot higher bitrates than coding as lossless (qp 0) in many cases. funny how that works.)QP0 isn't lossless unless you explicitly set --qp 0 or --crf 0.
TheFluff
2008-09-10, 15:00
QP0 isn't lossless unless you explicitly set --qp 0 or --crf 0.
Oh. I had no idea.
OroSaiwa
2008-09-11, 02:44
You can use the VBV buffer settings (intended to make sure the encoder doesn't encode streams with bitrate peaks that a DVD player or streaming device are too slow to read) to limit bitrate peaks of an encode.
Talking about VBV and since Dark Shikari is an x264 developer, I keep having problems of VBV buffer underflow with my encodes, either I specify the VBV Buffer Size and Max Bitrate according to this http://rob.opendot.cl/index.php/useful-stuff/h264-profiles-and-levels/ or leave it automatic.
I started to panic when I saw so many VBV underflows in avinaptic but then I checked another couple of encodes (CGR2 HD of Eclipse) and saw that avinaptic gave the same errors. It might be an avinaptic bug since it's not been updated since November?
Checked on Doom9 and saw this issue is frequent but I can't post there for another day.
Nicholi told me it's not sth to worry too much about if it's underflow. Overflow would be bad.
Anyway this is my line from my megui profile:
program --pass 2 --bitrate 3516 --stats ".stats" --level 5.1 --ref 8 --mixed-refs --no-fast-pskip --bframes 4 --b-pyramid --b-rdo --bime --weightb --subme 7 --trellis 2 --partitions p8x8,b8x8,i4x4,i8x8 --8x8dct --b-bias 4 --me umh --merange 24 --threads 2 --thread-input --progress --no-dct-decimate --no-psnr --no-ssim --output "output" "input"
I'm ripping Code Geass Blu-rays at 1080p, mkv softsub so mostly for PCs.
I keep doing experiments and trying new things to introduce in the Italian fansub scene :heh:
Thnx to TheFluff and Mentar for their help and their patience.
Dark Shikari
2008-09-11, 03:06
Talking about VBV and since Dark Shikari is an x264 developer, I keep having problems of VBV buffer underflow with my encodes, either I specify the VBV Buffer Size and Max Bitrate according to this http://rob.opendot.cl/index.php/useful-stuff/h264-profiles-and-levels/ or leave it automatic.
I started to panic when I saw so many VBV underflows in avinaptic but then I checked another couple of encodes (CGR2 HD of Eclipse) and saw that avinaptic gave the same errors. It might be an avinaptic bug since it's not been updated since November?
Checked on Doom9 and saw this issue is frequent but I can't post there for another day.
Nicholi told me it's not sth to worry too much about if it's underflow. Overflow would be bad.
Anyway this is my line from my megui profile:
I'm ripping Code Geass Blu-rays at 1080p, mkv softsub so mostly for PCs.
I keep doing experiments and trying new things to introduce in the Italian fansub scene :heh:
Thnx to TheFluff and Mentar for their help and their patience.I've been improving VBV a lot lately, so make sure you're using the latest x264.
Are you using 2pass mode? VBV underflows on the first pass don't matter if they're gone on the second.
OroSaiwa
2008-09-11, 03:15
Latest x264 since I update megui with the dev URL too.
Two pass and the underflows are on the second but if there's no problems with PC playback I'm ok with it.
I'll try again tonight with built 967 but don't know how much will it change. It might be my x264 settings.
Dark Shikari
2008-09-11, 03:16
Latest x264 since I update megui with the dev URL too.
Two pass and the underflows are on the second but if there's no problems with PC playback I'm ok with it.If you're doing PC playback only you don't need VBV...
Any chance you can get a set of first and second pass settings that generate the underflow, along with the smallest possible input sample that causes the problem? If I have that, I can debug the issue and (yet again) improve VBV to fix it.
OroSaiwa
2008-09-11, 03:28
Ok, I'll post on the Doom9 thread about it and yeah only PC playback since I'll try the ordered chapters too.
tugatosmk
2008-09-12, 18:47
I have a DVD raw that's so grainy it hurts. So far, and after exhaustive search, the only filter, IMO, has the best perfomance in cleaning the noise is Virtualdub's temporal smoother.
Unfortunately, it's an internal filter, there's no vdf file availabe in virtualdub's plug-in folder. After googling, I found some help about external virtualdub filters' syntax for avisynth.
Is there a way to make avisynth use that filter (or, for that matter, any other internal virtualdub filter)?
Dark Shikari
2008-09-12, 19:45
I have a DVD raw that's so grainy it hurts. So far, and after exhaustive search, the only filter, IMO, has the best perfomance in cleaning the noise is Virtualdub's temporal smoother.Try one of the following:
fft3dgpu (relatively fast for a powerful temporal denoiser)
dfttest (extremely powerful but blurs more than some others, and is slow)
mvdegrain and all variations (temporaldegrain, etc)
KireiMangetsu
2008-09-14, 12:51
i'm an amateur avisynth user, i wanna ask a question
my script is like this
DirectShowSource("video.avi",fps=119.88,convertfps=true)
FDecimate(23.976)
converttoyv12()
deen("a3d")
vd_warpsharp(27,"yv12")
temporalsoften(4,4,8,15,2)
MSharpen(threshold=15)
i'm using xvid and bitrate about 1200
but
http://img246.imageshack.us/img246/2156/adszpy6.jpg (http://imageshack.us)
http://img246.imageshack.us/img246/adszpy6.jpg/1/w333.png (http://g.imageshack.us/img246/adszpy6.jpg/1/)
like this the pixels getting square and creating a bad image (especially on full screen), how can i suppress that?
A picture of the source (and filtered lossless too), and in png may be helpful. Other than that...
1) Why convert the fps to 119.88 and then back down to 23.976?
- Just use fps=23.976 and convertfps=true
2) You might want to try better, newer denoisers, rather than Deen.
Dark Shikari
2008-09-14, 14:41
like this the pixels getting square and creating a bad image (especially on full screen), how can i suppress that?By not using Xvid? :D
KireiMangetsu
2008-09-19, 08:05
thanks for your reply...
encoding with h264 takes a long time nad also i thought "maybe i can create good quality with xvid too" but i was wrong :heh: I guess i only use h264 from now on.
2) You might want to try better, newer denoisers, rather than Deen.
Which one do you prefer? Is vaguedenoiser or FluxsmoothT good?
dragon5152
2008-09-21, 02:52
"maybe i can create good quality with xvid too" but i was wrong
You can create "ok" looking videos with xvid. Yours seems worse then it should be, even with xvid.
edogawaconan
2008-09-21, 04:09
You can create "ok" looking videos with xvid. Yours seems worse then it should be, even with xvid.
sure you can. with high enough bitrate.
MoonLight-
2008-09-22, 01:29
Hi :)
just wandering.. again and again :P
how can I create a creditless of op/ed from dvd source if that possible ?
thanks ^_^ !
It's usually added as special/extra, if any. you can check it from the dvd menu.
Extract it with dvd decrypter, etc and proceed to encoding. There's also guide in megui wiki.
I bet you can play around with filters like delogo. I never touched it myself, but I think it requires careful creation of masks, which requires considerable amount of work, and the outcome just won't still be very good. Using creditless OP/ED included in the DVD (as explained by Nagato) is the way to go.
Which one do you prefer? Is vaguedenoiser or FluxsmoothT good?
VagueDenoiser is actually my personal favourite, but don't let that influence you. You'll just have to figure out yourself which one suits your uses...
Some other to look at; FFt3DFilter, dfttest, RemoveGrain, at_denoise, FluxSmooth, MVTools/MVDegrain, DegrainMedian, TTempSmooth, STMedianFilter and lots of scripts that I wouldn't be able to tell you about since I don't remember using a single one. I'm sure that somebody else will be able to help you on that though.
KireiMangetsu
2008-09-25, 15:51
thanks for all your answers i really appriciate... that works really good...
Now i have another question:D
with ImageWriter filter, can we make the logo move? If possible, how?
I'm not personally sure what ImageWriter is... but motion can be created with Animate().
TheFluff
2008-09-25, 18:36
with ImageWriter filter, can we make the logo move? If possible, how?
the imagewriter() function writes video frames to image files on your harddrive, it does not overlay, animate, or in any way interact with logos
KireiMangetsu
2008-09-26, 06:16
i guess, i couldn't explain it well,
i have an image file (.png) and i want to write into video file, also make it move in the pixels
dj_tjerk
2008-09-26, 07:01
animate it first with after effects.. export as straight rgba.. overlay the exported video..
(afaik there is no way to overlay an image.. and make the overlay move in avisynth)
TheFluff
2008-09-26, 10:03
you can probably use overlay() and animate() the x and y parameters but it's going to be a pain in the butt, I wouldn't recommend it
hi everyone, i have a troble about raw files... Let me explain.
i have a raw file with a resolution of 720*480 from dvd source, but i guess its aspect ratio isn't 16:9 and has a bad image.
i searched about it and and found that
http://forum.doom9.org/showthread.php?p=1111789#post1111789
i suppose the answer i've been looking for is ZoomBox
it's said: "Convert a square pixel source to anamorphic (16/9) DVD"
Width=720
Height=480
ColorBars()
ZoomBox(Width, Height, TargetDAR=16.0/9.0)
but i don't know how to use it, i just used .dll plugins so far:upset:
Don't do it at the encode level - do it at the container level. Modern containers like mkv supports setting the pixel aspect ratio when you mux the video. So encode the video ay 720x480, then use that PAR option when you mux.
I'm not very familiar with mkv muxing, but for mp4 muxing using mp4box, it's like
MP4Box.exe -add Video1.264:fps=23.976:par=32:27 -add Audio1.m4a:lang=jpn Output.mp4
I use the overlay function from the first post in this thread for my kara but its shifted (it starts 20 frames to early - it was vor another version of the OP)
and "insertsign(last, sign1, x, x)" doesnt take negative values. Trim always works for the whole video and if I attach it with dot to the clip or after insertsign.... it does nothing.
I also tried to cut the kara clip with vdubmod and saved it with direct stream copy, but after this the script gives me an error (errorcode: 2) if I try to save and refresh.
How can I solve this?
thanks in advice:)
insertsign(last, sign1.trim(x,y), x, x)
thanks, for the correct syntax - now it works ^^
I'm having a rather odd error. I got given an absolutely horrid raw, full of strange framerates (see Nicholi's second impossible raw in the VFR thread- it's practically the same thing)
I've got to trim part of the audio as well, as the first 300 frames need to go, so I'm using audiodub to load that from the wav I extracted. The problem is that when opening it in whatever program I choose, it returns and avisynth read error. I cleared out my plugins folder to prevent auto loading and it still failed. I even removed the ffmpegsource filter and tried opening it and it gave the read error, did not complain about the missing filter at all.
Here's my script, any help or thoughts are appreciated: http://pastebin.ca/1229240
E~
guest0815
2008-10-17, 07:20
http://pastebin.ca/1229240
Whoa! I didn't know you could use several thousand trims in one script. I don't even get a message when I try to load that, the GUIs shut themselves down right away without any further comment :D
http://img384.imageshack.us/img384/747/81641439hd0.jpg (http://imageshack.us)
http://img384.imageshack.us/img384/81641439hd0.jpg/1/w617.png (http://g.imageshack.us/img384/81641439hd0.jpg/1/)
Just a wild blind guess... could it be AssumeFPS(24000/1001) -> AssumeFPS(24000,1001). Can't check right now since I'm not at home... however how the heck did you get so many trims? That's bound to fail when trying to render it... :/
What? He trims and splices every single frame :twitch: , better reanimate it yourself.
It's decimate or timecodes-collector job.
And are you sure this is in the script?
v = ffmpegsource("raw.mp4")
a = wavsource("audio.wav")
audiodub(v,a)
I'm not sure if it's correct without specifying the file location; never tried that.
It should work; relative paths.
It looks like he/she might have been krayzie enough to use TheFluff's perl script @_@. Which I'm fairly certain wasn't really meant to be for actual use, just something he was toying around with :). As you found AviSynth simply can't load that many commands at once...if you really want to use that script you'd need to break the Trims up into multiple scripts.
However are you sure you should even be using that perl script? What are the timecodes for the source file itself? If it really is fucked like the example I gave, my suggestion...find a better raw. Do not let someone provide a raw for you. Who better than the encoder to choose what they are going to work with, and the quality of the audio/video in the raw?
I did not use TheFluff's script actually. What I did was write a shell script to take each block of timecodes and create a trim function for them to even out the framerate without it going all jumpy like using DirectShowSource+ConvertFPS would have done. It looks like my shell-fu is a bit fail and went and split it up for every single frame, I should probably have checked that more closely. You're probably right about too many functions though. Here's the timecodes file for you: http://pastebin.ca/1230173, the first 297 frames are the animax logo so they have a static rate. I'm trying to find a better raw but its proving difficult, I have no transport stream for it and the only raws I can find are at a much smaller res than what I'm working with. It looks like I will just have to wait for the DVD's.
@martino: I've never had any problem with the various FPS adjusting functions and doing a/b in them, I guess your way works too, but it wouldn't explain the error I got, which was most likely from too many trims.
@nagato: if the avs script is in the same directory as the files, then you can do it without the complete path and just go relative. I have absolutely no idea what timecodes-collector is though, could you explain? I'll probably need it or something else if I can't get a different raw >.<
E~
@nagato: if the avs script is in the same directory as the files, then you can do it without the complete path and just go relative. I have absolutely no idea what timecodes-collector is though, could you explain? I'll probably need it or something else if I can't get a different raw >.<
E~
Sorry for the misleading name. I meant the tool for handling/making vfr vid like Decomb521VFR, dss(convertfps), avi2tc, etc. Seriously, I thought you did it manually :p
I did not use TheFluff's script actually. What I did was write a shell script to take each block of timecodes and create a trim function for them to even out the framerate without it going all jumpy like using DirectShowSource+ConvertFPS would have done. It looks like my shell-fu is a bit fail and went and split it up for every single frame, I should probably have checked that more closely. You're probably right about too many functions though. Ahh that's basically what his perl script did, resulted in far too many Trim's :p. So yeah... this is just another krayzie MP4 file, unless all those sections in the video really are 30fps? The one I had was just a perfect example that jpn cappers that had no clue what IVTC is, it only decimated "full motion" sections so it had tons of 24/30 fps zones. The 20fps ones would round off with an equal number of 30fps frames (1/20 = 0.05s and 1/30 = 0.033s. Add them together and get 0.083s (0.041s * 2), two 24fps frames. They can be ignored for the most part.
Since you are at least knowledgeable in the ways of the shell, you could modify your script slightly in order to make this a bit more workable. Instead of trimming out the odd frames you could instead Trim them together (as it would do in a v2->v1 conversion) and run AssumeFPS(theirfps).ConvertFPS(targetfps). The only problem would occur in the 1 frame sections, which I am not sure if ConvertFPS will properly handle them by themselves. However you could just have your script combine it with 1 frame from the nearest group of its complement framerate to make something else, which is either 24fps or will convert to just fine. Like one 20fps frame with one 30fps frame automatically make two 24fps frames, no work needed. Also one 15fps frame and one 30fps frame make three 30fps frames. That way your shell script would spit something out like
AssumeFPS(23.976)
main = last
main.Trim(0,236).AssumeFPS(29.970).ConvertFPS(23.9 76) + main.Trim(298,300) + main.Trim(301,306).AssumeFPS(29.970).ConvertFPS(23 .976) + main.Trim(307,370) + main.Trim(371,372).AssumeFPS(29.970).ConvertFPS(23 .976) + ...
Hopefully it won't result in too many statements for AviSynth then...but it still might :(. Only other real solutions for getting this to CFR is DSS("blah.mp4",fps=23.976,convertfps=true). Otherwise as I said before, find a better raw :(.
And for every idiot that keeps mentioning DecombVFR...thats for making VFR content. In other words taking CFR, something like DVD input, and getting out VFR (vfrac and a timecodes file). Not going from VFR to CFR.
Yes agree that's for MAKING vfr content.
Thanks for that Nicholi, it was still too many functions for avs to handle though. I ended up trawling PD and after grabbing another 14GB of unity I found a usable raw, nice and cfr. It had nicer picture quality as well which was a plus :D
E~
It's always better to pick a raw from a capper that at least has a semblance of an idea of what they are doing, in my opinion :p. God knows what else an idiot who can't even IVTC will do to his encode.
And of course once you find your new favorite capper, you stick to him like white on rice!
Not if that capper is actually a group of ppl. :P
It actually does >.< I think mUgi on winny was a group, for example.
Not if that capper is actually a group of ppl. :P
I'm all good then, I just finished building the cap server for my translator, he's moving to japan in 2 days \o/
E~
hi there,
how can I crop a clip partially? I mean crop from frame 0 to frame y, and then again crop the rest of the clip from frame y+1 to the end. The reason is the OP is shifted to the right, so I would like to use other settings. I tried:
ApplyRange(0,2519,"Crop",14,8,-8,-6)
ApplyRange(2520,34830,"Crop",8,8,-2,-6)
LanczosResize(640,480)
but it says something like: filtered and unfiltered video frame size must match.
seems logically^^, but how can I do it?
thanks,Kageri
Trim out the two ranges to separate clips, crop the two clips appropriately, resize them to the same dimensions, then splice them back together.
It's probably also faster than using ApplyRange.
TheFluff
2008-10-26, 10:26
Trim out the two ranges to separate clips, crop the two clips appropriately, resize them to the same dimensions, then splice them back together.
It's probably also faster than using ApplyRange.
it's even described in the OP
neothe0ne
2008-10-29, 21:18
How do I open a 1280x720 h264 mp4, supposedly 60fps? Using ffmpegsource (2), VirtualDub gives a memory out of bounds exception and MPC crashes without opening the window. (the original mp4 lags/drops frames for me in MPC, and I have an Athlon X2 4800+, 2gb of ram, and a Radeon HD4850 too...)
edit: well it fixed it for me, my computer crashed from memory leak or something and I got it on reboot...
checkers
2008-10-29, 22:02
You can try a more conservative seekmode with ffmpegsource. Otherwise if you know it's a CFR stream, you can simply use directshowsource().
krazywrath
2009-01-01, 02:45
Hello, I am trying to encode this part of an anime, and I am having troubles getting the audio into the video. For .avi videos, I would rip the .wav file out using virtualdub. But since this is .mp4, virtualdub doesn't open it. Can I put the audio process into the avisynth file? Anyway, I've been trying and can't seem to get it. Here's what I have so far:
LoadPlugin("C:\Documents and Settings\xxx\Desktop\VIDEO\things\VSFilter.dll")
DirectShowSource("C:\Documents and Settings\xxx\Desktop\VIDEO\ToA 11 attempt\[Raws-4U] Tales of the Abyss - 11 HD (1280x720 x264).mp4", fps=23.977, audio=true)
Trim(298,417)
#deinterlace
#crop
LanczosResize(704,400) # Lanczos (Sharp)
#denoise
TextSub("C:\Documents and Settings\xxx\Desktop\VIDEO\ToA 11 attempt\ToA11.ass")
EDIT: i am using meGUI (forgot to mention that)
checkers
2009-01-01, 07:01
if you're muxing to mkv, just use the AVI as a direct source input in mkvmerge
krazywrath
2009-01-01, 14:07
I forgot to mention that i am using meGUI. Also, I have an .MP4 file, not a .AVI one. Thanks.
mkvmerge eats mp4 input as well, afaik.
krazywrath
2009-01-01, 15:46
alright, that's to make a .mkv video file, right?
However, I wish to hardsub the video/subs into a .avi file (or .mp4 if .avi is not possible) using meGUI. The code I put in earlier was attempting to do that using avisynth. However, I get NO AUDIO after encoding the video clip using the avisynth script below: (same as before)
LoadPlugin("C:\Documents and Settings\xxx\Desktop\VIDEO\things\VSFilter.dll")
DirectShowSource("C:\Documents and Settings\xxx\Desktop\VIDEO\ToA 11 attempt\[Raws-4U] Tales of the Abyss - 11 HD (1280x720 x264).mp4", fps=23.977, audio=true)
Trim(298,417)
#deinterlace
#crop
LanczosResize(704,400) # Lanczos (Sharp)
#denoise
TextSub("C:\Documents and Settings\xxx\Desktop\VIDEO\ToA 11 attempt\ToA11.ass")
alright, that's to make a .mkv video file, right?
However, I wish to hardsub the video/subs into a .avi file (or .mp4 if .avi is not possible) using meGUI. The code I put in earlier was attempting to do that using avisynth. However, I get NO AUDIO after encoding the video clip using the avisynth script below: (same as before)
LoadPlugin("C:\Documents and Settings\xxx\Desktop\VIDEO\things\VSFilter.dll")
DirectShowSource("C:\Documents and Settings\xxx\Desktop\VIDEO\ToA 11 attempt\[Raws-4U] Tales of the Abyss - 11 HD (1280x720 x264).mp4", fps=23.977, audio=true)
Trim(298,417)
#deinterlace
#crop
LanczosResize(704,400) # Lanczos (Sharp)
#denoise
TextSub("C:\Documents and Settings\xxx\Desktop\VIDEO\ToA 11 attempt\ToA11.ass")
You also have to load that script into the audio portion.
1) Load script into video portion.
2) Choose video container/codec/settings
3) Load same script into audio portion (with audio=true. You might also have to remove the textsub part, but I'm not sure)
4) Choose audio container/codec/settings
5) Click AutoEncode
6) Choose necessary bitrate/file size
7) Queue -> Start
8) Muxed file with both the audio & video
krazywrath
2009-01-01, 17:45
Ohhh, i see!! I did not know that you could load a .avs file into the audio section as well. Thank you!!!
Ichigo81
2009-01-02, 03:30
You could just demultiplex it straight from the mp4.
Krazy, I'm sure I went over this with you about 3 months ago in YUS-staff before I raged. Just demux the audio with YAMB, or load in avs and extract it as PCM.
E~
krazywrath
2009-01-03, 15:05
lol, did we emess? but i guess i didn't understand those complicated words back then..
guest0815
2009-01-11, 04:59
Where did the decimal places go in FFmpegSource2?
# timecode format v2
0.000000
41.708333
83.416667
125.125000
...
# timecode format v2
0
41
83
125
...
edit: resolved \o/
They will return in the next version. (if I remember to fix it)
krazywrath
2009-01-25, 19:00
heyy, i've got another question for you smart lot again xD
I have this .mp4 file which i downloaded off from youtube, but i want to put it into my powerpoint presentation, which i believe only takes .avi files (stupid microsoft..)
In my AVS file, i have:
DirectShowSource("C:\Documents and Settings\admin\Desktop\mar_adentro.mp4", audio=true)
Trim(1517,1934)
Yes it's simple, but firstly, i'm not sure if i REALLY need to change to a mod16 resolution. So i'm not sure which resizer to use if that's the case.
I get an error though whenever i try encoding the video into AVI using meGUI, so what could be the problem?
checkers
2009-01-26, 01:38
I have this .mp4 file which i downloaded off from youtube, but i want to put it into my powerpoint presentation, which i believe only takes .avi files (stupid microsoft..)Use WMV, it works a lot better than any other video format in powerpoint. Grab windows media encoder and use that, which means you can totally avoid avisynth (probably...).
heyy, i've got another question for you smart lot again xD
I have this .mp4 file which i downloaded off from youtube, but i want to put it into my powerpoint presentation, which i believe only takes .avi files (stupid microsoft..)
In my AVS file, i have:
DirectShowSource("C:\Documents and Settings\admin\Desktop\mar_adentro.mp4", audio=true)
Trim(1517,1934)
Yes it's simple, but firstly, i'm not sure if i REALLY need to change to a mod16 resolution. So i'm not sure which resizer to use if that's the case.
I get an error though whenever i try encoding the video into AVI using meGUI, so what could be the problem?
Why are you using meGUI for AVI? Why are you using trim's with DSS, when DSS is not frame accurate? (DSS2 and ffms2 are) And like checkers said, load the vid into WME and use that, powerpoint handles wmv much better than AVI. AVI support depends on the codec as much as the container, so h264 in AVI is going to kill powerpoint for example. It's youtube so all CFR and perfectly fine to do a flat off transcode in WME, and then just trim it in vdub or something.
When it comes to resizing, generally one of the spline or lanczos filters are the best, every encoder has their own preferance as a default (mine is spline36) but read up on the different filters and how the 'numbers' effect sharpness. If you're going for a wmv transcode though, resizing isn't really needed.
E~
krazywrath
2009-01-27, 20:34
EDIT: nvmm, it's working! thanks for both ur help!
Zergrinch
2009-02-07, 18:55
I am encoding using AviSynth with meGUI, using two filters said to work well with anime. I used the preset x264: DVXA-SD-Anime_Toons HQ.
My AVS script looks like this:
DirectShowSource("E:\Cooking Master boy\OP ED\[Cooking.Master.Boy][ED3][DVDRip][XviD.MP3](D001A18B).avi", fps=23.976, audio=true)
toon()
deen()
The problem is, the results I'm getting from encoding does not match the preview I get when I load it into meGUI. It's as if the filters aren't being applied at all.
Let me illustrate:
This is the original video
http://upload.jetsam.org/images/meGUI-01.jpgThis is the preview, which has the effect I wanted to achieve.
http://upload.jetsam.org/images/meGUI-02.jpgThis is the encode, which pretty much looks like the original.
http://upload.jetsam.org/images/meGUI-03.jpg
What should I do?
What should I do?
Use more bitrate.
(Apart from that I personally prefer the original unfiltered look, the filtering oversharpens IMO. And sharpness eats bitrate for breakfast.)
Zergrinch
2009-02-07, 21:03
Unfortunately, yanking up the bitrate by a factor of 10 (to 10,000) did not make a difference.
http://upload.jetsam.org/images//meGUI-04.jpg
Share your x264(?) settings.
Also, it will never look like the preview, unless you use the lossless mode. :)
Zergrinch
2009-02-07, 21:49
This is the DXVA-SD Anime_Toons HQ preset that I was using. It is indeed x264.
program --pass 2 --bitrate 1000 --stats ".stats" --level 3.1 --ref 8 --mixed-refs --bframes 3 --b-adapt 2 --direct auto --deblock 1:1 --subme 7 --trellis 2 --psy-rd 0.6:0 --partitions p8x8,b8x8,i4x4,i8x8 --8x8dct --vbv-bufsize 14000 --vbv-maxrate 17500 --me umh --threads auto --thread-input --aq-mode 0 --progress --no-psnr --no-ssim --output "output" "input"
In the last picture I posted, I set bitrate to 10000.
I tested other filters in AviSynth that flip video horizontally, vertically, and play it in reverse. It works just as previewed. I have no idea why the AviSynth preview does not match the desired effects for the external filters (deen and toon).
Some notes on the settings:
1) You could raise bframes, even to 16 (but something like 7-12 might be a sweet spot)
2) Raising reference frames to 10-12 wouldn't hurt either
3) subme 8 is a good idea too
4) Turning on aq might help, but always check with your own eyes
5) --partitions all
Oh wait... do you really need DXVA compatibility (I get the feeling that doing the above is bound to break it in some way...)? :/
I'm not really sure what the problem could be with the second mentioned thing. I would suggest opening the script in a proper program, like VirtualDub or AvsP, to see whether it actually works. I myself haven't used MeGUI for ages now, so can't tell you whether it could be a bug or is just a matter of "you're doing it wrong". Maybe somebody else will be able to help you more in this matter.
--b-adapt 2 and --bframes 16 isn't really a good idea unless you like waiting forever.
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.