Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 20th January 2016, 20:01   #1  |  Link
cadet51
Registered User
 
Join Date: Jan 2016
Posts: 5
Script watermark animated

Hello,

I am looking for a script that allows me to display an animated image (either gif, png, etc.) to capture or encoded via avisynth.
I happened to insert a watermark in this forum grace can be so thanks to you I will.
Sincerely younger
cadet51 is offline   Reply With Quote
Old 22nd January 2016, 03:01   #2  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,373
There's ImageSourceAnim, but it does not work as far as I can tell.
If anyone has got an animated GIF to load with this or any other Avisynth filter, please tell me how you did it.

I would load the GIF in VirtualDub and save it as AVI. Save in RGB mode as "uncompressed" or using a lossless codec such as Huffyuv, Lagarith, UTVideo or MagicYUV.

(If GIF is odd-sized, crop it to a width & height divisible by 2 before saving to AVI)

You can even do transparency, IF there is one color that you can say is transparent. You may have to edit the GIF to make the "transparent" palette index color show a unique color after it's been converted to RGB32.
Code:
## background (your source here)
V=ColorBars.AmplifyDB(-12)
#return V.Info ## RGB32

## animation source:
A=AviSource("bravo-2.avi").Loop

## create transparency mask:
transparent_color=$00FFFF ## cyan
M=A.ResetMask
\  .ColorKeyMask(transparent_color, 1, 1, 1)
\  .ShowAlpha
#return M

## set animation speed:
A=A.AssumeFPS(5).ConvertFPS(V) 

## overlay animation over background, lower right corner:
x=V.Width-A.Width-16
y=V.Height-A.Height-16
Layer(V, A.Mask(M), level=257, x=x, y=y)
raffriff42 is offline   Reply With Quote
Old 22nd January 2016, 03:13   #3  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,666
Quote:
Originally Posted by raffriff42 View Post
There's ImageSourceAnim, but it does not work as far as I can tell.
If anyone has got an animated GIF to load with this or any other Avisynth filter, please tell me how you did it.
To load GIFs I use FFImageSource from FFMS2 (FFVideoSource also works). LSMASHSource's LWLibavVideoSource is also able to do it, just tried with this:


Edit: ImageSourceAnim works on the file above .

Last edited by Reel.Deel; 22nd January 2016 at 03:15.
Reel.Deel is offline   Reply With Quote
Old 22nd January 2016, 03:26   #4  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Earth would not work for me either with ImageSourceAnim, nor would this animated gif:- http://forum.doom9.org/showthread.ph...66#post1754166

LWLibavVideoSource worked OK with both.

EDIT:
Quote:
Originally Posted by Reel.Deel View Post
ImageSourceAnim works on the file above .
What was your script, dont work for me.

EDIT: Did you download the Devil Lib from somewhere ? (think there is a newer one)
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 22nd January 2016 at 03:33.
StainlessS is offline   Reply With Quote
Old 22nd January 2016, 03:34   #5  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,666
ImageSourceAnim works on the bravo.gif, I'm using AviSynth+ r1576, maybe that's why.
Reel.Deel is offline   Reply With Quote
Old 22nd January 2016, 03:44   #6  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,373
LWLibavVideoSource FTW! Thank you!
http://avisynth.nl/index.php/LSMASHSource
Code:
LoadPlugin(P + "LSMASH_Source\rev785\AviSynth\LSMASHSource.dll")
LWLibavVideoSource("bravo-1.gif").Loop
You still have to hack the GIF to get transparency...

Last edited by raffriff42; 22nd January 2016 at 03:47. Reason: loop
raffriff42 is offline   Reply With Quote
Old 22nd January 2016, 03:44   #7  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
ImageSourceAnim works on the bravo.gif, I'm using AviSynth+ r1576, maybe that's why.
Could well be.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 22nd January 2016 at 03:47.
StainlessS is offline   Reply With Quote
Old 22nd January 2016, 03:57   #8  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,666
Quote:
Originally Posted by raffriff42 View Post
You still have to hack the GIF to get transparency...
What do you mean? LWLibavVideoSource("bravo-1.gif").ShowAlpha() works just fine.
Reel.Deel is offline   Reply With Quote
Old 22nd January 2016, 04:50   #9  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,373
I mean, I never tried that! Thanks, Reel.Deal.
raffriff42 is offline   Reply With Quote
Old 22nd January 2016, 17:25   #10  |  Link
cadet51
Registered User
 
Join Date: Jan 2016
Posts: 5
Hello,

Thank you already for your help. I arrived launched the script but I can't have the miniaturized the picture on the screen.
I would then bring up the image for a while at the beginning of the film.
cadet51 is offline   Reply With Quote
Old 22nd January 2016, 19:32   #11  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Sorry cadet51, your English is not too good and probably nobody is quite sure what you are saying.

This is what I think you say:-

Quote:
I arrived launched the script but I can't have the miniaturized the picture on the screen.
I launched the script but cannot get the gif to display.

Quote:
I would then bring up the image for a while at the beginning of the film.
I would like to display the gif at the beginning of a movie.

############################

You need to post an example of the script that you tried, and also would be good if you can post
your gif on eg SendSpace.com or MediaFire.com so people can see what is wrong.

I know that this is an "English Only Forum", but I think it would be not out of order for you to provide
Additional text in your own language (but you must first provide the English).
.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 22nd January 2016, 21:43   #12  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Am unlikely to be of any further assistance, I keep getting DEP (Data Execution Prevention, XP32) error message relating to
Windows Explorer. Only recently did system reinstall, nothing much more than Video related (and compilers) installed.
Going to re-install system again now.
Bye for now.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 23rd January 2016, 04:36   #13  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,373
Quote:
Originally Posted by StainlessS View Post
You need to post an example of the script that you tried, and also would be good if you can post
your gif
on eg SendSpace.com or MediaFire.com so people can see what is wrong.
Agreed. If you do this, I will help you with the problem as you have stated it (but, sorry, without any new conditions or requests)

EDIT Hope the system comes together StainlessS.

Last edited by raffriff42; 23rd January 2016 at 04:38.
raffriff42 is offline   Reply With Quote
Old 28th January 2016, 15:59   #14  |  Link
cadet51
Registered User
 
Join Date: Jan 2016
Posts: 5
Hello,
Sorry for my English not good but I'm French. The script works well but rendering my logo does not fit all.
Example:
Logo avi



Logo with ShowAlpha

Video=DirectShowSource("D:\00042.m2ts",Audio=false,Fps=23.976)
Video=Assumefps(video,23.976)
logo=LSMASHVideoSource("D:\furax.mp4")
logoT=LSMASHVideoSource("D:\furax.mp4",format="RGB32").ShowAlpha(pixel_type="RGB32")

P1 = trim(Video,0,90)
P12 = trim(Video,91,335)
P2 = trim(Video,334,0)

OL1 = Overlay(P12, logo ,x=(P12.Width() - logo.Width() - 20), y=(P12.Height() - logo.Height() - 960), mask=logoT)

Video2=P1 + OL1 + P2

video2 =lanczosresize(video2,1920,1080)

ConvertToYV12(Video2)


Log without ShowAlpha

Video=DirectShowSource("D:\00042.m2ts",Audio=false,Fps=23.976)
Video=Assumefps(video,23.976)
logo=LSMASHVideoSource("D:\furax.mp4")
logoT=LSMASHVideoSource("D:\furax.mp4",format="RGB32")

P1 = trim(Video,0,90)
P12 = trim(Video,91,335)
P2 = trim(Video,334,0)

OL1 = Overlay(P12, logo ,x=(P12.Width() - logo.Width() - 20), y=(P12.Height() - logo.Height() - 960), mask=logoT)

Video2=P1 + OL1 + P2

video2 =lanczosresize(video2,1920,1080)

ConvertToYV12(Video2)

As you see, the red becomes clear that I want the black background.
Thanks for your help.

Last edited by cadet51; 28th January 2016 at 16:28.
cadet51 is offline   Reply With Quote
Old 28th January 2016, 22:26   #15  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,373
Your Logo source does not have a true Alpha channel. An alpha channel should look something like this:

(which I created in a paint editor from your image by converting to grayscale and manipulating video levels)

Assembling your image, with my Alpha mask, gives this result:




EDIT working script example:
Code:
Video=DirectShowSource("D:\00042.m2ts",Audio=false,Fps=23.976)
Video=video.Assumefps(23.976)
logo=DirectShowSource("E:\furax-Fade2.mp4")
logoT= logo.ConvertToY8.Levels(21, 1.2, 64, 0, 255, coring=false) ## FAKE MASK FROM LUMA

P12 = Video.trim(91,335)
OL1 = Overlay(P12, logo,
\       x=P12.Width-logo.Width-20, 
\       y=P12.Height-logo.Height-20, 
\       mask=logoT)
return OL1

Last edited by raffriff42; 16th March 2017 at 23:25. Reason: (fixed image links)
raffriff42 is offline   Reply With Quote
Old 2nd February 2016, 16:25   #16  |  Link
cadet51
Registered User
 
Join Date: Jan 2016
Posts: 5
Hello,

The problem is a file to MP4 and not a PNG file.
Is what I could have you sent my MP4 and see what it is not going to not have this total transparency effect of the red?
I thank you greatly.
cadet51 is offline   Reply With Quote
Old 2nd February 2016, 23:10   #17  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,373
Quote:
Originally Posted by cadet51 View Post
The problem is a file to MP4 and not a PNG file...
My suggestion will work with MP4 or anything else - as long as there is a color that can be set as the "transparent" color. In the case of your sample, the transparent color was Black. After manipulating your image to get a fake "mask" or "transparency" clip (where white=opaque and black=transparent), I used the following script:
Code:
Last=(some video source)
## animation source:
A=ImageSource("FG.png", pixel_type="RGB32").Loop ## foreground image OR VIDEO
M=ImageSource("M.png", pixel_type="RGB32").Loop ## "mask" image OR VIDEO

## set animation speed (animated GIF only)
#A=A.AssumeFPS(5).ConvertFPS(V) 

## overlay animation over background, lower right corner:
x=V.Width-A.Width-16
y=V.Height-A.Height-16
Layer(V, A.Mask(M), level=257, x=x, y=y)
If there is no color that is always transparent, this method will not work.

If you obtained your animated logo from a competent artist, he or she should be able to provide you with a matching "mask" or "alpha channel" clip.
raffriff42 is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 22:47.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.