VideoHelp Forum
+ Reply to Thread
Results 1 to 12 of 12
Thread
  1. Member
    Join Date: Aug 2011
    Location: CA
    Search PM
    I'm trying to have an image appear at a certain point in the video. Here is my code:

    DirectshowSource("x.wmv", FPS=29.97, ConvertFPS=True)
    BilinearResize(640,480,0,0)

    And now for the image:

    clip="DirectShowSource("x.wmv")
    Overlay("x.jpg")
    ImageSource("x.jpg", Start=1609, End=1746)


    I get the message that a closing quotation mark is missing from the ImageSource section. It's there, I'm somewhat confused on what I'm missing here. Adding a quotation mark after the end time doesn't fix anything.
    Quote Quote  
  2. Member AlanHK's Avatar
    Join Date: Apr 2006
    Location: Hong Kong
    Search Comp PM
    What is your exact, complete AVS file? Don't excerpt.

    What you have certainly won't work, it creates a new clip on each line, unrelated to the previous.
    Quote Quote  
  3. Member
    Join Date: May 2001
    Location: United States
    Search Comp PM
    Originally Posted by smike View Post
    clip="DirectShowSource("x.wmv")
    No comment on whether your script will work or not, but the first " in the above line is a singleton.
    ICBM target coordinates:
    26 14' 10.16"N -- 80 16' 0.91"W
    Quote Quote  
  4. Yes, the quote just before DirectShowSource is wrong. Overlay() doesn't take the name of a file. You want something like:

    DirectShowSource("x.wmv")
    ovl=ImageSource("x.jpg")
    Trim(0,1608)+Trim(1609,1746).Overlay(ovl)+Trim(174 7,0)

    And note that DirectShowSource isn't always frame accurate.
    Last edited by jagabo; 25th Apr 2012 at 14:05.
    Quote Quote  
  5. Member
    Join Date: Aug 2011
    Location: CA
    Search PM
    That's what I needed, thank you. Now I just have to figure out how to play the whole movie with the overlay showing up at that time. Like you said, it isn't frame accurate.
    Quote Quote  
  6. Member
    Join Date: Aug 2011
    Location: CA
    Search PM
    Nearly everything works great now. Thanks everyone. The only problem I have is I decided to have it be a PNG image, with a transparent background, except a black box shows up as the background. I assumed this was saved as RGB32 already or something, So I can't use the ShowAlpha option.
    Quote Quote  
  7. Member
    Join Date: Sep 2007
    Location: Canada
    Search Comp PM
    Originally Posted by smike View Post
    Nearly everything works great now. Thanks everyone. The only problem I have is I decided to have it be a PNG image, with a transparent background, except a black box shows up as the background. I assumed this was saved as RGB32 already or something, So I can't use the ShowAlpha option.

    Can you redo the png image in your image editing program (gimp, photoshop)? You won't be able to use transparency without it.

    Several ways to do this, probably one of the easier ways overlay with showalpha. Create your png overlay with alpha the same dimensions as video, position the overlay where you want in your image program , then use trim to join sections that have the overlay to sections that don't have the overlay

    Code:
    mainvideo=FFMpegSource2("file.wmv", atrack=-1)
    logo=ImageSource("logo.png",pixel_type="RGB32")
    
    Overlay(mainvideo,logo,mask=logo.ShowAlpha())
    LogoVideo=last
    
    mainvideo.Trim(0,1608) ++ LogoVideo.Trim(1609,1746) ++ mainvideo.Trim(1747,0)
    Quote Quote  
  8. Member
    Join Date: Jul 2009
    Location: Spain
    Search Comp PM
    Originally Posted by poisondeathray View Post
    Code:
    Overlay(mainvideo,logo,mask=logo.ShowAlpha())
    LogoVideo=last
    This could be replaced simply by
    LogoVideo = Overlay(mainvideo,logo,mask=logo.ShowAlpha())

    According to taste, you could simplify further and use 'implicit last' for the main video:
    Code:
    FFMpegSource2("file.wmv", atrack=-1)
    logo=ImageSource("logo.png",pixel_type="RGB32")
    LogoVideo = Overlay(logo,mask=logo.ShowAlpha())
    
    Trim(0,1608) ++ LogoVideo.Trim(1609,1746) ++ Trim(1747,0)
    Quote Quote  
  9. Member
    Join Date: Aug 2011
    Location: CA
    Search PM
    That worked well. After that I had a bunch of bad luck.

    Just trying to set the placement of the PNG, and, forgot to save, when I did it perfectly the first time.

    Trim(0,20088)+Trim(20089,20129).Overlay(ovl)+Trim( 20130,0)

    I looked directly at the code, copied it pefectly with my custom text, so I was certain I would put:

    ("x.png", x=50, y=50)
    But it tells me that's not a valid Overlay function. I even went into the Virtualdub script editor and even that didn't help me.
    Quote Quote  
  10. Member
    Join Date: Jul 2009
    Location: Spain
    Search Comp PM
    Originally Posted by smike View Post
    Just trying to set the placement of the PNG, and, forgot to save, when I did it perfectly the first time.

    Trim(0,20088)+Trim(20089,20129).Overlay(ovl)+Trim( 20130,0)

    I looked directly at the code, copied it pefectly with my custom text, so I was certain I would put:

    ("x.png", x=50, y=50)
    But it tells me that's not a valid Overlay function. I even went into the Virtualdub script editor and even that didn't help me.
    The filename should not be present in the Overlay command - the connection to the file has already been made by ImageSource.
    In the quoted code you would use
    Trim(0,20088)+Trim(20089,20129).Overlay(ovl, x=50, y=50)+Trim(20130,0)

    or if using the code suggested by poisondeathray and me,
    ...
    Overlay(logo,mask=logo.ShowAlpha(), x=50, y=50)
    Quote Quote  
  11. Is there any software for video capturing that automatically add Text or logo overlay on video? Like this videocapx http://www.videocapx.com/ ?
    Last edited by Yountraj; 20th Sep 2012 at 10:52.
    Quote Quote  



Similar Threads