2012-01-23, 02:46 | Link #561 |
warpsharpened
Join Date: Sep 2008
|
Create your overlay.
Then using: Code:
### Overlay functions for RGBA videos and images with optional mattes ## ## Written by pichu, v0.4a ## Requires AVISynth 2.56+ ## Put this into your avisynth plugins directory ## Preliminary: aviSign( clip c string "filename" [, bool "rescale" = false , string "alpha_file" , string "colorspace" ] ) - this will open the overlay video for all sign( ) and reset the frame number, until another aviSign( ) is declared. ## Preliminary: imgSign( clip c string "filename" [, bool "rescale" = false , string "alpha_file" , "colorspace" ] ) - this will open the overlay image for all sign( ) and reset the frame number, until another aviSign( ) is declared. ## Usage: sign( clip c , int "start_frame" = 0 , int "end_frame" = 0 , , int "offset" = 0 , string "mode" = "Blend" , int "x" = 0 , int "y" = 0 ) # Parameters: c is the current clip getting overlayed (required) # filename is the filename of the RGBA overlay avi. (required) # start_frame is the starting frame of the overlay. (default = 0) # end_frame is the ending frame of the overlay. (default = 0) # offset is the number of frames to offset from current. (default = 0) # mode is the blending mode of the current overlay segment. (default = "blend") # Note: When mode="splice", the current clip will be spliced instead of overlayed. # x, y are the coordinates offset (default = 0,0) # colorspace is the colorspace conversion. It can be: RGB, RGB24, RGB32, YUY2, or YV12. # Conditions: If start_frame = 0, it will compute using the number of frames in the overlay to the end_frame. # If end_frame = 0, it will compute using the number of frames in the overlay to the start_frame. # If start_frame and end_frame are both 0, then the beginning of the video will get overlayed. # Note: this code can't allow you to overlay the clip on frame 0 with only one frame. # Examples: # # import( "Signs_Overlay.avsi" ) # sign( 1111 , 2222 ) +\ # sign( 4444 , 5555 ) # # The above example will generate the entire video sequence for clips at those frames. (synonymous to trim) # Now, you just need to add in aviSign( ... ) and remove +\ to get the final overlays :) # # import( "Signs_Overlay.avsi" ) # aviSign( "Sign1.avi" ).sign( 1234 ) # Allow you to overlay Sign1.avi at frame #1234 and ends at wherever the overlay ends. # aviSign( "Sign_all.avi" ) # sign( 1111 , 2222 ) # sign( 4444 , 5555 ) # The next sign, starting at frame 4444 and end at frame 5555 will get overlayed global SIGN_OVERLAY = "" global SIGN_FRAME = 0 function sign( clip c , int "start_frame" , int "end_frame" , int "offset" , string "mode" , int "x" , int "y" ) { offset = Default( offset , 0 ) mode = Default( mode , "Blend" ) end_frame = Default( end_frame , 0 ) x = Default( x , 0 ) y = Default( y , 0 ) start_frame = Default( start_frame , 0 ) overlay_frame = SIGN_FRAME assert( defined( c ) , "You must have a working video clip to be overlayed" ) end_frame = SIGN_OVERLAY.isclip ? ( ( end_frame > 0 ) ? end_frame : start_frame + SIGN_OVERLAY.framecount - 1 - SIGN_FRAME ) : end_frame start_frame = SIGN_OVERLAY.isclip ? ( ( start_frame >= 0 ) ? start_frame : end_frame - SIGN_OVERLAY.framecount + 1 + SIGN_FRAME ) : start_frame assert( start_frame < end_frame , "Starting Frame (" + string( start_frame ) + ") must be smaller than Ending Frame (" + string( end_frame ) + ")!" ) assert( ( start_frame >= 0 ) && ( end_frame >= 0 ) , "Starting (" + string( start_frame ) + ") and Ending Frame (" + string( end_frame ) + ") must not be smaller than 0" ) assert( end_frame < c.framecount , "The number of frames being overlayed must not be bigger than the number of frames in the clip you're overlaying on (end frame = " + String( end_frame ) + ")" ) o = SIGN_OVERLAY.isclip() ? SIGN_OVERLAY.assumefps( c ).trim( overlay_frame + offset , overlay_frame + end_frame - start_frame ) : "" global SIGN_FRAME = SIGN_FRAME + end_frame - start_frame + 1 start_frame = start_frame + offset sign_overlays = lcase( mode ) == "splice" ? o : ( SIGN_OVERLAY.isclip() ? c.trim( start_frame , end_frame ).overlay( o , x , y , o.showalpha , mode=mode ) : "" ) return \ SIGN_OVERLAY.isclip() ? \ ( start_frame > 0 ? \ ( end_frame < c.framecount( ) - 1 ? \ c.trim( 0 , -start_frame ) ++ sign_overlays ++ c.trim( end_frame + 1 , 0 ) : \ c.trim( 0 , -start_frame ) ++ sign_overlays ) : \ ( end_frame < c.framecount( ) - 1 ? \ sign_overlays ++ c.trim( end_frame + 1 , 0 ) : \ sign_overlays ) \ ) : c.trim( start_frame , end_frame ) } function aviSign( clip c , string "filename" , bool "rescale" , string "alpha_file" , string "colorspace" ) { rescale = Default( rescale , false ) colorspace = Default( colorspace , "" ) colorspace = UCase( colorspace ) alpha_file = Default( alpha_file , "" ) v = avisource( filename ).converttorgb32 global SIGN_FRAME = 0 global SIGN_OVERLAY = rescale ? ( ( alpha_file != "" ) ? mergeargb( avisource( alpha_file ) , v.showred , v.showgreen , v.showblue ) : v ).assumefps( c ).lanczos4resize( c.width , c.height ) : ( ( alpha_file != "" ) ? mergeargb( avisource( alpha_file ) , v.showred , v.showgreen , v.showblue ) : v ).assumefps( c ) global SIGN_OVERLAY = colorspace == "YV12" ? SIGN_OVERLAY.converttoyv12( ) : ( colorspace == "YUY2" ? SIGN_OVERLAY.converttoyuy2( ) : ( colorspace == "RGB" ? SIGN_OVERLAY.converttorgb( ) : ( colorspace == "RGB24" ? SIGN_OVERLAY.converttorgb24( ) : ( colorspace == "RGB32" ? SIGN_OVERLAY.converttorgb32( ) : SIGN_OVERLAY ) ) ) ) return c } function imgSign( clip c , string "filename" , bool "rescale" , string "alpha_file" , string "colorspace" ) { rescale = Default( rescale , false ) colorspace = Default( colorspace , "" ) colorspace = UCase( colorspace ) alpha_file = Default( alpha_file , "" ) v = imagesource( file=filename , start=0 , end=c.framecount - 1 , use_devil = true , pixel_type="RGB32" ).converttorgb32 global SIGN_FRAME = 0 global SIGN_OVERLAY = rescale ? ( ( alpha_file != "" ) ? mergeargb( imagesource( file=alpha_file , start=0 , end=c.framecount - 1 , use_devil = true ) , v.showred , v.showgreen , v.showblue ) : v ).lanczos4resize( c.width , c.height ) : ( ( alpha_file != "" ) ? mergeargb( imagesource( file=alpha_file , start=0 , end=c.framecount - 1 , use_devil = true ) , v.showred , v.showgreen , v.showblue ) : v ) global SIGN_OVERLAY = colorspace == "YV12" ? SIGN_OVERLAY.converttoyv12( ) : ( colorspace == "YUY2" ? SIGN_OVERLAY.converttoyuy2( ) : ( colorspace == "RGB" ? SIGN_OVERLAY.converttorgb( ) : ( colorspace == "RGB24" ? SIGN_OVERLAY.converttorgb24( ) : ( colorspace == "RGB32" ? SIGN_OVERLAY.converttorgb32( ) : SIGN_OVERLAY ) ) ) ) return c } Code:
Import(X:\path\to\Signs_Overlay.avs") #the above script AVISource("X:\path\to\source.avi") avisign("X:\path\to\overlay.avi").sign(startframe,endframe) #endframe optional |
2012-01-23, 06:30 | Link #562 |
Member
Join Date: Sep 2010
|
Emm I don't know if ask here or in other place.
In Aegisub the line start in 0:22:30.05 after I encode the episode the line start in 0:22:30.10. (I put the encoded episode in Aegisub and match the times, before and after) end in 0:22:31.98 after the encode 0:22:32.019. looks like in the lines of all the ep is OK but in the name of the episode and of the next episode it's happening. Thanks!
__________________
|
2012-01-26, 23:48 | Link #563 | |
warpsharpened
Join Date: Sep 2008
|
(from visitors messages or something)
Quote:
When you make your overlay I'd use lagarith (lags), fast recompress, set to output RGBA (null frames and multithreading should probably be checked on too). |
|
2012-01-30, 13:12 | Link #565 |
warpsharpened
Join Date: Sep 2008
|
Code:
v =AviSource("D:\anime\Persona4 ED WR.avi") MaskSub("D:\anime\persona 4 ED2 [Kanji Ktimed].ass" v.width,v.height,v.framerate,v.framecount).FlipVer tical() |
2012-02-01, 11:53 | Link #566 | |
Junior Member
|
Quote:
__________________
|
|
2012-02-02, 10:52 | Link #568 | |
Junior Member
|
Quote:
The problem still exists even when if I encoder with RABA, overlay video with black background anyway thanx for reply and ur help .
__________________
|
|
2012-02-03, 07:48 | Link #570 | ||
Junior Member
|
First I encoder overlay video, I used Lagarith lossless Code to save overlay as RGBA
Quote:
Quote:
__________________
|
||
|
|