Avisynth Help thread
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: Code:
function insertsign(clip mainclip, clip overlayclip, int startframe, int "endframe") { 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): Code:
insertsign(clip, overlayclip, startframe [, endframe]) 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: Code:
avisource("X:/stuff/source.avi") 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): Code:
avisource("X:/stuff/example.avi") 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: Code:
avisource("X:/stuff/example.avi") # let's assume 640x480 Code:
stackvertical(stackhorizontal(a, b, c), stackhorizontal(d, e, f), stackhorizontal(g, h, i)) How do I insert a logo/picture before the actual video starts? Simplest way to do it, if the video isn't VFR: Code:
avisource("X:/stuff/episode.avi") This one is just for lols, but say you wanted a video to play 50% faster: Code:
avisource("X:/stuff/slow.avi") 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. Code:
ImageSource("image.png", end=72, pixel_type="RGB32").ConvertToYV12() Code:
partA=AviSource("encode.avi").AssumeFPS(23.976) |
Quote:
You can also load an alpha mask image with ImageReader and use that mask for the Overlay, if you want non-rectangular areas filtered. Quote:
Code:
avisource("X:/stuff/episode.avi") As for Starks's question, there shouldn't be anything preventing you from just: Code:
partA=AviSource("encode.avi").AssumeFPS(23.976) |
Quote:
Code:
avisource("X:/stuff/episode.avi") |
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) |
Quote:
I've been seeing some unfamiliar chains and syntax over the past week or so... |
Quote:
Quote:
EDIT: ok, it didn't USE to take floats, but it does now. So yes, it works as advertised. |
my favorite (very simple) script:
Code:
a=directshowsource("a.avi") nice and easy way to compare encodes :p |
Quote:
|
Quote:
Furthermore you can also do: Code:
a = AviSource("clip1.avi").ConvertToRGB() |
Quote:
by the way, is dss2()'s frame accuracy comparable to normal xvid encodes in avi? :) Quote:
|
Quote:
Quote:
|
What is the difference between AviSource, DirectShowSource, and DSS2?
|
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. |
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?
|
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)? |
Quote:
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. |
All times are GMT -5. The time now is 21:54. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.