ale_x
17th September 2015, 16:00
Hey guys!
I just want to ask. is there a specific codec to encode alpha video, like AFX users doing when they're encoding there logo?
and what is the functions that I have to use?
StainlessS
17th September 2015, 18:51
Suggest RGBA UtVideo FourCC="ULRA" or pretty much any RGB32 codec.
I've no idea who AFX users are or how they encode logo (most people here want to get rid of logos, not create them).
VirtualDub might be better suited to writing logos then Avisynth, but could use avisynth Overlay with mask.
One of the previous versions of your post has several scripts, few people here are clairvoyant, where you use someone else's script, then
best post a link or script itself, I googled for the said scripts and found nothing.
Also, maybe try Search (top of this web page) for 'Logo' in 'Avisynth Usage' and 'VirtualDub' forums.
EDIT:
Overlay: http://avisynth.nl/index.php/Overlay
Layer: http://avisynth.nl/index.php/Layer
EDIT: Note this from Overlay Docs
Using RGB32 alpha channel
Overlay will never use the alpha channel given in an RGB32 clip. If you want to extract the alpha channel from an RGB32 clip you can use the ShowAlpha command to extract the alpha information. For maintaining maximum quality it is recommended to extract the alpha as RGB.
ale_x
17th September 2015, 19:13
Actually I useed with Lagarith Lossless Video Codec & UtVidero RGB , and I encod with RGB
this is my simple code to make alpha channel
FFVideoSource("C:\Users\X\Desktop\Python\dra.mkv", colorspace = "RGB32").showalpha().TextSub("Dra.ass")
I opened the video in VirtualD.
http://s3.postimg.org/3wdj1bk3l/image.png
and as I said before I ued "Lagarith Lossless Codec" with RGB Mode
http://s3.postimg.org/ne7oacnlt/Untitled.png
but, when I imported alpha video in AvsPmod the text not appearing when I encode With RBGA Mode, but with RGB Mode
only alfa_2 video appearing with white background!!
this my code
A = avisource("C:\Users\X\Desktop\New folder (2)\vid.avi")
V = avisource("C:\Users\X\Desktop\New folder (2)\alfa_2.avi")
insertsign(A, V, 0,0 )
same thing happened with I used (Overlay(A,V, mask =V, mode = "blend" , opacity = 1.0))
.
StainlessS
17th September 2015, 19:57
You might want to say what InsertSign() is.
Also, not sure if this may be of interest, VSFilter:- http://avisynth.org.ru/docs/english/externalfilters/vsfilter.htm
And here a few results from Search of forum ('Watermark' is good search word but I had used 'Logo'):-
http://forum.doom9.org/showthread.php?p=1599260
http://forum.doom9.org/showthread.php?t=163947
http://forum.doom9.org/showthread.php?t=163870
http://forum.doom9.org/showthread.php?t=161809
http://forum.doom9.org/showthread.php?t=161737
http://forum.doom9.org/showthread.php?t=161762
http://forum.doom9.org/showthread.php?t=161145
http://forum.doom9.org/showthread.php?t=160317
http://forum.doom9.org/showthread.php?t=152310
http://forum.doom9.org/showthread.php?t=144883
http://forum.doom9.org/showthread.php?t=143163
http://forum.doom9.org/showthread.php?p=1554176
EDIT: Presume this is referenced InsertSign by TheFluff, from here:- https://forums.animesuki.com/showthread.php?t=48608
(From the days when he did something other than whine)
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
}
ale_x
17th September 2015, 20:13
I think using picture as logo is more easy than alpha channel I thought .
anyway. I will take a look at this topics.
thank you very much =)
Regards.
StainlessS
18th September 2015, 07:28
Since adding InsertSign() edit to my previous post, I've had a little play and made a mod to do similar but a little extended.
Below is probably not of much use to you but I thought that you or others might some day find a use for it.
Requires mask tools, but only to add the artificial Elliptical Disk mask in script function client.
Function OverlayClip(clip c,clip c2,Int "S", Int "E", Int "X", Int "Y",Float "Opacity",String "Mode") {
/*
Requires RGB32 clips c and c2, c2 with Alpha mask.
Overlay clip c with clip c2 using c2's RGB32 Alpha channel mask, frames S to E, @ clip c overlay coords X and Y.
Start and End Args S & E, are similar but not exactly like trim.
OverlayClip(c,c2, 0,0) # Entire clip
OverlayClip(c,c2, 100,0) # Frame 100 to End of Clip
OverlayClip(c,c2, 0,-1) # Frame 0 Only
OverlayClip(c,c2, 1,1) # Frame 1 Only
OverlayClip(c,c2, 1,-1) # Frame 1 Only
OverlayClip(c,c2, 1) # Frame 1 Only [Not same as Trim()], E defaults to -1 ie single frame.
OverlayClip(c,c2, 1,-3) # Frames 1 to 3 (ie 3 frames)
OverlayClip(c,c2, 100,200) # Frames 100 to 200
OverlayClip(c,c2, 100,-50) # Frames 100 to 149 ie 50 frames
X and Y are OverLay x & y offsets, and can be -ve where is relative to c.Width & c.Height, use eg x = -(c2.Width+16)
If c2.Framecount is shorter than S,E specified range, then final c2 frame will be used for remainder of overlay range,
so if c2 clip is single frame, then that frame will be used for entire overlay range.
Opacity=Overlay::Opacity and Mode=Overlay::Mode.
*/
FMX=c.FrameCount-1
S = Min(Max(Default(S,0),0),FMX) E = Default(E,-1)
X=Default(X,0) Y=Default(Y,0)
Opacity=Float(Default(Opacity,1.0)) Mode=Default(Mode,"Blend")
X = (X<0) ? c.Width + X : X
Y = (Y<0) ? c.Height + Y : Y
E = (E==0) ? FMX : E
E = Min(((E < 0) ? S-E-1 : E),FMX) # S <= E <= FMX : E is +ve END Frame number (may be 0)
Empty = c.BlankClip(Length=0)
CS = (S==0) ? Empty : c.Trim(0,-S)
CM = c.Trim(S,E==0?FMX:E).Overlay(c2, mask=c2.showalpha(),x=X,y=Y,opacity=Opacity,mode=Mode)
CE = (E==FMX) ? Empty : c.Trim(E+1,0)
CS ++ CM ++ CE
}
Avisource("E:\V\StarWars.avi").ConvertToRGB32() # Source
Sym=Avisource("E:\V\XMen2.avi").Trim(5000,0) # Overlay clip (YV12, we will convert to RGB and add Alpha Channel)
W=(Width/16) * 4
H=(Height/16) * 4
Sym=Sym.BilinearResize(W,H)
#S="(((x-.5)^2 +(y-.5)^2) < .25 ? 255 : 0" # Elliptical Disk (Hard Edge)
S="((x-.5)^2+(y-.5)^2)>.25?0:(((x-.5)^2+(y-.5)^2)<.2?255:(.25-((x-.5)^2+(y-.5)^2))*5100)" # Elliptical Disk (Soft Edge)
# Create Elliptical Disk
ElipDisk = Sym.trim(0,-1).mt_lutspa(mode = "relative", expr = Mt_Polish(S), chroma = "-128" ).ConvertToRGB32.Loop(Sym.framecount,0,0)
# Add Elliptical Disk mask to Alpha Channel
Sym=Sym.ConvertToRGB32.Mask(ElipDisk)
# Start @ frame 100, End at end of Sym Clip, Rel Bottom RHS with 16 pixels GAP
Return OverlayClip(Last,Sym,S=100,E= -Sym.FrameCount,x= -(Sym.Width+16),y= -(Sym.Height+16))
EDITED:
ale_x
18th September 2015, 10:32
That's very kind from you.:)
I'll try to figure to what extent may help me
thank you.
StainlessS
18th September 2015, 16:58
Ale_x, it may not help you at all, sorry. I only did it for possible future projects, for you or others.
Hope that you dont mind me posting it here.
ale_x
19th September 2015, 14:21
it's ok dear, I just found a solution
Thanx =)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.