View Full Version : Adding PNG file to start and middle of clip (AvsPmod)
BlockABoots
4th May 2013, 20:01
I want to add a png file to the start of my video clips and then another png in the middle of the clip. this is what i have atm..
video=AVISource("E:\CAPTURES\My Records\CCAM\Mega Turrican (Standard).avi") + AVISource("E:\CAPTURES\My Records\CCAM\Mega Turrican (CCAM).avi")
video1=ImageReader("C:\MT orig.png", start=0, end=1000, fps=24, use_DevIL=true)
video2=Normalize(volume=1.0, show=false)
return video1
but, all i get to a black image for 1000 frames and nothing else. How do i get the png file to be displayed and select when to have it appear in the video clip?
StainlessS
4th May 2013, 20:23
Below, made some assumptions on what you require, description is ambiguous.
Untested.
LEN=100 # len of Image clip
V1=AVISource("D:\avs\TEST.AVI").Normalize(volume=1.0, show=false)
V2=AVISource("D:\avs\TEST.AVI").Normalize(volume=1.0, show=false)
V3=ImageReader("D:\avs\a.png", start=0, end=LEN-1, fps=V1.FrameRate, use_DevIL=true)
V3=V3.ConvertToYV12() # whatever V1 & V2 are
V4=V1.BlankClip(length=LEN) # Silent Audio same as clip V1 but same len as image clip V3
V3=V3.AudioDub(V4) # image clip of LEN frames, same framerate as V1, with silent audio as V1
return V3 ++ V1 ++ V3 ++ V2
EDIT: Edited, Tested and Working, insert your own filenames.
EDITED as per Gavino post.
BlockABoots
4th May 2013, 21:26
Ok this is what i have...
# len of Image clip
V1=AVISource("E:\CAPTURES\My Records\CCAM\Mega Turrican (Standard).avi").Normalize(volume=1.0, show=false)
V2=AVISource("E:\CAPTURES\My Records\CCAM\Mega Turrican (CCAM).avi").Normalize(volume=1.0, show=false)
V3=ImageReader("C:\MT orig.png", start=0, end=0, fps=V1.FrameRate, use_DevIL=true).Loop(times=LEN,start=0,end=0)
V3=V3.ConvertToYV12() # V1 & V2 are
V4=V1.BlankClip(length=LEN) # Audio same as clip V1 but same len of image clip V3
V3=V3.AudioDub(V4)
return V3 ++ V1 ++ V3 ++ V2
when i try the file in virtualdub i get the message,
Avisynth open failure:
Splice: Frame Size Dont Match
("E:\CAPTURES\My Records\CCAM\Preview.avs, Line 9)
StainlessS
4th May 2013, 21:40
Then make them the same size, I have no idea what size they each are.
StainlessS
4th May 2013, 21:45
OK, try this
LEN=100 # len of Image clip
V1=AVISource("D:\avs\TEST.AVI").Normalize(volume=1.0, show=false)
V2=AVISource("D:\avs\TEST.AVI").Normalize(volume=1.0, show=false)
V3=ImageReader("D:\avs\a.png", start=0, end=LEN-1, fps=V1.FrameRate, use_DevIL=true)
V3=V3.ConvertToYV12() # whatever V1 & V2 are
V4=V1.BlankClip(length=LEN) # Silent Audio same as clip V1 but same len as image clip V3
V3=V3.AudioDub(V4) # image clip of LEN frames, same framerate as V1, with silent audio as V1
# Assuming V1 has required size
V2=V2.Spline36Resize(V1.Width,V1.Height)
V3=V3.Spline36Resize(V1.Width,V1.Height)
return V3 ++ V1 ++ V3 ++ V2
EDITED as per Gavino post.
Gavino
4th May 2013, 22:41
V3=ImageReader("D:\avs\a.png", start=0, end=0, fps=V1.FrameRate, use_DevIL=true).Loop(times=LEN,start=0,end=0)
You don't need to use Loop(), since ImageReader knows when it is dealing with a single file and caches the image internally rather than reading it again for each frame.
V3=ImageReader("D:\avs\a.png", start=0, end=LEN-1, fps=V1.FrameRate, use_DevIL=true)
StainlessS
5th May 2013, 00:59
Ah yes, from docs:-
# Read a single image, repeat 300 times
ImageSource("static.png", end = 300, use_DevIL=true)
# Much, much faster in v2.56
Thanx big G.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.