2007-09-26, 13:41 | Link #42 |
Excessively jovial fellow
Join Date: Dec 2005
Location: ISDB-T
Age: 37
|
Well, the overlay() function DOES have x and y offset parameters, so you could do something like this:
Code:
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 }
__________________
|
2007-09-26, 13:42 | Link #43 |
Join Date: Feb 2006
|
[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: Code:
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 } 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 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. Last edited by Onniguru; 2007-10-30 at 10:57. Reason: one sentance I wrote didn't make sense... |
2007-09-26, 14:06 | Link #44 | |
Join Date: Feb 2006
|
Quote:
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. |
|
2007-09-26, 15:11 | Link #45 | |
makes no files now
Join Date: May 2006
|
Quote:
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? -_^
__________________
|
|
2007-10-30, 05:04 | Link #46 |
Junior Member
Join Date: Jun 2007
|
encode from a pal dvd looks bad
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: Code:
Telecide(order=1,guide=2,hints=true,post=0,blend=false) 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) I get something like this: http://img98.imageshack.us/img98/2954/snapshot1tf1.jpg and whats even worse: http://img136.imageshack.us/img136/6...apshot2vg6.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 |
2007-10-30, 10:20 | Link #47 | ||
Join Date: Feb 2006
|
Quote:
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 Quote:
logo = audiodub(logo, blankclip(last, length=200)) |
||
2007-10-30, 17:11 | Link #48 |
Aegisub dev
Join Date: Sep 2004
Location: Stockholm, Sweden
Age: 39
|
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.")
__________________
|
2007-10-31, 15:55 | Link #49 |
Excessively jovial fellow
Join Date: Dec 2005
Location: ISDB-T
Age: 37
|
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.
__________________
|
2007-10-31, 16:26 | Link #50 |
Junior Member
Join Date: Jun 2007
|
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^^) |
2007-11-01, 01:28 | Link #51 |
Aegisub dev
Join Date: Sep 2004
Location: Stockholm, Sweden
Age: 39
|
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.)
__________________
|
2007-11-14, 23:00 | Link #52 | |
formerly JKaizer
Fansubber
|
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.
Quote:
Is there a solution other than creating 152 blank images, and renaming all 276?
__________________
|
|
2007-11-15, 18:11 | Link #53 |
Excessively jovial fellow
Join Date: Dec 2005
Location: ISDB-T
Age: 37
|
Don't use ApplyRange(), it has all sorts of funky limitations and is really tricky to get right.
Use Trim() and +/++ instead. Like this: Code:
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 Code:
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 } Code:
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)
__________________
|
2007-12-03, 08:35 | Link #54 |
Senior Member
Join Date: Dec 2007
|
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: 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(). Code:
directshowsource("nosound.mkv") vmtoon() Last edited by comatose; 2007-12-03 at 08:50. |
2007-12-03, 09:05 | Link #55 |
makes no files now
Join Date: May 2006
|
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: Code:
FFT3DFilter(sigma=6,plane=3,bw=32,bh=32,bt=3,ow=16,oh=16,interlaced=true)
__________________
Last edited by martino; 2007-12-03 at 09:12. Reason: typo |
2007-12-03, 09:15 | Link #56 |
Senior Member
Join Date: Dec 2007
|
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! |
2007-12-03, 09:50 | Link #57 |
Senior Member
Join Date: Dec 2007
|
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 (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. -_____- Last edited by comatose; 2007-12-03 at 10:36. |
2007-12-03, 10:45 | Link #58 |
makes no files now
Join Date: May 2006
|
Code:
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() 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.)
__________________
|
2007-12-03, 10:50 | Link #59 |
Senior Member
Join Date: Dec 2007
|
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 Last edited by comatose; 2007-12-03 at 11:01. |
2007-12-03, 11:00 | Link #60 |
翻訳家わなびぃ
Fansubber
|
mipsmooth is one of filters widely available. Download it from the regular spot.
|
|
|