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 )
		
			+ Reply to Thread
			
		
		
		
			
	
	
				Results 1 to 6 of 6
			
		- 
	
- 
	The problem is this line: 
 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.
- 
	** Update **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 
 Replaced code with suggestions...the script now works as expected.
- 
	Instead of: 
 
 I would avoid floating point for faster execution (not really an issue here):ScaleWidth = Int( 350 * ( MyVideo.Height / 720.0 ))
 
 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!ScaleWidth = 350 * MyVideo.Height / 720
Similar Threads
- 
  How to add a watermark in a .mkv file with Avisynth?By imam2007 in forum Video ConversionReplies: 1Last Post: 20th Nov 2011, 17:04
- 
  How to add a watermark with AviSynth ?By AlienWare in forum EditingReplies: 36Last Post: 22nd Jul 2011, 12:59
- 
  Watermark removalBy Shrimpy72 in forum ffmpegX general discussionReplies: 3Last Post: 14th Jan 2011, 12:31
- 
  How to add watermark? Please helpBy lana in forum Newbie / General discussionsReplies: 2Last Post: 2nd Dec 2010, 05:18
- 
  WATERMARK help!By legendvij in forum SubtitleReplies: 9Last Post: 13th Feb 2008, 02:52


 
		
		 View Profile
				View Profile
			 View Forum Posts
				View Forum Posts
			 Private Message
				Private Message
			 
 
			
			
 Quote
 Quote

