View Full Version : avisynth + qt + subtitling question
tomerb
13th May 2007, 18:59
hey all,
I'm trying to develop a small quicktime-subtitling app,
Input file: QuicktimeDV (with no subtitles, pure video)
Output file: QuicktimeDV (with burnt-in subtitles)
the output file will be imported into avid for further editing
using avisynth and quicktime plugin I use QTInput to view the file,
add subtitles to it with avisynth's internal subtitle filter and QTOutput to write the result back to a quicktime file.
The render time is just about real-time which is great,
the rendered video looks great, BUT! the new "built-in" subtitles top border and bottom border flickers while
viewing on a PAL monitor through avid:confused:
any ideas on how to fix it would be greatly appreciated.
Thanks.
davidhorman
13th May 2007, 22:05
Add the subtitles to the input clip twice, once at the normal position, and once at a position one pixel higher. Then merge these two clips (using overlay or layer). This will blur the subtitles across both fields and eliminate the flickering.
The same can go for all kinds of "hard" graphics.
David
tomerb
16th May 2007, 12:54
Thanks for the reply, I've tried it but didn't like the results
I've found another solution, the internal Blur() filter.
the Blur() worked perfectly on the subtitles, but it also blurred the video.
I need the video to remain in good quality but the subtitles to be blurred,
I tried:
clip1 = QTInput("c:\kofi.mov",audio=true)
box = BlankClip().BicubicResize(586, 99).Blur(0,1)
clip1.Overlay(box, mode="blend", opacity=0.4, x=60, y=438)
Subtitle("My subtitle", font="Arial", size=49, text_color=$ffffff, lsp=-20, align=5, first_frame=1, last_frame=120, x=348, y=478).Blur(0,1)
this blurred the entire video, is there any way to make it blur only the subtitles and the box?
davidhorman
16th May 2007, 13:00
Thanks for the reply, I've tried it but didn't like the results
is there any way to make it blur only the subtitles and the box?
That's what my suggestion was intended to do. How did you implement it? What didn't you like about the result?
David
tomerb
16th May 2007, 13:15
That's what my suggestion was intended to do. How did you implement it? What didn't you like about the result?
David
yead, figured that's what you meant
I implemented it by simply duplicating the Subtitle() filter one pixel higher and one pixel lower
Blur() looks better
what i got was:
Subtitle("Subtitle", font="Arial", size=49, text_color=$ffffff, lsp=-20, align=5, first_frame=1, last_frame=120, x=348, y=477)
Subtitle("Subtitle", font="Arial", size=49, text_color=$ffffff, lsp=-20, align=5, first_frame=1, last_frame=120, x=348, y=479)
Subtitle("Subtitle", font="Arial", size=49, text_color=$ffffff, lsp=-20, align=5, first_frame=1, last_frame=120, x=348, y=478)
davidhorman
16th May 2007, 13:25
You only need to apply the subtitles twice, once in the normal position, and once either 1px higher or 1px lower.
You also need to apply the subtitles (and boxes) to separate clips which you later merge:
source=avisource("yourclip.avi")
# no need to bicubicresize your blankclip box:
box= BlankClip(width=586,height=99)
# note the changed y position of both box and subtitle in the second clip (b)
a = source.Overlay(box, mode="blend", opacity=0.4, x=60, y=438).Subtitle("My subtitle", font="Arial", size=49, text_color=$ffffff, lsp=-20, align=5, first_frame=1, last_frame=120, x=348, y=478)
b = source.Overlay(box, mode="blend", opacity=0.4, x=60, y=439).Subtitle("My subtitle", font="Arial", size=49, text_color=$ffffff, lsp=-20, align=5, first_frame=1, last_frame=120, x=348, y=479)
overlay(a,b,opacity=0.5)
If you have a lot of subtitles to apply, you could rewrite that as a function.
David
tomerb
16th May 2007, 17:46
You only need to apply the subtitles twice, once in the normal position, and once either 1px higher or 1px lower.
You also need to apply the subtitles (and boxes) to separate clips which you later merge:
source=avisource("yourclip.avi")
# no need to bicubicresize your blankclip box:
box= BlankClip(width=586,height=99)
# note the changed y position of both box and subtitle in the second clip (b)
a = source.Overlay(box, mode="blend", opacity=0.4, x=60, y=438).Subtitle("My subtitle", font="Arial", size=49, text_color=$ffffff, lsp=-20, align=5, first_frame=1, last_frame=120, x=348, y=478)
b = source.Overlay(box, mode="blend", opacity=0.4, x=60, y=439).Subtitle("My subtitle", font="Arial", size=49, text_color=$ffffff, lsp=-20, align=5, first_frame=1, last_frame=120, x=348, y=479)
overlay(a,b,opacity=0.5)
If you have a lot of subtitles to apply, you could rewrite that as a function.
David
Thanks alot for your replies, hope you wouldn't mind answering a couple of more questions
1. I'm using QTInput, adding even one layer (the semi-transparent box around the subtitles) takes the render out of realtime, I'm on a p4 2.4ghz and 1gb of ram, is it supposed to be this heavy?
2. is there any way to blur only one layer? (the subtitles layer) and not the entire video?
Ferux
23rd August 2007, 12:16
I'm doing full screen anti-aliasing for this. Resize your video to a much greater size, apply the subtitles and resize again to the desired smaler size. It works very well, but it's slow of course.
davidhorman
23rd August 2007, 12:43
I'm doing full screen anti-aliasing for this. Resize your video to a much greater size, apply the subtitles and resize again to the desired smaler size. It works very well, but it's slow of course.
Aliasing isn't really the problem - every subtitle plugin I've ever seen draws anti-aliasing fonts anyway. The problem is the flicker caused by "hard" graphics appearing in interlaced video, and I don't think your method would solve it (and, even if it did, it would affect the whole video).
2. is there any way to blur only one layer? (the subtitles layer) and not the entire video?
A bit late replying, but my script doesn't blur the video. The two clips that you merge have the video in the same position, so nothing changes ((a+a)/2=a ;) ). The subtitles are in slightly different positions, so they are effectively vertically blurred.
David
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.