Log in

View Full Version : Adding a picture to a video


Jonaldinho
7th August 2011, 17:10
Hi, i'm trying to add a picture to the end of a video in avisynth. I want the image to display for 10 seconds. I want the video to fade out to black and the picture to fade in from black. I have already managed to do this, I just don't know how to add the picture to the end of the video.

Here's my video script:

vid=DirectShowSource("C:\Capture\Example Video.GRF", audio=false).AssumeBFF()
aud=DirectShowSource("C:\Capture\Example Audio.GRF", video=false)
AudioDub(vid, aud)
ConvertToYV12(interlaced=true)
Load_Stdcall_Plugin("O:\MeGUI\tools\yadif\yadif.dll")
Yadif(order=0)
LanczosResize(852,480) # Lanczos (Sharp)
LoadPlugin("O:\MeGUI\tools\avisynth_plugin\FluxSmooth.dll")
FluxSmoothST(7,7) # Medium Noise

__film = last
__t0 = __film.trim(290, 5636)
__t0

Fadeout2 (25)

Here's my picture script:

ImageSource("C:\Capture\Example.jpg", end = 250, use_DevIL=false).AssumeFPS(25, true)
ConvertToYV12(interlaced=false)
Fadein2 (25)

Any help appreciated.

cobo
7th August 2011, 22:38
Assuming you want silence for the final image, I think this would work. Adjust the audio_rate of BlankClip (http://avisynth.org/mediawiki/BlankClip) to match that of your first clips audio.
vid=DirectShowSource("C:\Capture\Example Video.GRF", audio=false).AssumeBFF()
aud=DirectShowSource("C:\Capture\Example Audio.GRF", video=false)
AudioDub(vid, aud)
ConvertToYV12(interlaced=true)
Load_Stdcall_Plugin("O:\MeGUI\tools\yadif\yadif.dll")
Yadif(order=0)
LanczosResize(852,480) # Lanczos (Sharp)
LoadPlugin("O:\MeGUI\tools\avisynth_plugin\FluxSmooth.dll")
FluxSmoothST(7,7) # Medium Noise

__film = last
__t0 = __film.trim(290, 5636)
__t0

Fadeout2 (25)

a=last

vid2=ImageSource("C:\Capture\Example.jpg", end = 250, use_DevIL=false).AssumeFPS(25, true).ConvertToYV12(interlaced=false)
aud2=BlankClip(vid2, audio_rate=48000)
b=AudioDub(vid2, aud2).Fadein2 (25)

a+b

Gavino
7th August 2011, 22:51
Adjust the audio_rate of BlankClip (http://avisynth.org/mediawiki/BlankClip) to match that of your first clips audio.
This can be ensured by using audio_rate=AudioRate(a).
You might also need to set channels=AudioChannels(a).

Jonaldinho
8th August 2011, 09:54
Thanks a lot Cobo and Gavino. Cobo's script worked after i'd adjusted it with Gavino's tip & set the channels to the same as video (a). :thanks: