PDA

View Full Version : Soft black borders?


Comatose
17th October 2008, 08:07
Is there an easy way to create soft black borders in Avisynth, like the ones used on TV and DVD for the overscan?

Mystery Keeper
17th October 2008, 10:53
In Photoshop I would use gaussian blur on edges for it.

IanB
17th October 2008, 13:12
BorderControl (http://avisynth.org/warpenterprises/files/bordercontrol_25_dll_20030216.zip) by SiWalters.

Comatose
17th October 2008, 13:22
Thanks!

Didée
17th October 2008, 14:10
In case you find any kind of issue with bordercontrol, here's a script with some suggestions:
source = last
dummy = blankclip(source,color=$FFFFFF)

source = source.addborders(16,0,16,0)
dummy = dummy.addborders(16,0,16,0)

# different variants of blurring
#dummy = dummy.mt_deflate().mt_deflate().mt_deflate().mt_deflate().blur(1).blur(1)
#dummy = dummy.mt_deflate().mt_deflate().mt_deflate().mt_deflate().mt_deflate().mt_deflate().mt_deflate().mt_deflate()
#dummy = dummy.mt_inpand().blur(1).blur(1).blur(1).blur(1)
dummy=dummy.mt_inpand().gaussresize(source.width,source.height,0,0,source.width-.001,source.height,p=2)

dummy = dummy.trim(1,1).loop(source.framecount())

#mt_logic(source,dummy,"min",U=2,V=2)
mt_merge(blankclip(source),source,dummy,luma=true,U=3,V=3)

(Assumes that MaskTools are allowed, and your source is in YV12.)

Didée
17th October 2008, 18:56
http://img356.imageshack.us/img356/899/addbordersbordercontrolji0.png (http://imageshack.us)

In words: To get a "proper" result with BorderControl, you first need to upsize your clip 2x with pointresize, then add the according black borders (2x), then do BorderControl(), then pointresize down again.

BorderControl could need some revisting. It supports "only" YUY2, too.

Comatose
20th November 2008, 16:31
I prefer yours to BorderControl because of the simplicity [of usage] :)

Thanks for another awesome script, Didée!

2Bdecided
20th November 2008, 16:49
I haven't noticed TV using soft borders for the "overscan" - modern content lights up every pixel, archive stuff has fairly sharp 8 pixel borders.

Cheers,
David.

Comatose
20th November 2008, 18:37
Yes, but here in Israel we still have analog (and STB-based) SDTV, and they all have soft borders. Can't really consider this modern :P

In any case, I have another issue now... I was under the impression that TVs crop 8 pixels from left and right (so the actual resolution is only 704x576), but I guess that only applies to NTSC and 704x480, because I prepared a PAL test DVD (just a VOB, really) and with 8 pixels on each side - part of the image was still being cropped.

A Conversion Table for Digital Video Formats (http://lipas.uwasa.fi/~f76998/video/conversion/#conversion_table) says the actual resolution is only 702x576... even though it looks like more than 2 extra pixels are being cropped (both on a Samsung 720p HDTV and a Sony interlaced CRT).
Does anybody know for sure? :/

Also, I'm not sure how I could use Didée's script on 702x394 or 702x395 (originally used 704x396 padded to 720x576), because it requires mod4 width (because of YV12), and 702 isn't mod4 >_>

Thanks!

edit: As far as I can see (http://img1.hugeup.com/f/11202008/fc6ada0776.jpg), they add 10 on the left side and 8 on the right side, which reinforces the 702x576 stated in the conversion table... now the only problem is figuring out a way to use it despite the mod4 issue ;-;

2Bdecided
20th November 2008, 21:21
You won't see all 720 or 704 or 702 (or 576!) pixels on your TV - typical overscan is 5%-10%. So ~630 pixels, if you're lucky.

Only modern TVs overscan less, and often only in HD, and sometimes only if you force them to reduce the default overscan.

How much picture you see at the sides on a 16x9 HDTV displaying an 4x3 analogue source (and what shape it appears!) depends entirely on the TV settings.

Cheers,
David.

P.S. I ignore the difference between 702 and 704 - it's insignificant and a real pain to work with. You can correctly argue that digital "PAL" is 704x576 anyway. Analogue PAL was 702x575. (Really!).

Comatose
20th November 2008, 22:06
The problem I had was there are subtitles about 10 pixels away from the left edge, which got cut off. (they're there because there are credits running on the right side of the screen)
I guess I'll just have to push them further away from the edge, and limit the rendering window for subtitles in the future.

Thanks :P

2Bdecided
21st November 2008, 00:37
Most NLEs have a "title safe" area marker at 10% into the screen on all sides.

Cheers,
David.