Log in

View Full Version : Merge img to first frame of vid


wthreex
30th January 2020, 13:36
I want to merge image to first frame of the video because some application out there using first frame of video, Looking for some methods that first convert image into video for 1 frame, Then resize/fit/merge it for the given video, Is it possible to handle it by avisynth at all?

StainlessS
30th January 2020, 16:02
You could try something like this


VID="D:\V\v.mp4"
IMG="D:\V\0887.png"


I=ImageSource(IMG,end=0) # end=0, end at frame 0, ie single frame.
#return I

a = VID.LSMASHAudioSource()
v = VID.LSMASHVideoSource()
v=AudioDub(v,a)

v=v.Trim(0,0) # Trim/Pad audio to length

v=v.ConvertToYV12() # Or choose

K=v.BlankClip(Length=1) # Dummy video, Silent audio, 1 frames worth, same format as v clip audio
I=I.AudioDub(K) # Add the silent audio to I clip

I=I.Spline36Resize(v.Width,v.Height) # Resize same as v clip, known to be valid size for YV12 [because v=v.ConvertToYV12() succeeded ]
I=I.ConvertToYV12() # convert to same Colorspace as v clip
I=I.AssumeFPS(v) # Same Framerate as v clip


I++v # Mix it up a bit

return Last

wthreex
30th January 2020, 18:14
Dude that perfectly worked! You saved my life