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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 14th November 2017, 23:59   #1  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
ImageBorders & FrostyBorders Scripts

FrostyBorders

Added two new arguments, CropDAR and TCRatio, and in addition to the Avisynth version, FrostyBorders now comes in a VapourSynth flavour.
Support for resizing based on a sample aspect ratio in frame properties has been added to both versions.

FrostyBorders 2023-10-28.zip

Post #2 in this VideoHelp thread has instructions for running the Avisynth version of FrostyBorders automatically while watching any video in MPC-HC or MPC-BE.
The example syntax has been updated to make use of the new CropDAR and TCRatio arguments.
Post #3 has instructions for running the VapourSynth version of FrostyBorders automatically while watching any video in SMPlayer or MPV Player.
It includes updated screenshots to demonstrate the effect of the TCRatio argument.

The simplest way to use FrostyBorders is to specify a width and height, and the script resizes and adds FrostyBorders as required.
FrostyBorders(832,468)

You can also specify cropping, and for anamorphic sources, the appropriate input display aspect ratio or sample aspect ratio.
ie FrostyBorders(960,540, 6,4,-8,-2, InDAR=4.0/3.0)

Many of the border options can be mixed and matched. Below are some examples.
Brightness, contrast, saturation, blending, blurring, texture and temporal smoothing can be adjusted for most border types.

The original and default frosty borders.
FrostyBorders(832,468)




Feathering.
FrostyBorders(832,468, Feather=24)




Clone borders (type 1).
FrostyBorders(832,468, Clone=1)




Clone borders (type 3) with border divider.
FrostyBorders(832,468, Clone=3, BDivider=2)

(Sides of picture heavily cropped to demonstrate)



Static frosty borders.
FrostyBorders(832,468, FrostyStatic=8756)




Color borders with gradient.
FrostyBorders(720,540, FrostyGradient=true, BColor=color_teal)




Frosty border thumbnails








ImageBorders

ImageBorders 2021-12-09.zip

A function for adding images as borders to a video, rather than plain black borders.
Standard usage is to specify a width and height, and the image(s) to be used for the borders, and the script resizes and adds the image borders as required.

Border = ImageSource("Border.bmp")
ImageBorders(640,360, Border)




A = AVISource("Video.avi").Trim(476,476)
ImageBorders(640,360, A, Stretch=false)




A = ImageSource("Elvis1.png")
B = ImageSource("Elvis2.png")
ImageBorders(640,360, A, B, InDAR=4.0/3.0)

Picture courtesy of amaipaipai.


Last edited by hello_hello; 28th October 2023 at 21:55.
hello_hello is offline   Reply With Quote
Old 15th November 2017, 03:47   #2  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 940
Nifty! Thanks for this.
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
Sparktank is offline   Reply With Quote
Old 15th November 2017, 10:25   #3  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
My pleasure. If you follow the link at the top of the script referring to raffriff42, you'll find his version of the script with more options, and a second version around post #29, I think. Mine is also a little configurable, but the borders it creates are mainly configured to my taste, so raffriff42's scripts would also be worth a look.

Last edited by hello_hello; 15th November 2017 at 10:36.
hello_hello is offline   Reply With Quote
Old 16th November 2017, 14:51   #4  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,373
Quote:
Originally Posted by hello_hello View Post
If you follow the link at the top of the script referring to raffriff42, you'll find his version of the script with more options, and a second version around post #29, I think. Mine is also a little configurable, but the borders it creates are mainly configured to my taste, so raffriff42's scripts would also be worth a look.
Thanks hello_hello; likewise I'm sure. The newest link is here, and here is a short video clip. These effects don't encode well (due to the fixed-pattern noise); they're for live viewing.

And before somebody says it, yes, there is nothing wrong with plain black borders. These effects are just for fun - a little ambient light surround when viewing shows that aren't as widescreen as your monitor.
raffriff42 is offline   Reply With Quote
Old 16th November 2017, 18:08   #5  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
Quote:
Originally Posted by raffriff42 View Post
And before somebody says it, yes, there is nothing wrong with plain black borders. These effects are just for fun - a little ambient light surround when viewing shows that aren't as widescreen as your monitor.
Actually for Plasma owners such as myself, the coloured borders have a practical purpose. They should prevent the "burnt-in" look after watching a lot of video with black borders. It's not really burnt-in, as the effect disappears fairly quickly, but coloured borders will help the screen to age more evenly. The TV has a 4:3 mode with an option to create light grey borders itself, but they're fugly.

Previously I've zoomed to 16:9 and now I won't have to. I probably still will much of the time, but it's not compulsory any more.

Last edited by hello_hello; 16th November 2017 at 18:19.
hello_hello is offline   Reply With Quote
Old 22nd November 2017, 15:00   #6  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
Well it turns out I'm too stupid to use a computer.

When I fixed the resizing problem for the last version of the script I must have had a stupid and broke the ability to set a pixel aspect ratio. The script worked perfectly for square pixel sources, but for anamorphic sources it was stretching and squishing them.

While I was at it I also blatantly stole an idea from raffriff42 for checking the size of the borders, although rather than not add them, the script will add black borders instead until they reach 16 pixels wide each side, or top and bottom, when they'll turn frosty. Thanks raffriff42

The new version of my script it in the opening post.
hello_hello is offline   Reply With Quote
Old 15th February 2018, 01:43   #7  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
I made quite a few changes to the script and fixed a bug. Hopefully I didn't introduce any new ones.

- Fixed a silly that sometimes caused the script to throw an error when large top/bottom borders were added.

- Added "InDAR" option. For anamorphic sources a display aspect ratio can be specified for correct resizing rather than a pixel aspect ratio (although the latter option can still be used).
- Improved handling of anamorphic sources. The default width is now the width after resizing to square pixel dimensions and the default height is the source height, so the script can be used for resizing anamorphic sources simply by not specifying a width or height (or specifying zero for both).
- Added "Frosty" option. Frosty=false adds plain black or colored borders instead of FrostyBorders.
- Added a wrapper function called Borders() for adding plain borders. It has the same options as FrostyBorders().
Borders() is the same as FrostyBorders(Frosty=false)
- Added "BColor" option for specifying the color of borders when the script is adding plain black or colored borders.
- Increased the sensitivity to scene changes. The frosty borders should change instantly on most scene changes now.

- Removed the "Gradient" option as it didn't look very good.

When resizing, the script still uses the Avisynth resizer (Spline36Resize) to apply any sub-pixel cropping required for zero aspect error.

There's a link for the new version (2018-02-15) in the opening post.

Last edited by hello_hello; 6th March 2018 at 11:25.
hello_hello is offline   Reply With Quote
Old 18th July 2019, 01:45   #8  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
As I discovered the FastBlur plugin the other day, I thought I'd give it a spin blurring for the FrostyBorders function, and it was a big improvement. When the edges of the picture are "busy", the new version looks like this:





Whereas the old version looked like this:





The new version is also more configurable, giving more control over how the borders look. It's now also possible to specify a resizer rather than only being able to use the default.

For anyone who's downloaded it recently, I'll update the CropResize script again with the new version of FrostyBorders. Sometime soonish. The new version will be dated 2019-07-20 or later.

Last edited by hello_hello; 20th July 2019 at 13:22.
hello_hello is offline   Reply With Quote
Old 18th July 2019, 05:03   #9  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,902
Works like a charm. Thanks.

Code:
https://i.imgur.com/R3Bz2nR.jpg
4 : 3 original footage
16 : 9 frostyborders resize
FranceBB is offline   Reply With Quote
Old 18th July 2019, 05:16   #10  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 940
nice update!

"I love it when a plan comes together." ~Liam Neeson (the original was before my time)
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
Sparktank is offline   Reply With Quote
Old 19th July 2019, 02:00   #11  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
Does FastBlur() crash for anyone else when the width isn't mod8 for YV12 video? I think it's a bug because the height mod doesn't seem to matter.

Here's a version that enforces a mod8 output width and resizes the picture width to mod8 (cropping if required). That seemed the easiest way to ensure mod8 borders. There'll only be an error message if FrostyBorders are actually being added and the output width isn't mod8. the output width isn't restricted when plain borders are added. If the output width isn't mod16 the picture mightn't be centred as the borders have to be mod8 both sides. It depends if the picture itself ends up mod8 or mod16.
ie 104 left border and 112 right border, rather than 108 each side, as they could be for mod4 borders.

Link removed

Last edited by hello_hello; 19th July 2019 at 12:29.
hello_hello is offline   Reply With Quote
Old 19th July 2019, 12:29   #12  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
Well my OCD kicked in and I changed the "mod8" fix version a little. When FrostyBorders are being added to the sides the output width can be any mod and the script will adjust the borders and cropping as required to keep them mod8.
When FrostyBorders are being added top and bottom the output width needs to be mod8.
None of the above applies when adding plain borders.

I also tweaked a couple of things so there's a new version of the script without the mod8 width fix too. Hopefully the FastBlur bug will be fixed and the "normal" version of the script can be used again. Both new versions are dated 2019-07-19.

Link removed

Last edited by hello_hello; 20th July 2019 at 11:59.
hello_hello is offline   Reply With Quote
Old 20th July 2019, 02:23   #13  |  Link
BetA13
cosmic entity
 
BetA13's Avatar
 
Join Date: May 2011
Location: outside the Box
Posts: 258
ok, please dont laugh...

Could someone point me to an tutorial or have an short explonation how i would use this with, lets say mpchc or potplayer?
i tried via ffdshow´s avisynth but that one does not reconize AVSI files.. and if i force select it, nothing happens...

i really think this is a very cool solution for people having 16:10 monitors...

Thanks..
BetA13 is offline   Reply With Quote
Old 20th July 2019, 12:11   #14  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
So it turns out the FastBlur mod8 width problem only effects CPUs that don't support SSE4.1 (FastBlur 0.1).

I don't know why I didn't do it originally, but the "mod8 width fix" version of FrostyBorders now pads the borders to mod8 if need be, blurs them, then crops them back to the original width. The output should be the same as the standard version of the script and there's no longer any output width or height restrictions.

Both versions of the script are in the zip file in the opening post, now dated 2019-07-20.

Last edited by hello_hello; 21st July 2019 at 14:59.
hello_hello is offline   Reply With Quote
Old 20th July 2019, 12:45   #15  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
Quote:
Originally Posted by BetA13 View Post
ok, please dont laugh...

Could someone point me to an tutorial or have an short explonation how i would use this with, lets say mpchc or potplayer?
i tried via ffdshow´s avisynth but that one does not reconize AVSI files.. and if i force select it, nothing happens...

i really think this is a very cool solution for people having 16:10 monitors...

Thanks..
Put FrostyBorders.avsi in the Avisynth plugins folder, along with FastBlur.dll and AddGrainC.dll. It's somewhere like

C:\Program Files\AviSynth\plugins

Add the following to ffdshow's Avisynth filter.

Code:
#Crop(0, 0, 0, 0)
HMax = 720
H = min(HMax, height(last))
W = floor(H * 16.0 / 9.0 / 4.0) * 4
FrostyBorders(W, H)
HMax is the maximum height. If the video height exceeds that, it'll be resized down. Set it to whatever you prefer.
Change "9.0" in the 4th line to "10.0" if you have a 16:10 monitor.
If the edges of the video aren't clean (there's a bit of black at the sides etc), remove "#" from the Crop line and add the required cropping to clean the edges. Something like Crop(4, 0, -4, 0), or whatever it needs.

Use the version dated 2019-07-20. Not long ago I changed it so the borders are created after the video is resized (if it's resized) so if you reduce the resolution it should be a bit faster. Previously the script created the borders from the source (at least partly), then did the resizing. I can't remember exactly when I changed it off the top of my head, so use the latest one.

Last edited by hello_hello; 21st July 2019 at 21:43.
hello_hello is offline   Reply With Quote
Old 20th July 2019, 15:26   #16  |  Link
BetA13
cosmic entity
 
BetA13's Avatar
 
Join Date: May 2011
Location: outside the Box
Posts: 258
Thank you very much Sir...
Will try that as soon as i get back to my PC..

Have a wonderull evening...
BetA13 is offline   Reply With Quote
Old 21st July 2019, 09:32   #17  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,902
Quote:
Originally Posted by BetA13 View Post
ok, please dont laugh...

Could someone point me to an tutorial or have an short explonation how i would use this with, lets say mpchc or potplayer?
i tried via ffdshow´s avisynth but that one does not reconize AVSI files.. and if i force select it, nothing happens...

i really think this is a very cool solution for people having 16:10 monitors...

Thanks..
It's gonna work with MPC and similar, but I'm not sure whether it's gonna work with PotPlayer or not, 'cause if I remember correctly PotPlayer rendering engine doesn't like when Avisynth resizes the picture before it outputs it, making the whole program crash, which was the reason why my VideoTek was unusable live on PotPlayer.
FranceBB is offline   Reply With Quote
Old 21st July 2019, 23:49   #18  |  Link
BetA13
cosmic entity
 
BetA13's Avatar
 
Join Date: May 2011
Location: outside the Box
Posts: 258
Using it with Mpc hc anyway
And it works really well, looks nice and fills all the screen perfectly..

Screen:
Top / Bottom
https://i.imgur.com/CE3nxCU.jpg
Sides
https://i.imgur.com/2dPGEUU.png


Performance wise? Well, for an i5 or i7 it should be unsicnificant.
But for me, with an ancient Q9550 Core2Quad (@4Ghz), it uses about 20% CPU when activated. I guess its time for an Upgrade.. maybe an cheap mid range intel if they drop prices, also the AMD 3600 looks pretty decent..

Anyway, youtube videos never looked this nice on my little 16:10 Monitor..

Thanks again for the Help

@FranceBB
nice tool from what it looks like...

Last edited by BetA13; 22nd July 2019 at 00:20.
BetA13 is offline   Reply With Quote
Old 22nd July 2019, 00:31   #19  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,496
Quote:
Originally Posted by BetA13 View Post
What is that?
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 22nd July 2019, 02:02   #20  |  Link
BetA13
cosmic entity
 
BetA13's Avatar
 
Join Date: May 2011
Location: outside the Box
Posts: 258
haha...

That my dear Sir is: "The Thing From Another World (1951)"
The Original "The Thing"..

Sadly in an bad Quality, i know..

Greetz

Last edited by BetA13; 22nd July 2019 at 02:06.
BetA13 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 23:56.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.