Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
|
Thread Tools | Search this Thread | Display Modes |
21st May 2005, 23:19 | #1 | Link |
Registered User
Join Date: Nov 2001
Posts: 9,770
|
Using DeKafka for removing hardburned subtitles question
i played around with dekafka for removing hardburned subtitles
i somehow dont really get what the sense of substracting -2 in the following lines is (and why ybot and xright dont get 2 removed too): Code:
topline = clip.Crop(Xstart-2, ytop-2, X, 2) bottomline = clip.Crop(Xstart-2, ybot, X, 2) leftline = clip.Crop(xleft-2, ytop-2, 2, Y) rightline = clip.Crop(xright, ytop-2, 2, Y) i adopted the script for not having to provide a maskclip and for not having the pic moved to the right for 2 pixels: Code:
function dekafka(clip clip, int Xstart, int Ystart, int X, int Y, int Amount) { ytop = Ystart ybot = Ystart + Y xleft = Xstart xright = Xstart + X topline = clip.Crop(Xstart, ytop-2, X, 2) bottomline = clip.Crop(Xstart, ybot, X, 2) leftline = clip.Crop(xleft-2, ytop-2, 2, Y) rightline = clip.Crop(xright, ytop-2, 2, Y) logosrc_hor = StackVertical(topline, bottomline).Blur(1.58).BilinearResize(X, Y) logosrc_ver = StackHorizontal(leftline, rightline).Blur(1.58).BilinearResize(X, Y) Amount2 = (Y>=2*X) ? 255 : 128*Y/X # Amount2 is small if X >> Y => logoscr_hor is dominant logosrc = Layer(logosrc_hor, logosrc_ver, "add", Amount2) clip = clip.Layer(logosrc, "add", Amount, Xstart, Ystart) return clip }
__________________
Between the weak and the strong one it is the freedom which oppresses and the law that liberates (Jean Jacques Rousseau) I know, that I know nothing (Socrates) MPEG-4 ASP FAQ | AVC/H.264 FAQ | AAC FAQ | MP4 FAQ | MP4Menu stores DVD Menus in MP4 (guide) Ogg Theora | Ogg Vorbis use WM9 today and get Micro$oft controlling the A/V market tomorrow for free Last edited by bond; 22nd May 2005 at 13:01. |
22nd May 2005, 12:12 | #2 | Link |
Registered User
Join Date: Oct 2001
Location: Lands of confusion
Posts: 1,217
|
See this: http://forum.doom9.org/showthread.php?s=&threadid=94711
There is small error in Dekafka beside that shift, for example at blurs - it should be so: logosrc_hor = StackVertical(topline, bottomline).Blur(0, 1.58).BilinearResize(X, Y) logosrc_ver = StackHorizontal(leftline, rightline).Blur(1.58, 0).BilinearResize(X, Y) But, I think that blurring does not much impromevent. And is buggy in YUY2. In case of covering subtitles, I think that no need to crop left and right sides. Script would be like this, but I make it 'on fly' function desubt(clip) { #Position & size & Opacity - enter here values by subtitle position and size Xp = 88 Yp = 288 X = 448 #Must be dividable by 4 Y = 66 Op = 255 #By need: #clip = clip.ConvertToYUY2() top = clip.Crop(Xp, Yp-2, X, 2) bot = clip.Crop(Xp, Yp+Y, X, 2) #logoh = StackVertical(top, bot).BilinearResize(X, Y) logoh = StackVertical(top, bot).Blur(0.2, 1.58).BilinearResize(X, Y) #logoh = StackVertical(top, bot).ConvertToRGB32.Blur(0.2, 1.58).BilinearResize(X, Y).ConvertBackToYUY2() clip = clip.Layer(logoh, "add", Op, Xp, Yp) return clip } In case of green artifacts by blur use line above or line under, where colorspace is temporarely converted to RGB, only because of blur.
__________________
Informational value of an advert is in inverted proportion to beauty of playing model(s)/actress(es) Last edited by ppera2; 22nd May 2005 at 12:19. |
22nd May 2005, 14:21 | #3 | Link | ||||
Registered User
Join Date: Nov 2001
Posts: 9,770
|
hi ppera2, thanks for your answer and tips
Quote:
two things on your comments on blur(): Quote:
when using blur the transition is more smoother and the filtered part fits more the rest of the picture Quote:
i would say that therefore a full vertical blur with a slight horizontal should be used (as tradeoff between smoothing too much and reducing line-creation) for removing bigger parts of a picture, like in the case of subs removal Quote:
i mean using rgb would have the advantage that you can also choose the to-be-removed part more accurately, as you can than crop also in steps of 1 does converting to rgb (and back again if necessary) really take that much extra time? lemme modify the script the following way: Code:
function DeSubt(clip clip, int horizontal_position, int vertical_position, int width, int height) { clip = clip.ConvertToRGB() top = clip.crop(horizontal_position, vertical_position-2, width, 2) bottom = clip.crop(horizontal_position, vertical_position+height, width, 2) mask = StackVertical(top,bottom).Blur(0.5,1.58).BilinearResize(width,height) clip = clip.Layer(mask, "add", 255, horizontal_position, vertical_position) return clip }
__________________
Between the weak and the strong one it is the freedom which oppresses and the law that liberates (Jean Jacques Rousseau) I know, that I know nothing (Socrates) MPEG-4 ASP FAQ | AVC/H.264 FAQ | AAC FAQ | MP4 FAQ | MP4Menu stores DVD Menus in MP4 (guide) Ogg Theora | Ogg Vorbis use WM9 today and get Micro$oft controlling the A/V market tomorrow for free |
||||
22nd May 2005, 17:30 | #4 | Link |
Registered User
Join Date: Oct 2001
Location: Lands of confusion
Posts: 1,217
|
Blur improvents visual quality, but by my opinion just slightly, so it's matter of taste - use it, and how much blur.
I observed artifacts only by YUY2 blurring, and it's best viewable on B/W captures. Maybe should to contact AVS development team about it... I looked for some external blur filters, but didn't find usable until now. Reason why I modified DeKafka is right RGB conversion. It slows it, because whole clip is converted. When converting only mask part it is much less CPU time consuming. Other reason was that colorspace conversions make some color distorsions. Don't see that unablity to use odd values by YUY2 is big problem - one line more means nothing. And: how long names using in scripts (programs) is also matter of taste. I don't like too long names, but like long comments (not to write )
__________________
Informational value of an advert is in inverted proportion to beauty of playing model(s)/actress(es) |
|
|