Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 29th September 2017, 06:29   #1  |  Link
mel2000
Registered User
 
Join Date: Jun 2007
Posts: 54
Need Multiple Simultaneous Image Overlays on One Video

Windows 10, Avisynth 2.6.0

I'd like to simultaneously overlay 3 of the same rectangles upon different coordinates of a video during the same frames. I've tried many combinations but none work. I can only get one rectangle to display even if I set a different variable for each rectangle. Can someone help me amend my script toward my objective? Thanks.

Code:
vid1 = "mytest1.mp4"        # w=540 px, h=960 px
img1 = "rect1_red.jpg"

main = DirectShowSource(vid1, audio=false)
pip=ImageSource(img1, end=main.framecount-1, fps=main.FrameRate())  

x1=main.Trim(0, end=2199)
y1=Overlay(main,pip,x=20,y=400,opacity=1.0).Trim(2200, end=2903)
z1=main.Trim(2904, 0)
x1+y1+z1
mel2000 is offline   Reply With Quote
Old 29th September 2017, 08:35   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
I dont quite understand what you are aiming at, but below seems to be what you are doing (or would like to do guessing from script).

Code:
vid1 = "mytest1.mp4"        # w=540 px, h=960 px
img1 = "rect1_red.jpg"

main = DirectShowSource(vid1, audio=false)      # almost any other source filter is more desirable
pip  = ImageSource(img1, end=0)                 # e=0,one frame only : Not sure that fps is necessary

c1=main.trim(0   ,2199)
c2=main.trim(2200,2903)
c3=main.trim(2904,0)

x1=c1
y1=c2.Overlay(pip,x=20,y=400,opacity=1.0)    # EDIT: single frame pip used for all of the range.
z1=c3

x1+y1+z1
Above does not seem to correspond with your verbal requirement, eg '3 of the same rectangles upon different coordinates of a video during the same frames'

So, maybe you are aiming at something more like this, [EDIT: below would be my best guess]
Code:
vid1 = "mytest1.mp4"        # w=540 px, h=960 px
img1 = "rect1_red.jpg"

main = DirectShowSource(vid1, audio=false)      # almost any other source filter is more desirable
pip  = ImageSource(img1, end=0)                 # e=0,one frame only : Not sure that fps is necessary

c1=main.trim(0   ,2199)
c2=main.trim(2200,2903)
c3=main.trim(2904,0)

y1=c2.Overlay(pip,x=20,y=400,opacity=1.0)       # 3 different lots of coords, on frames 2200 to 2903
y2=y1.Overlay(pip,x=30,y=410,opacity=1.0)
y3=y2.Overlay(pip,x=40,y=420,opacity=1.0)

c1 + y3 + c3
Both, totally untested.

EDIT: Below is equivalent to the y1, y2, and y3, lines. (Default for Opacity is 1.0, so not actually needed)
Code:
y3=c2.Overlay(pip,x=20,y=400).Overlay(pip,x=30,y=410).Overlay(pip,x=40,y=420)
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 29th September 2017 at 08:54.
StainlessS is offline   Reply With Quote
Old 29th September 2017, 10:42   #3  |  Link
mel2000
Registered User
 
Join Date: Jun 2007
Posts: 54
Thank you so much for your prompt reply StainlessS. You understood exactly what I wanted and your solution worked perfectly. It was also clear and thorough enough to let me see where I went astray.

I tested with your y3 concatenated overlays and they worked as predicted too. You really taught me a lot today and your solution is definitely going into my Avisynth archives.
mel2000 is offline   Reply With Quote
Old 29th September 2017, 16:14   #4  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Arh, I got there, but by a bit of a detour, glad it got sorted, peace be with you
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:16.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.