I have some subtitles in PNG image sequence format. I was wondering if anyone knew of a way to use AVISynth to overlay this sequence of PNG subtitle files over a video source? I'm looking to "burn in" the subtitles and then do the transcode, so if anyone could please provide an example script it would be much appreciated. Thanks.
+ Reply to Thread
Results 1 to 9 of 9
-
-
I assume you have transparency enabled on the png images? Otherwise you will get a big black block where they are overlayed
You can do it for 1 at a time, but since the intervals and display time for each sub is different, there is no automated way to do this and it will take a long , long, long time for this project. It would be way faster in a NLE to do this, but you still have to do it manually for each subtitle segment to get the timings right.
The basic syntax for a transparent overlay is this:
Code:a1=avisource("movie.avi") a2=ImageReader("logo.png") a3=ImageReader("logo.png",pixel_type="RGB32").ShowAlpha(pixel_type="RGB32") Overlay(a1,a2,mask=a3)
-
Thanks. Yes, the PNGs have transparency. Would ImageSequence work for this too? The PNGs are synced to frame numbers, so frame 100 is PNG 100, and thus the overlay and timings aren't really that difficult. I would test this myself, but I don't have direct access to the PNGs at the moment.
-
OK that should be easier then, just use a wildcard for the naming. So assuming the .png images are the same dimensions as the video (if not, just use the x,y positions), and the fps is 23.976:
Code:a1=AVISource("movie.avi") a2=ImageSource("sub%02d.png",01,99,23.976) a3=ImageSource("sub%02d.png",01,99,23.976,pixel_type="RGB32").ShowAlpha(pixel_type="RGB32") Overlay(a1,a2,mask=a3)
ImageSequence is the old plugin, and was replaced by ImageReader, which was replaced by ImageSource. The latter 2 are about the same and basically interchangable, although imagesource is supposed to be faster for single image loading
You can find the other arguments, documentation and examples here, but that is the basic syntax.
http://avisynth.org/mediawiki/ImageSource
http://avisynth.org/mediawiki/Overlay -
Thanks a lot for your assistance poisondeathray. I was hoping that ImageSource worked with image sequence masks. I use ImageSource when souring PNG or BMP files into a video sequence, and for adding simple stationary logo overlays, but I have never done image sequencing and masking together in the same script. Hopefully this will work out. I will let you know when I get the files tomorrow. Thanks again for your help!
-
i did not have it's script file i.e., .dill file. did you know where i can find it?
-
yes i am bumping this thread. i found this thread in goole search. i have direct installation files of avisynth i use it from last 2 months. now i want to use overlay features. i had search all the installation files but did not find the script file of overlay, that's why i am asking it.
-
You find out the usage of the built-in filters at the AviSynth site. You find the usage of the third party filters usually in the included documentation.
There's no ready made script for the built-in Overlay filter. You create the script yourself and modify it based on how you're using it (location or opacity, for example):
http://avisynth.org/mediawiki/Overlay
http://avisynth.org/mediawiki/Layer
Here's an example of Overlay usage I have lying around:
A=ImageSource("E:\Compilation DVDs\Padmini Final\Menu\IndianRed.bmp",End=1005)
B=Import("E:\Compilation DVDs\Padmini Final\Menu\SongTemplate.avs")
A=A.BilinearResize(640,480)
A=A.ConvertToYUY2()
Overlay(A,B,X=24,Y=60,Opacity=.75)
Similar Threads
-
Avisynth: PNG sequences on MP4 video
By KBII in forum SubtitleReplies: 0Last Post: 7th Feb 2012, 05:08 -
How to display .png just for (exam 3 seconds or 100 frames) with Avisynth?
By xicudiz in forum EditingReplies: 2Last Post: 9th Apr 2011, 22:41 -
Create scrolling text effect for Movie Credits using avisynth and png image
By wiseant in forum Newbie / General discussionsReplies: 6Last Post: 13th Sep 2010, 03:21 -
Avisyth and overlay transparent png looking strange
By lindylex in forum EditingReplies: 4Last Post: 15th Aug 2010, 18:23 -
Help with Avisynth overlay
By WAKA in forum Newbie / General discussionsReplies: 12Last Post: 14th Jul 2009, 13:37