Log in

View Full Version : Adding in a Logo into AVIsynth script


SacredCultivator
4th July 2007, 07:02
Dear Readers,

This has been getting me ever since my team has wanted me to Encode for them and I use meGUI to do my Encodes and have yet to learn how to add in a Picture Logo into the Video...

And read through the forum but wasn't too sure how the code worked...

Found this on the other thread:
logo = imagesource ("").ConvertToRGB32
overlay(logo,mask=logo.showalpha(), x= 315, y= 200, mode ="blend",

opacity=1)

But yeah not too sure how to add it into the script...
If the fansub group requires the placement/options of the Logo to be:
Opacity = 40%
Set to Top Left (TL) and the X Offset = 8

How would I edit the script code? And the source would be .avi

stickboy
4th July 2007, 07:57
If the fansub group requires the placement/options of the Logo to be:
Opacity = 40%
Set to Top Left (TL) and the X Offset = 8 Call Overlay with the arguments:x=8, y=0, opacity=0.4

SacredCultivator
5th July 2007, 03:03
@stickboy: So if the filesource is .avi the coding would be (This is just an example of one of my .avi scripts:

AVIFileSource("D:\Downloads\aijou ippon\Aijou Ippon 02.avi")
ConvertToYV12()
Crop(44,2,-46,-0,align=true)
Spline36Resize(720,480)
removegrain(2)

textsub("D:\Downloads\aijou ippon\Aijou Ippon 02.ass")


To add in logo I'd do...
AVIFileSource("D:\Downloads\aijou ippon\Aijou Ippon 07.avi")
logo= imagesource("D:\Keepers\Subbing\FanSub Logo's\{akira shock!} logo.bmp").ConvertToRGB32
overlay(logo,mask=logo.showalpha(), x= 40, y= 0, mode ="blend", opacity=.4)
Crop(44,2,-46,-0,align=true)
Spline36Resize(720,480)
removegrain(2)


Sorry for the trouble.

EDIT: I got that to work but a problem occured.
1. It is slightly cut off screen (like 1/4 of the logo shows in the top left corner)
2. Can see the black background of the pic (And I assume it should be transparent)

But thank you for your help as it got me further than I was before.
2ndEDIT: Alright updated the last code to what has worked only problem now is the 'ShowAlpha' not too sure how to make the thing transparent.
http://img371.imageshack.us/img371/4271/untitledps4.th.jpg (http://img371.imageshack.us/my.php?image=untitledps4.jpg)

3rd EDIT: Does the ConvertTo make a big difference? As when I change the 'ConvertToRGB32' to 'ConvertToYV12' the script doesn't work anymore and it seems all the .avi files I work with auto-converts(adds to script) to that. Also if working off a .vob/.MPEG would I need to add that ConvertTo line? Or can I remove it along with the '.' that comes before it?

~bT~
5th July 2007, 11:28
This is what I do.


LoadVirtualDubPlugin("path\to\Logo.vdf","Logo",0)
ConvertToRGB()
Logo(0, 0, 100, 2, 0, 0, 255, 0, "path\to\logo.bmp", 0, 0, 0, 0, 0, 0, 0)
ConvertToYV12()
Logo.vdf (http://maxupload.com/69A69C7B)

In the same folder, make a copy of the logo.bmp but name it logoA.bmp

SacredCultivator
5th July 2007, 14:36
@bengali thug: FOr you code... what do all those numbers represent?

~bT~
5th July 2007, 14:40
have a look at the read me, i cant remember but I think the 100 is opacity.

SacredCultivator
5th July 2007, 17:42
So my code would look like...

AVIFileSource("D:\Downloads\aijou ippon\Aijou Ippon 07.avi")
LoadVirtualDubPlugin("D:\Keepers\Subbing\VirtualDubMod_1_5_10_2_All_inclusive\plugins\Logo.vdf","Logo",0)
ConvertToRGB()
Logo(0, 0, 100, 2, 0, 0, 255, 0, "D:\Keepers\Subbing\VirtualDubMod_1_5_10_2_All_inclusive\plugins\{akira shock!} logo.bmp", 0, 0, 40, 2, 0, 0, 255, 0)
ConvertToYV12()
Crop(44,2,-46,-0,align=true)
Spline36Resize(720,480)
removegrain(2)

Right? As I have the logo in the my folder of choice (Orig + added 'A' on another)

But then on preview nothing shows...

~bT~
5th July 2007, 19:40
AVIFileSource("D:\Downloads\aijou ippon\Aijou Ippon 07.avi")

Crop(44,2,-46,-0,align=true)
Spline36Resize(720,480)
removegrain(2)

LoadVirtualDubPlugin("D:\Keepers\Subbing\VirtualDubMod_1_5_10_2_All_inclusive\plugins\Logo.vdf","Logo",0)
ConvertToRGB()
Logo(0, 0, 100, 2, 0, 0, 255, 0, "D:\Keepers\Subbing\VirtualDubMod_1_5_10_2_All_inclusive\plugins\{akira shock!} logo.bmp", 0, 0, 40, 2, 0, 0, 255, 0)
ConvertToYV12()
what about the above?

SacredCultivator
5th July 2007, 22:31
Nope I get this error:

AviSynth script error:
Script error: Invalid arguments to function "Logo"
(D:\Downloads\aijou ippon\Aijou Ippon 02.avs, line 9)

~bT~
6th July 2007, 01:37
Try this line:

Logo(0, 0, 100, 2, 0, 0, 255, 0, "D:\Keepers\Subbing\VirtualDubMod_1_5_10_2_All_inclusive\plugins\{akira shock!} logo.bmp", 0, 0, 0, 0, 0, 0, 0)

If it doesn't work, edit the logo name to just Logo.bmp & LogoA.bmp.

The bit in red maybe causing the prob, special characters and spaces.

I have used the above all the time without fail and so have many of my friends.

BTW, how did u get the following code?

Logo(0, 0, 100, 2, 0, 0, 255, 0, "D:\Keepers\Subbing\VirtualDubMod_1_5_10_2_All_inclusive\plugins\{akira shock!} logo.bmp", 0, 0, 40, 2, 0, 0, 255, 0)

SacredCultivator
6th July 2007, 01:47
EDIT: Nvm got it to work, thanks.

As for the BTW... hehe my mistake didn't know what those 0's were so I tried the same code I had for the front 0,0,100,2,etc.

~bT~
6th July 2007, 02:02
^ cool. so is that what u were after??

SacredCultivator
6th July 2007, 02:20
Yes it was, saved me a lot of trouble, thank you very much.

Taicho
24th August 2007, 02:54
Helpful thread for me as well.
I would like to add some information:

One of the sweet features of the Donald Graft logo filter is its ability to animation (like fade-in, fade-out) and to set the duration the logo shows for without overlaying a spliced section of the video This means you can apply the the above filter to the entire video.

if you change the line of code to:
Logo(5, 5, 100, 2, 0, 0, 255, 5, "D:\TTnet-5.bmp", 0, 25, 75, 0, 0, 0, 0)

...the logo will start showing at frame 25, and then disappear at frame 75. No need to cut frames 25-75 out, overlay the logo, then splice it back in again.

Edit: I have no questions at this time. I am merily providing unsolicited information, kinda like an advertisement. Have a nice day