I've read a lot of tutorials on how to overlay an image in AviSynth, but wonder if there is a way to place several images on a video at specific time positions. I've been able to render videos with a transparent png logo, but didn't find any tutorial how to place different images at different frame positions.
Asked
Active
Viewed 3,554 times
2 Answers
2
I believe you have to figure out time positions from the frame rate. For instance the below sample will show the overlay image between 101 - 200 frames (4th to 8th second):
AviSource("sample.avi", false).AssumeFPS(25).ConvertToRGB
img = ImageSource("sample.png")
Trim(0, 100) + Trim(101, 200).Overlay(img, 20, 30, opacity = 0.5) + Trim(201, 0)

Sertac Akyuz
- 54,131
- 4
- 102
- 169
-
But can I chain a lot of images with this method? I admit I based my question on a previous experience with AviSynth where I was adding a logo to a video, but when re-reading tutorials recently by googling a lot of combination like "avisynth add overlay images", I had the feeling it is only possible to add one image, and not several. – Léon Pelletier Jun 05 '12 at 03:19
-
@Leon - Yes, you can append 'Overlays'. F.i. `Trim(101, 200).Overlay(img, 20, 30, opacity = 0.5).Overlay(img2, 100, 100)` If you have to remove/overlay images at arbitrary times you'd have a lot of Trims though.. – Sertac Akyuz Jun 05 '12 at 03:30
-
Wow, thanks. If the library supports it, I don't mind appending tons of Overlay. It's like doing: a.Replace("a","").Replace("b","") etc. :) – Léon Pelletier Jun 05 '12 at 04:25
-
I have problem with this approach (lot of trims) and therefore "Out of Memory error". Is there some other approach which makes possible to put 100s of overlays at different times? See http://stackoverflow.com/questions/18720919/avisynth-out-of-memory-error-100s-of-image-overlays – svenkapudija Sep 10 '13 at 13:59
1
Thanks!
Depending on your input codec you might need to replace AviSource("sample.avi", false).AssumeFPS(25).ConvertToRGB with DirectShowSource("sample.avi")
If you use the wrong one you might get a error in the line of AVISource couldn't locate a decompressor for fourcc mjpg

Johan
- 177
- 2
- 6