View Full Version : Logo with fade in and out
McBAIN
10th March 2004, 19:31
Hi people.
I have a video and want to put a logo in it. Although i do have a logo filter, it's not a logo filter i'm searching for. The logo filter for virtualdub (and avisynth, as far as i know) is permanently in-screen, and cannot be faded either in nor out.
To add things up, i also want to put a picture in the middle of my movie (with fading)
Now, i did look around on this forum, and the filters that can be downloaded, but i couldn't find my avisynth script that can do this.
I have little experience with avisynth myself, so i sadly enough can't code one on my own.
Could anybody help me with this? It would be GREATLY appreciated!
Thanks a lot in advance, McBAIN
sh0dan
11th March 2004, 00:19
Overlay (http://www.avisynth.org/index.php?page=Overlay) conmbined with ConditionalReader (http://www.avisynth.org/index.php?page=ConditionalReader) might be the best solution for you. Have a look at the second example of ConditionalReader (http://www.avisynth.org/index.php?page=ConditionalReader) for inspiration.
stickboy
11th March 2004, 00:22
How about using Overlay with a mask clip? Calling FadeOut/FadeIn on the mask clip should do the trick.
Edit:
Something like this should work. It sticks the specified logo in the bottom-right corner and fades it out. You can use FadeIO if you want to fade in and fade out. If you want to put it in the middle of some source clip, use Trim on the source to cut on the middle section, apply the logo, and splice it back in. (Let us know if you any questions about how to do that.)
src = ColorBars(640, 480).ConvertToYUY2()
src = src.AssumeFPS(29.97).ShowFrameNumber()
logo = ImageReader("D:\temp\logo.png", 0, 0, 1, true).FlipVertical()
logo = logo.AssumeFPS(src.FrameRate())
logoMask = ImageReader("D:\temp\logo-mask.png", 0, 0, 1, true).FlipVertical()
logoMask = logoMask.AssumeFPS(src.FrameRate()).Loop(20).FadeOut(10)
Overlay(src, logo, x=(src.Width() - logo.Width()), y=(src.Height() - logo.Height()),
\ mask=logoMask)I put logo.png (http://www.avisynth.org/stickboy/etc/logo.png) and logo-mask.png (http://www.avisynth.org/stickboy/etc/logo-mask.png) available for download as examples.
Edit:
Another example (http://www.avisynth.org/stickboy/etc/logo-example.zip).
Edit 2:
Oops, fixed links.
CraigBjorn
11th March 2004, 01:15
Hopefully this isn't the wrong place to post this, but this was the first time I've messed around with the Conditional Reader function, but I don't understand in the second script when the values in opacity.txt are assigned to variable ol_opacity_offset, I see that opacity.txt is set to the variable ol_opacity_offset, but I never see that variable used... maybe I'm too much of a newb, but I can see alot of usefulness for the conditional reader function.
sh0dan
11th March 2004, 13:32
"OL_opacity_offset", "OL_x_offset" and "OL_y_offset" are variables read by Overlay on each frame. See the Overlay documentation.
trolltuning
11th March 2004, 15:58
I clicked on the link to Conditional Reader. At the end it says its easier to watch the above clip than to describe it. How do I watch the clip?
McBAIN
11th March 2004, 19:53
I don't understand :(
I copied your script, but it didn't work right away. So i started to edit it in AVSEdit 1.0b, and when i tried to preview, it said "Script error: there is no function named "ImageReader"
I tried to create a new one with the program, and it looked totally the same. It started with errors like "i don't know what "begin" is". I editted all properties, and when it was finally adjusted, ait went back to the start of the line and gave the ImageReader error. (So it didn't see the imagereader error, untill it's properties were all good? Sure looks strange)
clip = AviSource("H:\MegaManZeroavisynth.avi")
src = ColorBars(240, 160).ConvertToYUY2()
src = src.AssumeFPS(59).ShowFrameNumber()
logo = ImageReader("H:\mcbain.png" , 0, 10, 59, true).FlipVertical()
logo = logo.AssumeFPS(src.FrameRate())
logoMask = ImageReader("H:\mcbain.png", 0, 10, 59, true).FlipVertical()
logoMask = logoMask.AssumeFPS(src.FrameRate()).Loop(20).FadeOut(10)
Overlay(clip1 src, logo, x=(src.Width() - logo.Width()), y=(src.Height() - logo.Height()),
\ mask=logoMask)
If you guys could tell me what i'm doing wrong, it would really be appreciated. :(
Grtz, McBAIN
stickboy
11th March 2004, 23:05
Originally posted by McBAIN
clip = AviSource("H:\MegaManZeroavisynth.avi")
src = ColorBars(240, 160).ConvertToYUY2()
src = src.AssumeFPS(59).ShowFrameNumber()You don't need the ColorBars (or the AssumeFPS/ShowFrameNumber stuff on the following line). They were just an example that I used for the source. This should be:
src = AVISource("H:\MegaManZeroavisynth.avi")
logo = ImageReader("H:\mcbain.png" , 0, 10, 59, true).FlipVertical()Why the 10? Are you intending to load 11 copies of mcbain.png?
I'm not familiar with AVSEdit... maybe try opening your script in notepad, posting the code in, and then opening the script in VirtualDub?
Leuf
11th March 2004, 23:10
Originally posted by McBAIN
I have a video and want to put a logo in it. Although i do have a logo filter, it's not a logo filter i'm searching for. The logo filter for virtualdub (and avisynth, as far as i know) is permanently in-screen, and cannot be faded either in nor out.
This isn't true, both Donald Graft's and my slight modification to his have start/end/fade ability. I've never needed an avisynth version, but it would be simple enough to do an RGB only port if that would help you. The vdub version of mine can be found here (http://mysite.verizon.net/vze3kkvm/filters.html).
Wilbert
12th March 2004, 10:32
when i tried to preview, it said "Script error: there is no function named "ImageReader"
Just install AviSynth v2.54. Your version of AviSynth is too old.
McBAIN
13th March 2004, 13:48
Thanks for the replies guys, i'll try this.
McBAIN
13th March 2004, 13:59
Wow Leuf! Those filters just took care of everything i wanted!
I didn't know they could do that... Gotto look better next time :)
Thanks go out to everyone who helped me in this thread!
IanB
16th March 2004, 00:39
This maybe a bit late but I offer it as an alternative for future reference. I actually use this method to remove fade in/out transparent logos but can be used for the opposite effect as desired here.
.. (get a video source)
Vn=last
..(some code to add a logo)
Vl=last
Start=100 # Set frame to start fade in
End=150 # Set frame to end fade in
vAn=Trim(Vn, 0, Start-1)
vBn=Trim(Vn, Start, End)
vBl=Trim(Vl, Start, End)
vCl=Trim(Vl, End+1, 0)
vAn + Dissolve(vBn, vBl, End-Start+1) + vCl
.. (Rest of processing)Simply reverse Vn and Vl to do a fade out.
Vn is video without logo
Vl is identical video but with logo
vAn, vBn, vBl, vCl are appropriate segments to build the output effect (no logo, fade in logo, solid logo).
IanB
blueaeone
31st July 2006, 22:49
Hello,
Im using almost the same code as from stickboy-example and it works wonderful. But, how can I set a start frame? Is it possible to add antialiasing or something else to make the edges of the logo look better?
regards blueaeone
dizzy1
14th September 2007, 12:44
I tried this and saved it as a .vcf .syl and .jobs and tried each of them by going to virtual dub>Run Script the test.avi exists and the 1.bmp file also exists. But i keep getting variable not found i knw im doing somat noob please help.
src = AviSource("C:\test.avi")
logo = ImageReader("C:\1.bmp" , 0, 1, 59, true).FlipVertical()
logo = logo.AssumeFPS(src.FrameRate())
logoMask = ImageReader("C:\1.bmp", 0, 1, 59, true).FlipVertical()
logoMask = logoMask.AssumeFPS(src.FrameRate()).Loop(20).FadeOut(10)
Overlay(clip1 src, logo, x=(src.Width() - logo.Width()), y=(src.Height() - logo.Height()),
\ mask=logoMask)
gzarkadas
14th September 2007, 21:19
This is the offending line:
Overlay(clip1 src, logo, x=(src.Width() - logo.Width()), y=(src.Height() - logo.Height()), mask=logoMask)
It should be:
Overlay(src, logo, x=(src.Width() - logo.Width()), y=(src.Height() - logo.Height()), mask=logoMask)
malouf
28th November 2007, 10:23
Hi,
I'm looking for a way to insert a logo in a video too, but with anti-aliased borders, so I guess it has to accept a file with an alpha channel. I tried virtaldub's filter, and your way but the borders of the logo are aliased, since it only takes one color that is fully transparent...
Is there a way to do that?
I tried resizing the video to a bigger size, inserting the log, then shrinking the video, so that the logo is blurred, but it uses too much cpu power.
Leak
28th November 2007, 12:10
Is there a way to do that?
You can read a file containing transparency if you set ImageReader's pixel_type to RGB32, but you'll have to extract the alpha from the image with ShowAlpha and use it as the mask argument of Overlay. That'll apply the image's transparency properly.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.