timing picute in a video

This forum is for questions and discussion of all the aspects of handling and cleaning up your footage with Avisynth.
DorDahan
Joined: Fri Apr 22, 2011 7:55 pm
Org Profile

timing picute in a video

Post by DorDahan » Fri Apr 22, 2011 8:41 pm

i have a picture in want to put in a video so i made this code in avs file:
video = DirectShowSource("file.mkv",fps=23.976,convertfps=true)
image = Imagesource("C:\Users\Dor\Desktop\פרקי דרגון בול\נקיים\pic1.png", pixel_type="RGB32")
Overlay(video, image, x=170, y=90, mask=image.ShowAlpha())
now how i time it so i will be from mintune X second X or frame X to frame X
please help me and give me the whole code because im really nobbie with this stuff thanks :awesome:

[MOD258: Filename redacted, please read the rules.]

User avatar
Zarxrax
Joined: Sun Apr 01, 2001 6:37 pm
Contact:
Org Profile

Re: timing picute in a video

Post by Zarxrax » Sat Apr 23, 2011 12:29 pm

The easiest way would probably be to use Trim() commands to break your main video into several parts, and then just apply the overlay to the part that you want, and then join the parts back together.

Code: Select all

video = DirectShowSource("file.mkv",fps=23.976,convertfps=true)
part1 = video.Trim(0,1000)
part2 = video.Trim(1000,2000)
part3 = video.Trim(2000,0)
image = Imagesource("C:\Users\Dor\Desktop\פרקי דרגון בול\נקיים\pic1.png", pixel_type="RGB32")
Overlay(part2, image, x=170, y=90, mask=image.ShowAlpha())
Part1 ++ Overlay(part2, image, x=170, y=90, mask=image.ShowAlpha()) ++ Part3
In this example, the overlay will appear from frames 1000 to 2000 of the video.

[MOD258: Fixed the script with the missing line.]

User avatar
Zarxrax
Joined: Sun Apr 01, 2001 6:37 pm
Contact:
Org Profile

Re: timing picute in a video

Post by Zarxrax » Sat Apr 23, 2011 12:30 pm

Oops, the last line should actually be:

Part1 ++ Overlay(part2, image, x=170, y=90, mask=image.ShowAlpha()) ++ Part3

User avatar
mirkosp
The Absolute Mudman
Joined: Mon Apr 24, 2006 6:24 am
Status: (」・ワ・)」(⊃・ワ・)⊃
Location: Gallarate (VA), Italy
Contact:
Org Profile

Re: timing picute in a video

Post by mirkosp » Sat Apr 23, 2011 12:45 pm

Just an error with those trims, they should be more like:

Code: Select all

part1 = video.Trim(0,999)
part2 = video.Trim(1000,2000)
part3 = video.Trim(2001,0)
To have it overlayed from frame 1000 to 2000. You're getting repetition of frame 1000 and 2000 otherwise.
Image

User avatar
Zarxrax
Joined: Sun Apr 01, 2001 6:37 pm
Contact:
Org Profile

Re: timing picute in a video

Post by Zarxrax » Sat Apr 23, 2011 1:14 pm

Oh, for some reason I was thinking that the values should overlap.

DorDahan
Joined: Fri Apr 22, 2011 7:55 pm
Org Profile

Re: timing picute in a video

Post by DorDahan » Sat Apr 23, 2011 1:48 pm

can someone give me the lastest updated code i should input into virtualdubmod? because i didnt get a think ...

DorDahan
Joined: Fri Apr 22, 2011 7:55 pm
Org Profile

Re: timing picute in a video

Post by DorDahan » Sat Apr 23, 2011 1:53 pm

i puted this code:

Code: Select all

LoadPlugin("C:\VirtualDubMod\plugins\immaavs.dll")
video = DirectShowSource("C:\Users\Dor\Desktop\פרקי דרגון בול\נקיים\Dragon Ball Z Kai 001 [720p].mkv",fps=23.976,convertfps=true)
part1 = video.Trim(0,999)
part2 = video.Trim(1000,2000)
part3 = video.Trim(2001,0)
image = Imagesource("C:\Users\Dor\Desktop\פרקי דרגון בול\נקיים\pic1.png", pixel_type="RGB32")
Overlay(part2, image, x=170, y=90, mask=image.ShowAlpha())
Part1 ++ Overlay(part2, image, x=170, y=90, mask=image.ShowAlpha()) ++ Part3
i didn't get any errors but i cant see the picuture now, how i decied in which frames i will be able to see it?

DorDahan
Joined: Fri Apr 22, 2011 7:55 pm
Org Profile

Re: timing picute in a video

Post by DorDahan » Sat Apr 23, 2011 2:07 pm

sorry for all the replys but i made a new code:
LoadPlugin("C:\VirtualDubMod\plugins\immaavs.dll")
m1 = DirectShowSource("C:\Users\Dor\Desktop\פרקי דרגון בול\נקיים\Dragon Ball Z Kai 001 [720p].mkv")
m2 = immareadpic("C:\Users\Dor\Desktop\פרקי דרגון בול\נקיים\pic1.png").changefps(3000).fadein(0).fadeout(0)
overlay (m1, m2, mode="blend", mask=showalpha(m2), x=170, y=90)

now its shows the logo in my video but, i still cant determine when its start i can tell it to end in (changeframe)

DorDahan
Joined: Fri Apr 22, 2011 7:55 pm
Org Profile

Re: timing picute in a video

Post by DorDahan » Sat Apr 23, 2011 2:33 pm

exctally i fixed it.

DorDahan
Joined: Fri Apr 22, 2011 7:55 pm
Org Profile

Re: timing picute in a video

Post by DorDahan » Sat Apr 23, 2011 4:34 pm

ok a whole new question.. i want to put antoher picture and i tried this code

Code: Select all

LoadPlugin("C:\VirtualDubMod\plugins\immaavs.dll")
video = DirectShowSource("C:\Users\Dor\Desktop\פרקי דרגון בול\נקיים\[www.bafsubs.tk]Dragon_Ball_Kai_E1.mkv",fps=23.976,convertfps=true)
part1 = video.Trim(0,300)
part2 = video.Trim(301,404)
part3 = video.Trim(405,0)
part4 = video.Trim(0,300)
part5 = video.Trim(301,404)
part6 = video.Trim(405,0)
image = Imagesource("C:\Users\Dor\Desktop\פרקי דרגון בול\נקיים\pic3.png", pixel_type="RGB32")
image2 = Imagesource("C:\Users\Dor\Desktop\פרקי דרגון בול\נקיים\pic3.png", pixel_type="RGB32")
Overlay(part2, image, x=130, y=180, mask=image.ShowAlpha())
Overlay(part5, image2, x=-130, y=-180, mask=image.ShowAlpha())
Part1 ++ Overlay(part2, image, x=130, y=180, mask=image.ShowAlpha()) ++ Part3
Part4 ++ Overlay(part5, image2, x=-130, y=-180, mask=image.ShowAlpha()) ++ Part6
and now i cant see both of the picture what wrong with it?

Locked

Return to “AviSynth Help”