VideoHelp Forum




+ Reply to Thread
Results 1 to 18 of 18
  1. Hello!

    To be blunt and fast is there a way to insert a .png logo with a transparent layout in either the .ass file or Avisynth script?

    Cheers
    Quote Quote  
  2. you can do it with avisynth and overlay()
    Quote Quote  
  3. I'm a total noob with avisynth scripts so i basicly do a overlay(LINKTOTHEFILENAME) ? how do i position it then?

    Edit: and time it of course.
    Quote Quote  
  4. use x and y coordinates to move them, or position them when you generate your logo (i.e. make the png the same size as your video frame dimension, and move the logo wherever you want in your image editor)

    http://avisynth.org/mediawiki/Overlay

    e.g.

    Code:
    a1=AviSource("file.avi")
    a2=ImageSource("logo.png",pixel_type="RGB32")
    Overlay(a1,a2,mask=a2.ShowAlpha(),x=50,y=50)
    In this example, I moved it x=50, y=50


    To time it, cut it up into segments with trim(), so that you only apply the logo to sections that you want

    e.g.
    Code:
    a=AviSource("file.avi").Trim(0,100)
    b=AviSource("file.avi").Trim(101,200)
    c=AviSource("file.avi").Trim(201,300)
     
    b2=ImageSource("logo.png",pixel_type="RGB32").
    b3=Overlay(b,b2,mask=b2.ShowAlpha(),x=50,y=50)
     
    a++b3++c
    In this example, I divided the video into sections from frames 0-100, 101-200, 201-300 , and the logo is applied to the middle section only
    Last edited by poisondeathray; 19th Feb 2010 at 15:32.
    Quote Quote  
  5. Tnx! It worked perfectly! Now for one more question how do I make a fade in/out, not just pop in?
    Quote Quote  
  6. You would normally use fade() or fadeio() or one of it's variants
    http://avisynth.org/mediawiki/Fade

    But there seems to be a problem with fading out for the overlay. The workaround was to reverse the clip and use fadein. See this thread for more info:
    https://forum.videohelp.com/threads/305020-AviSynth-JDL_ApplyRange()-FadeIn()-Compatibility-Issue

    Maybe someone has an easier way, but it seems to work
    Quote Quote  
  7. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by poisondeathray View Post
    But there seems to be a problem with fading out for the overlay.
    The reason fade out didn't work in the other thread was because the logo clip was longer than the clip it was overlayed onto - the fade out was beyond the end of the visible part!

    So you need something like this, to make the lengths match:
    Code:
    a1=AviSource("file.avi")
    a2=ImageSource("logo.png",pixel_type="RGB32", end=a1.frameCount)
    Overlay(a1,a2,mask=a2.ShowAlpha().FadeIO0(20),x=50,y=50)
    (here for a 20 frame fade in and out)
    Quote Quote  
  8. Hum I actually pulled it off but the problem now is that the video & audio don't match exactly. Here's my code:

    Code:
    LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\TIVTC.dll")
    LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\dgdecode.dll")
    LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\telecidehints.dll")
    LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\fieldhint.dll")
    LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrain.dll")
    LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\nnedi.dll")
    
    
    function Preset0(clip c) {
    #Name: Default
    c
    removegrain(mode=1)
    return last
    }
    
    a=DirectShowSource("C:\Users\shorto\Desktop\enkoding\commandline\uverworld.avi",  fps=23.976).Trim(0,120)
    b=DirectShowSource("C:\Users\shorto\Desktop\enkoding\commandline\uverworld.avi",  fps=23.976).Trim(121,167)
    c=DirectShowSource("C:\Users\shorto\Desktop\enkoding\commandline\uverworld.avi",  fps=23.976).Trim(168,5647)
    d=DirectShowSource("C:\Users\shorto\Desktop\enkoding\commandline\uverworld.avi",  fps=23.976).Trim(5648,5783)
    
    b2=ImageSource("logo.png",pixel_type="RGB32")
    b3=Overlay(b,b2,mask=b2.ShowAlpha().FadeIn(27),x=0,y=75)
    d4=Overlay(d,b2,mask=b2.ShowAlpha().FadeIn(27),x=0,y=75)
     
    a++b3++b3.reverse()++b++c++d++d4
    
    Spline36Resize(720,544)
    TextSub("C:\Users\shorto\Desktop\enkoding\commandline\karanew.ass")
    What did I miss? I mean the fades are perfect now only this problem remains :P
    Quote Quote  
  9. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by shorto View Post
    Code:
    a++b3++b3.reverse()++b++c++d++d4
    You've got section 'b' repeated 3 times (once in reverse) and section 'd' twice. Is this what you want?
    The 'reverse' trick is unnecessary if you follow my post above.
    Also, you should use AviSource instead of DirectShowSource, especially when trimming, since the latter is not always frame-accurate.
    Quote Quote  
  10. I basicly need the logo to appear 2 times, one time with fade in and fade out the other time only fade in. That's why I inserted the b so many times.
    Quote Quote  
  11. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    You probably want something like:
    Code:
    v=AviSource("C:\Users\shorto\Desktop\enkoding\commandline\uverworld.avi)
    a=v.Trim(0,120)
    b=v.Trim(121,167)
    c=v.Trim(168,5647)
    d=v.Trim(5648,5783)
    
    b2=ImageSource("logo.png",pixel_type="RGB32")
    b3=Overlay(b,b2,mask=b2.ShowAlpha().Trim(0,46).FadeIO0(27),x=0,y=75)
    d2=Overlay(d,b2,mask=b2.ShowAlpha().FadeIn(27),x=0,y=75)
     
    a++b3++c++d2
    Quote Quote  
  12. Script error: expected a, or)

    What does that mean? xD It's stated for the line "b2=ImageSource("logo.png",pixel_type="RGB32") "
    Quote Quote  
  13. Originally Posted by Gavino View Post
    The reason fade out didn't work in the other thread was because the logo clip was longer than the clip it was overlayed onto - the fade out was beyond the end of the visible part!
    nice catch gavino!
    Quote Quote  
  14. Script error: expected a, or)

    What does that mean? xD It's stated for the line "b2=ImageSource("logo.png",pixel_type="RGB32") "


    It usually means you have an extra bracket, comma, or quotation mark. Post the full script (copy & paste) and error
    Last edited by poisondeathray; 20th Feb 2010 at 08:20.
    Quote Quote  
  15. Here we go! xD

    The script:
    Code:
    LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\TIVTC.dll")
    LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\dgdecode.dll")
    LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\telecidehints.dll")
    LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\fieldhint.dll")
    LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrain.dll")
    LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\nnedi.dll")
    
    
    function Preset0(clip c) {
    #Name: Default
    c
    removegrain(mode=1)
    return last
    }
    
    v=AviSource("C:\Users\shorto\Desktop\enkoding\commandline\uverworld.avi)
    a=v.Trim(0,120)
    b=v.Trim(121,167)
    c=v.Trim(168,5647)
    d=v.Trim(5648,5783)
    
    b2=ImageSource("logo.png",pixel_type="RGB32")
    b3=Overlay(b,b2,mask=b2.ShowAlpha().Trim(0,46).FadeIO0(27),x=0,y=75)
    d2=Overlay(d,b2,mask=b2.ShowAlpha().FadeIn(27),x=0,y=75)
     
    a++b3++c++d2
    
    Spline36Resize(720,544)
    TextSub("C:\Users\shorto\Desktop\enkoding\commandline\karanew.ass")
    The error:

    Code:
    AviSynth script error:
    Script error: expected a , or)
    (C:\Users\shorto\Desktop\enkoding\commandline\TEST ZA PVJE.avs, line 22, column 20)
    Quote Quote  
  16. I'm not seeing any errors. Are you sure that's the correct (current) script? Did you save it and re-open it ?

    If you scroll up to post#4, I had a typo, I had a "." at the end of that line that shouldn't be there
    Quote Quote  
  17. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    You're missing the quote at the end of the filename:
    Originally Posted by shorto View Post
    Code:
    v=AviSource("C:\Users\shorto\Desktop\enkoding\commandline\uverworld.avi)
    Whoops, my fault - looks like I left it out in post #11 when I cut and pasted your earlier script - sorry.
    Quote Quote  
  18. Tnx so much to the both of you! It works perfectly now!
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!