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 31st December 2024, 03:16   #81  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,981
You're welcome.

I've been watching some 4:3 animation with the updated borders and they're much better for that. Because animation has lots of areas of a single color, they were prone to changing too quickly when something with a sold color got too close to the edge of the picture, but they're much better now. Changing them was a good idea, and something I should have thought of myself, although the way they were created was left-over from the days before FastBur existed and the blurring was done with a resizer.
hello_hello is offline   Reply With Quote
Old 6th January 2025, 16:32   #82  |  Link
flossy_cake
Registered User
 
Join Date: Aug 2016
Posts: 804
In the end I still found myself subjectively preferring

Code:
FrostyBorders(Clone=1, Blur=height/18, VBlur=height/18, Cont=0.5, TSoft=7, InDAR=0.0)
But then I came up with this based on your previous code and now it is my new favourite - brightness stability and no temporal softening required

Code:
Video = last.LanczosResize(720,540)
FastBlur(200,100,3,dither=true)
Overlay(FlipHorizontal(), Opacity=0.5)
StackHorizontal(Crop(0,0,-600,0), Crop(600,0,0,0))
ConvertBits(dither=1, dither_bits=6)
AddGrainC(8, constant=true)	 # can be reduced to 4/2 or removed if desired - still minimal posterisation
Tweak(Cont=0.5, dither_strength=10.0)
CLR = 8 # pixels to crop off left and right
StackHorizontal(Crop(0,0,-120+CLR,0), Video.Crop(CLR,0,-CLR ,0), Crop(120-CLR ,0,0,0))
I reckon the above would be worth having as a separate Clone mode like maybe Clone=4 or something like that, cause I really like the result it's just so brightness stable and no posterisation

Last edited by flossy_cake; 6th January 2025 at 17:04.
flossy_cake is offline   Reply With Quote
Old 11th January 2025, 19:48   #83  |  Link
flossy_cake
Registered User
 
Join Date: Aug 2016
Posts: 804
Quote:
Originally Posted by flossy_cake View Post
But then I came up with this based on your previous code and now it is my new favourite - brightness stability and no temporal softening required

Code:
Video = last.LanczosResize(720,540)
FastBlur(200,100,3,dither=true)
Overlay(FlipHorizontal(), Opacity=0.5)
StackHorizontal(Crop(0,0,-600,0), Crop(600,0,0,0))
ConvertBits(dither=1, dither_bits=6)
AddGrainC(8, constant=true)	 # can be reduced to 4/2 or removed if desired - still minimal posterisation
Tweak(Cont=0.5, dither_strength=10.0)
CLR = 8 # pixels to crop off left and right
StackHorizontal(Crop(0,0,-120+CLR,0), Video.Crop(CLR,0,-CLR ,0), Crop(120-CLR ,0,0,0))
Nope, turns out that was just a fluke and the borders are only stable when the source clip already has these thin 8px pillarbox on either side. If I crop them off first and use that as the source for the blurred borders then I get too much brightness fluctuations in the borders again. No idea why that is happening, but maybe it can be exploited
flossy_cake is offline   Reply With Quote
Old 14th January 2025, 06:37   #84  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,981
The brightness fluctuations, at least for the default borders, are caused by something brighter than the majority of the picture getting too close to one of the sides. The only way to settle it down is to blur more of the picture into the borders so it averages out more, or limit the contrast etc, as the picture cropped from the sides for the borders isn't very wide, maybe only 16 pixels worth for a SD source. Those 16 pixels are then stretched to the border width, so if the edge of the picture changes it can potentially change the border brightness quite a lot.

For your script above, line 4 should give you a 240 pixel wide video.
StackHorizontal(Crop(0,0,-600,0), Crop(600,0,0,0))
The last line really just splits the borders in half and joins them back together, if you ignore the 8 pixels of cropping.
By that I mean.... this:

StackHorizontal(Crop(0,0,-600,0), Video, Crop(600,0,0,0))

produces the same output as this:

StackHorizontal(Crop(0,0,-600,0), Crop(600,0,0,0))
StackHorizontal(Crop(0,0,-120,0), Video, Crop(120 ,0,0,0))

So you know, there was only one reason to crop the video for the borders twice, and that was to apply temporal softening, because TemporalSoften can't detect scene changes accurately when it's only softening the borders. The more of the picture it sees, the more accurate it's scene change detection can be. So, the idea was to crop enough for TemporalSoften to detect scene changes accurately without it having to soften the entire picture, as that's the slow part of the process, and then crop again to take the pixels for the borders. In other words, if you're not temporal softening you probably only need to crop once.

This is probably closer to the amount of picture actually used for the default borders (assuming the source width is 720). I only cropped each border once as I didn't include TemporalSoften. Thinking about it, if you blend with Opacity=0.5 there's no need to crop both left and right borders because they'll be the same anyway. You could just crop one side of the picture and resize it appropriately for each border, assuming they're not always the same width.

Code:
Video = last.LanczosResize(720,540)

Video.FastBlur(30,54,3,dither=true)
Overlay(FlipHorizontal(), Opacity=0.2)

Left = Crop(0,0,-704,0).Tweak(Cont=1.0, dither_strength=10.0).ConvertBits(dither=1, dither_bits=6)
Right = Crop(704,0,0,0).Tweak(Cont=1.0, dither_strength=10.0).ConvertBits(dither=1, dither_bits=6)

Left = Left.GaussResize(120,540).AddGrainC(8, constant=true)
Right = Right.GaussResize(120,540).AddGrainC(8, constant=true)

StackHorizontal(Left, Video, Right)
https://i.postimg.cc/KYK7nNvL/A.png

Also, if there's pixels of black at the sides that need to be cropped, it's probably easier/safer to crop them first. That way they can't be blurred into the borders. Something like this would be similar to what the function does when it's cropping.

Code:
Video = last.LanczosResize(720,540).Crop(8,0,-8,0)

Video.FastBlur(200,100,3,dither=true)
Overlay(FlipHorizontal(), Opacity=0.2)

Left = Crop(0,0,-696,0).Tweak(Cont=1.0, dither_strength=10.0).ConvertBits(dither=1, dither_bits=6)
Right = Crop(696,0,0,0).Tweak(Cont=1.0, dither_strength=10.0).ConvertBits(dither=1, dither_bits=6)

Left = Left.GaussResize(128,540).AddGrainC(8, constant=true)
Right = Right.GaussResize(128,540).AddGrainC(8, constant=true)

StackHorizontal(Left, Video, Right)
Taking more picture to create the borders (cropping more) probably won't fix the brightness fluctuation problem though, because it'll just move the picture edge that can potentially cause fluctuations closer to the center. Increasing the blurring does the same thing to a certain extent too, so there's not really a perfect solution, although at least lots of blurring averages out the color a fair bit.

Same as the first script, only with a bucket load of blurring.

Code:
Video = last.LanczosResize(720,540)

Video.FastBlur(200,100,3,dither=true)
Overlay(FlipHorizontal(), Opacity=0.2)

Left = Crop(0,0,-704,0).Tweak(Cont=1.0, dither_strength=10.0).ConvertBits(dither=1, dither_bits=6)
Right = Crop(704,0,0,0).Tweak(Cont=1.0, dither_strength=10.0).ConvertBits(dither=1, dither_bits=6)

Left = Left.GaussResize(120,540).AddGrainC(8, constant=true)
Right = Right.GaussResize(120,540).AddGrainC(8, constant=true)

StackHorizontal(Left, Video, Right)
https://i.postimg.cc/jSS4jTpM/2.png

I'm not a fan of blending the borders together completely. I think it looks a bit more natural if they're a little independent, but that's just me. It's why I changed the default for Blend to 0.1 for the last version, to help compensate for the extra blurring making the borders less dynamic.

For the record, not everyone was excited about the changes to the border defaults.
https://forum.videohelp.com/threads/...e7#post2762998

I completely forgot that Tweak() was given the ability to dither. I should have been using it.
Anyway, if you find something else you like I'm happy to try it.

Cheers.

Last edited by hello_hello; 14th January 2025 at 17:07.
hello_hello is offline   Reply With Quote
Old 14th January 2025, 22:22   #85  |  Link
flossy_cake
Registered User
 
Join Date: Aug 2016
Posts: 804
Quote:
Originally Posted by hello_hello View Post
TemporalSoften can't detect scene changes accurately when it's only softening the borders. The more of the picture it sees, the more accurate it's scene change detection can be.
Yeah I noticed that too. Lowering the scenechange thresh to 10 seems to help but I think it's going to have some false negatives and temporally soften over the scene change making it visually distracting, although this would tend to happen on scenechanges where there isn't much luma diff to the next scene so the distraction factor was less than anticipated.

It seems that doing the temporal soften on the blurred borders suppresses brightness fluctuations the most though, versus doing it to the whole frame before the blur.
flossy_cake is offline   Reply With Quote
Old 26th January 2025, 21:53   #86  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,981
There's a link for FrostyBorders 2025-01-26 in the opening post.

The main change is the addition of a Gamma argument for adjusting the gamma of the borders (reducing the gamma to darken the borders seems to work better than reducing the brightness and contrast, at least to me).

For the VapourSynth version the Bright argument now auto-scales according to bitdepth (I had foolishly assumed the Tweak function I borrowed from adjust.py would auto-scale as Avisynth's Tweak does).

Last edited by hello_hello; 27th January 2025 at 18:22.
hello_hello 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 15:28.


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