VideoHelp Forum




+ Reply to Thread
Results 1 to 6 of 6
  1. Im trying to Scale down a watermark when i try to use a variable it doesn't work but when i use numbers it works what am i doing wrong?

    this is what im working with
    Code:
    # http://code.google.com/p/ffmpegsource/
    
    # Source Files
    MyVideo = FFVideoSource( "C:\Input.avi" )
    MyAudio = FFAudioSource( "C:\Input.avi" )
    
    # Mux Audio & Video
    MyMovie = AudioDub( MyVideo , MyAudio )
    
    # Video Scale Factor
    VScale  = MyVideo.Height / 720
    # Video Scale Width 
    WScaleW = Int(350 * VScale)
    # Video Scale Height
    WScaleH = Int(100 * VScale)
    
    # WaterMark Image
    WM = FFImageSource( "C:\watermark.png" , WScaleW , WScaleH , "BICUBIC" , "RGB32" )
    
    # Apply WaterMark Image
    overlay( MyMovie , WM , mode="blend", mask=showalpha( WM ), x=Width( MyVideo ) - WScaleW , y=Height( MyVideo ) - WScaleH )
    Quote Quote  
  2. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    The problem is this line:
    Originally Posted by tater7 View Post
    VScale = MyVideo.Height / 720
    This will be done as an integer division and will give 0 if the video height is less than 720.
    You need to make it use floating point division by writing it as:

    VScale = MyVideo.Height / 720.0

    Incidentally, when using both FFVideoSource and FFAudioSource on the same source file, you should call FFAudioSource first, since otherwise the index will be created twice, wasting time.
    Quote Quote  
  3. Member
    Join Date
    Nov 2009
    Location
    United States
    Search Comp PM
    doh late
    Quote Quote  
  4. Originally Posted by Gavino View Post
    The problem is this line:
    Originally Posted by tater7 View Post
    VScale = MyVideo.Height / 720
    This will be done as an integer division and will give 0 if the video height is less than 720.
    You need to make it use floating point division by writing it as:

    VScale = MyVideo.Height / 720.0

    Incidentally, when using both FFVideoSource and FFAudioSource on the same source file, you should call FFAudioSource first, since otherwise the index will be created twice, wasting time.
    ty man works grate
    Quote Quote  
  5. Code:
    # http://code.google.com/p/ffmpegsource/
    
    # Source Files
    MyAudio = FFAudioSource( "C:\Input.avi" )
    MyVideo = FFVideoSource( "C:\Input.avi" )
    
    # Mux Audio & Video
    MyMovie = AudioDub( MyVideo , MyAudio )
    
    # Scale 350x100 WaterMark Made For 720p
    ScaleWidth  = Int( 350 * ( MyVideo.Height / 720.0 ))
    ScaleHeight = Int( 100 * ( MyVideo.Height / 720.0 ))
    
    # WaterMark Image
    WaterMark = FFImageSource( "C:\WaterMark.png" , ScaleWidth , ScaleHeight , "BICUBIC" , "RGB32" )
    
    # Apply WaterMark Image
    ApplyMark = overlay( MyMovie , WaterMark , mode = "blend" , mask = showalpha( WaterMark ) , x = Width( MyVideo ) - ScaleWidth , y = Height( MyVideo ) - ScaleHeight )
    
    Return ApplyMark
    ** Update **
    Replaced code with suggestions...the script now works as expected.
    Quote Quote  
  6. Instead of:

    ScaleWidth = Int( 350 * ( MyVideo.Height / 720.0 ))
    I would avoid floating point for faster execution (not really an issue here):

    ScaleWidth = 350 * MyVideo.Height / 720
    I'm assuming AviSynth will perform the operations in order -- which I'm not sure about. And the height isn't big enough to cause an integer overflow!
    Quote Quote  



Similar Threads

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