2007-12-21, 15:51 | Link #63 |
Forever Espada
Fansubber
Join Date: Oct 2007
Location: Conn
|
Am I doing something wrong?
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: Code:
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) 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 |
2007-12-21, 17:10 | Link #64 |
Excessively jovial fellow
Join Date: Dec 2005
Location: ISDB-T
Age: 37
|
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.
__________________
|
2007-12-21, 18:25 | Link #65 | |
Forever Espada
Fansubber
Join Date: Oct 2007
Location: Conn
|
Quote:
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 |
|
2007-12-22, 14:04 | Link #67 |
Senior Member
|
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:
Code:
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 Last edited by Tofusensei; 2007-12-22 at 17:02. |
2007-12-22, 16:23 | Link #68 |
Excessively jovial fellow
Join Date: Dec 2005
Location: ISDB-T
Age: 37
|
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: 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) # 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 } - 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.
__________________
Last edited by TheFluff; 2007-12-22 at 17:08. |
2007-12-22, 19:44 | Link #69 |
King of Hosers
Join Date: Dec 2005
Age: 41
|
Only recommendation I have is change the line defining the end segment to this...
Code:
end = (endframe == mainclip.framecount()-1) ? blankclip(mainclip,length=0) : mainclip.trim(endframe+1,mainclip.framecount()-1) /me concludes with TheFluff that the code is now fool/hoserproof |
2008-01-27, 00:50 | Link #71 |
Junior Member
Fansubber
Join Date: Aug 2007
|
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?
__________________
|
2008-01-27, 01:00 | Link #72 | |
Banned
Join Date: Aug 2006
|
Quote:
|
|
2008-01-28, 01:44 | Link #73 |
Junior Member
Fansubber
Join Date: Aug 2007
|
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"
__________________
|
2008-01-29, 18:00 | Link #77 |
Aegisub dev
Join Date: Sep 2004
Location: Stockholm, Sweden
Age: 39
|
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.
__________________
|
Thread Tools | |
|
|