VideoHelp Forum
+ Reply to Thread
Page 1 of 5
1 2 3 ... LastLast
Results 1 to 30 of 146
Thread
  1. 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 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 Oct 2023 at 17:06.
    Quote Quote  
  2. Running Avisynth FrostyBorders automatically while watching any video in MPC-HC or MPC-BE

    FFDShow's Avisynth filter only supports 8 bit video and I believe the same applies to PotPlayer's Avisynth filter (at the time this post was updated).


    I'm mostly running Linux these days, but I have Windows 11 installed in a virtual machine, so I'm running MPC-BE that way for the screenshots below.

    You need to have Avisynth+ installed, with the ForstyBorders function and the FastBlur and AddGrainC plugins in the Avisynth+ plugins folder (plugins+ or plugins64+ for 64 bit Avisynth+). Everything in the chain from Avisynth+ to the media player all must be 64 bit, or all 32 bit. You can't mix them.

    Download ffdshow and install the "ffdshow raw video filter".
    https://www.videohelp.com/software/ffdshow
    You can install all of the ffdshow goodies if you like, but the raw video filter is all you need, and if you add it the following way, it'll only run for MPC-HC/MPC-BE.

    In MPC-HC/MPC-BE Options/External Filters, add the ffdshow raw video filter and set it to "Prefer".

    Image
    [Attachment 71079 - Click to enlarge]


    Double click on the filter itself to open the ffdshow preferences. Towards the top there's a "Tray, dialog & paths" section where you can disable the ffdshow system tray icon while it's running if you want to.

    Enable the ffdshow Avisynth filter and add FrostyBorders to it, specifying your monitor's resolution, or, if most of the video you watch is of a lower resolution, specify that resolution instead and let the player do the up-scaling as it normally would when running full screen.

    CropDAR and TCRatio arguments have been added to FrostyBorders 2023-09-25.

    The example below, which would be pasted into FFDShow's Avisynth filter, includes syntax for automatically adjusting the CropDAR.

    When CropDAR is cropping the height to minimize the size of the pillarbox borders, effectively zooming in, TCRatio=0.3 causes only 30% of the height cropping to be cropped from the top while the remaining 70% is cropped from the bottom. This reduces the chances of the top of people's heads being unnaturally cropped, and for 4:3 video, the important parts of the picture tend to be located slightly above the middle of the frame anyway (post #3 contains screenshots showing height cropping with and without the TCRatio argument).
    FrostyBorders in the example below is configured to always crop two pixels from the left and right, as even HD video tends to have a pixel or two of crud on the sides that shouldn't contribute to creating the borders.
    CropDAR will crop the sides if necessary to prevent the DAR exceeding 2:1 and it'll crop the height if necessary to prevent the DAR being less than 1.4:1.

    Edit: New version of the syntax below to work properly with anamorphic video.
    An appropriate sample aspect ratio must be specified for anamorphic video.

    Code:
    clip = last
    
    W = width(clip)
    H = height(clip)
    
    # If the source is anamorphic the correct pixel/sample aspect ratio must
    # be specified instead of undefined(). For example, 64.0/45.0 for a PAL 16:9 DVD.
    # SAR must be float (not an integer)
    
    SAR = undefined()
    
    SAR = defined(SAR) && !IsInt(SAR) && IsFloat(SAR) && (SAR > 0) ? SAR : 1.0
    
    # Cropping
    # CR and CB must be negative (or zero)
    
    CL = 2
    CT = 2
    CR = -2
    CB = -2
    
    VideoDAR = float(W - CL + CR) / float(H - CT + CB) * SAR
    CropDAR = (VideoDAR > 2.0) ? 2.0 : (VideoDAR > (14.0 / 9.0)) ? 0 : (VideoDAR > 1.3) ? 14.0 / 9.0 : 7.0 / 5.0
    
    (VideoDAR < (16.0 / 9.0)) ? Eval("""
    
    NewH = (H > 900) ? 1080 : (H > 720) ? 900 : (H > 540) ? 720 : (H > 396) ? 540 : 396
    NewW = round(NewH * 16.0 / 9.0)
    
    """) : Eval("""
    
    NewW = (W > 1600) ? 1920 : (W > 1280) ? 1600 : (W > 960) ? 1280 : (W > 704) ? 960 : 704
    NewH = round(NewW * 9.0 / 16.0)
    
    """)
    
    return (1.75 <= VideoDAR <= 1.8) ? \
    ((SAR == 1) ? clip : FrostyBorders(0,H, CL,CT,CR,CB, InSAR=SAR, CropDAR=CropDAR, TCRatio=0.3)) : \
    FrostyBorders(NewW,NewH, CL,CT,CR,CB, InSAR=SAR, CropDAR=CropDAR, TCRatio=0.3)
    If most of the video you watch is 720p, you could use 720 as the height instead (while setting the width to 1280 or according to the aspect ratio of your display) and let the player upscale as it normally would when running full-screen. It's probably only necessary for older/slower PCs though.

    Aside from the dimensions, the ffdshow Avisynth filter should look like the screenshot below (edit: it's an old screenshot that hasn't been updated to include the syntax above). FrostyBorders only supports YV12, so disable the other formats, and make sure the Buffer checkbox is checked. I'm running VirtualBox on a 1080p display so for me 1920x998 is full screen, inside VirtualBox. It's commented out here in the screenshot, but you could also try adding Prefetch to enable Avisynth+'s multi-threading. My experience is it's better not to enable multi-threading, but your mileage may differ.

    Image
    [Attachment 71083 - Click to enlarge]


    And hopefully that's it. You could use two MPC-HC or MPC-BE installs.... an extra portable version and the standard one. That way you can setup FrostyBorders in just one, create a shortcut to each and run the appropriate one, rather than have to mess around enabling and disabling the ffdshow filter, although if the system tray icon is enabled, it's pretty easy to do while a video is playing.

    MPC-BE with FrostyBorders running inside VirtualBox.

    Image
    [Attachment 71081 - Click to enlarge]


    Fullscreen inside VirtualBox.

    Image
    [Attachment 71082 - Click to enlarge]


    FrostyBorders (both Avisynth and Vapoursynth versions) can apply the CropDAR and TCRatio arguments without having to add borders.
    When OutWidth=0 (unspecified) the video is cropped and resized according to the specified height.
    When OutHeight=0 (unspecified) the video is cropped and resized according to the specified width.
    Last edited by hello_hello; 6th Dec 2023 at 02:16.
    Quote Quote  
  3. Running VapourSynth FrostyBorders automatically while watching any video in SMPlayer or MPV Player (MPV must be built with VapourSynth support enabled)

    ---------------------------------------------------------------------------------

    There's always something....
    Unfortunately when FrostyBorders is adding plain borders it doesn't work correctly with MPV Player or SMPlayer (at least on my Linux system).
    Plain borders are added instead of another type of border when the border size is less than than minimum required. For the original frosty borders, the minimum size is 16 pixels. For smaller borders, the function automatically switches to adding plain borders.

    The issue seems to be caused by the fact that FrostyBorders doesn't use AddBorders() to add plain borders. Instead it creates blank clips to add as borders (because grain and texture can be applied to plain borders and must be applied to the borders separately). Adding blank clips to the picture with StackVertical or StackHorizontal seems to cause a problem for MPV relating to video timestamps I don't fully understand. To work around the problem, the example syntax below bypasses the FrostyBorders function entirely when the source DAR is very close to 16:9, which means instead of FrostyBorders switching to plain black borders automatically for video where the borders would be less than 16 pixels in size, the player will add them instead (as it normally would when running in full screen mode). For a display with a DAR other than 16:9, the DAR range for bypassing the FrostyBorders function needs to be adjusted accordingly.


    ---------------------------------------------------------------------------------

    Vapoursynth scripts can be loaded as a video filter by MPV, assuming MPV has been built with VapourSynth support. For the example in this post, the script below would be saved as Frosty.py

    CropDAR and TCRatio arguments have been added to FrostyBorders 2023-09-25.

    The script below includes syntax for automatically adjusting the CropDAR.
    When CropDAR is cropping the height to minimize the size of any pillarbox borders, TCRatio=0.3 causes only 30% of the height cropping to be cropped from the top while the remaining 70% is cropped from the bottom. This reduces the chances of the top of people's heads being unnaturally cropped, and for 4:3 video the important parts of the picture tend to be located slightly above the middle of the frame anyway.

    FrostyBorders in the example below is configured to always crop two pixels from the left and right, as even HD video tends to have a pixel or two of crud on the sides that shouldn't contribute to creating the borders.
    CropDAR will crop the sides if necessary to prevent the DAR exceeding 2:1 and it'll crop the height if necessary to prevent the DAR being less than 1.4:1.
    FrostyBorders is bypassed entirely for video with a DAR between 1.75:1 and 1.8:1 to work around the problem described above (in blue text). That range should be okay when FrostyBorders is resizing to 1280x720, and could probably be reduced when resizing to a higher resolution. If FrostyBorders is resizing to a lower resolution the range should be increased a little. For 960x540 resizing as an example, the range should probably be at least 1.7 to 1.9.

    Edit: New version of the script below to work properly with anamorphic video.
    An appropriate sample aspect ratio must be specified for anamorphic video.
    There's also two lines that can be uncommented for converting HBD video to 8 bit for an 8 bit display,
    making the FrostyBorders display as expected.

    Code:
    import vapoursynth as vs
    core = vs.core
    import FrostyBorders as fb
    
    clip = video_in
    
    W = clip.width
    H = clip.height
    Source_Bits = clip.format.bits_per_sample
    
    # If the source is anamorphic the correct pixel/sample aspect ratio must
    # be specified instead of None. For example, 64/45 for a PAL 16:9 DVD.
    
    SAR = None
    
    SAR = SAR if (SAR is not None) and (SAR > 0) else 1
    
    # Cropping
    # All values must be positive
    
    CL = 2
    CR = 2
    CT = 2
    CB = 2
    
    VideoDAR = (W - CL - CR) / (H - CT - CB) * SAR
    CropDAR = 2 if (VideoDAR > 2) else 0 if (VideoDAR > (14 / 9)) else 14 / 9 if (VideoDAR > 1.3) else 7 / 5
    
    if (VideoDAR < (16 / 9)):
    
        NewH = 1080 if (H > 900) else 900 if (H > 720) else 720 if (H > 540) else 540 if (H > 396) else 396
        NewW = round(NewH * 16 / 9)
    
    else:
    
        NewW = 1920 if (W > 1600) else 1600 if (W > 1280) else 1280 if (W > 960) else 960 if (W > 704) else 704
        NewH = round(NewW * 9 / 16)
    
    # If your display is 8 bit, uncomment the following two lines to convert the video to 8 bit.
    
    #clip = clip if (Source_Bits == 8) or ((1.75 <= VideoDAR <= 1.8) and (SAR == 1)) else \
    #  clip.resize.Bicubic(format=vs.YUV420P8)
    
    clip = clip if (1.75 <= VideoDAR <= 1.8) and (SAR == 1) else \
      fb.FrostyBorders(clip, 0,H, CL,CR,CT,CB, InSAR=SAR, CropDAR=CropDAR, TCRatio=0.3) \
      if (1.75 <= VideoDAR <= 1.8) else \
      fb.FrostyBorders(clip, NewW,NewH, CL,CR,CT,CB, InSAR=SAR, CropDAR=CropDAR, TCRatio=0.3)
    
    clip.set_output()
    ---------------------------------------------------------------------------------

    MPV player:

    To run the script while viewing video in MPV player, a configuration file can be used. I only know where it needs to be located for my Linux installation, which is:
    /home/UserName/.config/mpv/
    The configuration file can be created if one doesn't already exist and must be named mpv.config

    For my Linux installation the line that needs to be added to mpv.config is the following. It points to the Frosty.py script. Obviously the file path would change according to the location of Frosty.py

    vf="vapoursynth=/media/Drive1/SomeFolder/Frosty.py"

    For Windows (not tested) I assume it'd be something like
    vf="vapoursynth=D:\\SomeFolder\\Frosty.py"

    ---------------------------------------------------------------------------------

    SMPlayer:

    If a Windows installation of SMPlayer comes with MPV included (I'm not sure) I don't know if that version of MPV would be built with VapourSynth support.

    SMPlayer doesn't seem to load the MPV configuration file as it uses it's own (assuming MPV is installed separately as it is for my Linux setup), however the script can be added to SMPlayer's options under Preferences/Advanced and the MPlayer/MPV tab. I couldn't get it to work when I added the script to SMPlayer as a video filter, but it does work when added as a general MPV option this way:

    --vf-add="vapoursynth=/media/Drive1/SomeFolder/Frosty.py"

    ---------------------------------------------------------------------------------

    A screenshot of FrostyBorders cropping a video with a DAR slightly less than 4:3 to an aspect ratio of 1.5, minimizing the size of the pillarbox borders, but with TCRatio=0.5 to show how the height would normally be cropped.

    Image
    [Attachment 73830 - Click to enlarge]


    The result when TCRatio=0.3

    Image
    [Attachment 73831 - Click to enlarge]


    FrostyBorders (both Avisynth and Vapoursynth versions) can apply the CropDAR and TCRatio arguments without having to add borders.
    When OutWidth=0 (unspecified) the video is cropped and resized according to the specified height.
    When OutHeight=0 (unspecified) the video is cropped and resized according to the specified width.

    clip = FB.FrostyBorders(clip, 0,1080, 2,2,0,0, CropDAR=1.5, TCRatio=0.3)

    Image
    [Attachment 73834 - Click to enlarge]
    Last edited by hello_hello; 6th Dec 2023 at 02:20.
    Quote Quote  
  4. So it's possible 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; 20th Jul 2019 at 09:59.
    Quote Quote  
  5. Updated the FrostyBorders function and added the ImageBorders function to the thread. Both are dated 2020-03-26. There's links in the opening post.
    Quote Quote  
  6. I've uploaded a new version of the FrostyBorders function. It's dated 2021-04-07. There's a link in the opening post.
    Quote Quote  
  7. I fixed one problem and caused another. It hasn't been uploaded long so I haven't changed the version date, but I've fixed an oversight preventing the script from checking that any specified mod is correct for the source. If anyone has downloaded FrostyBorders 2021-04-07 before reading this post, please download it again.
    Quote Quote  
  8. Would you be able to feather the edges between the video and the boarders? I have attached 2 pictures. One is how the script acts now, and the other is the desired effect.

    jagabo was able to achieve this effect in his script. I have posted his below.


    Code:
    uncropped = potplayer_source()
    src = uncropped.Crop(8,0,-8,-0)
    
    ZOOM = 1.167
    
    Spline36Resize(src, int(uncropped.width*ZOOM)/2*2, int(uncropped.height*ZOOM)/2*2)
    Crop(0, (height-src.height)/4*2, -0, src.height)
    alpha = Overlay(BlankClip(last, color=$000000), BlankClip(last, color=$ffffff).Crop(16,0,-16,-0), x=16, y=0).ColorYUV(cont_y=50).PointResize(width/16*2, width).BilinearResize(width,height)
    bg = Spline36Resize(width/16*2,height/16*2).Blur(1.4).Blur(1.4).Blur(1.4).Spline36Resize(uncropped.height*16/18*2,uncropped.height).ColorYUV(gain_y=-50)
    Overlay(bg, last, x=(bg.width-width)/4*2, y=0, mask=alpha)
    Spline36Resize(uncropped.width, uncropped.height)
    
    float(uncropped.width)/float(uncropped.height) < 1.77 ? last : uncropped
    Image Attached Thumbnails Click image for larger version

Name:	current script.jpg
Views:	41
Size:	103.8 KB
ID:	59110  

    Click image for larger version

Name:	feather.jpg
Views:	55
Size:	102.2 KB
ID:	59111  

    Quote Quote  
  9. I've used the FrostyBorders function a few times myself lately, which made me aware of some things that could be improved, most importantly ensuring the borders are fairly consistent regardless of resolution. Or to put it another way, the borders added to HD and SD versions of the same video should now look much the same.

    There's also new arguments for adding plain borders with a dark to light gradient and a "frosty" look, for picking a frame from a video with normal FrostyBorders and using those borders for the entire video, and for adding a black 2 pixel divider between the picture and the borders.
    The multithreaded resizers from the ResampleMT plugin are supported and there's a "RStr" argument for specifying resizer options.
    .

    There's a link for the new version dated 2021-08-18 in the opening post.

    thebib62,
    Sorry, I mussed your post. If you're still around and would still like that option, post again and I'll see if I can do it.
    Last edited by hello_hello; 18th Aug 2021 at 07:33.
    Quote Quote  
  10. Originally Posted by hello_hello View Post
    I've used the FrostyBorders function a few times myself lately, which made me aware of some things that could be improved, most importantly ensuring the borders are fairly consistent regardless of resolution. Or to put it another way, the borders added to HD and SD versions of the same video should now look much the same.

    There's also new arguments for adding plain borders with a dark to light gradient and a "frosty" look, for picking a frame from a video with normal FrostyBorders and using those borders for the entire video, and for adding a black 2 pixel divider between the picture and the borders.
    The multithreaded resizers from the ResampleMT plugin are supported and there's a "RStr" argument for specifying resizer options.
    .

    There's a link for the new version dated 2021-08-18 in the opening post.

    thebib62,
    Sorry, I mussed your post. If you're still around and would still like that option, post again and I'll see if I can do it.
    Yes, I'm still here and would love the feathered edges to be implemented! Hoping for the best. Thank you.
    Quote Quote  
  11. I'll have a look and post back, but in the mean time there's a new version dated 2021-08-19 in the opening post. It just fixes a bug I missed with in version I uploaded yesterday. And YV411 also works.
    Quote Quote  
  12. thebib62,
    I can't say I'm a fan of feathered borders. At least not in combination with the type of borders the FrostyBorders script creates, but I've added an option for feathered borders for you. Hopefully it's close to what you had in mind. I'll just add the link here as I haven't done a lot of testing but it should be okay.

    Link deleted. Link for newer version in opening post.

    It's enabled with FrostyBorders(w,h, Feather=true)

    If you prefer borders without the texture, try FrostyBorders(w,h, Feather=true, Texture=0)

    The blurring options won't do anything as the blurring part of the process is doing the feathering.
    It'll be slower as the only way to blur the existing borders into the picture is to do it with Overlay() after they've been added.
    It won't work when FrostyColor=true (there'll be an error message), but if you use it in combination with Frosty=false it'll blur the edges of plain colored borders, and if you're adding those you can adjust the brightness and saturation.

    Image
    [Attachment 60373 - Click to enlarge]
    Last edited by hello_hello; 26th Aug 2021 at 09:42.
    Quote Quote  
  13. Originally Posted by hello_hello View Post
    thebib62,


    The blurring options won't do anything as the blurring part of the process is doing the feathering.


    Image
    [Attachment 60373 - Click to enlarge]
    If i am reading that correctly, I can not change the blur intensity/value?
    Thank you for adding that feature to frosty-boarders!
    Quote Quote  
  14. Originally Posted by thebib62 View Post
    If i am reading that correctly, I can not change the blur intensity/value?
    I've realised what the problem is with adjusting the blurring when feathering is enabled, so I'll change it and post back with an updated version as soon as I have a chance.

    Originally Posted by thebib62 View Post
    Thank you for adding that feature to frosty-boarders!
    You're welcome.
    Quote Quote  
  15. thebib62,
    Sorry it took a while, but I've updated the link in the opening post with a newer FrostyBorders (dated 2021-08-27).
    I was a bit slow because I somehow put my neck out and I couldn't sit or stand for more than 5 minutes without the neck-ache becoming a massive headache.
    I seem to be recovering now but I'm still full of painkillers and somewhat vague so let me know if there's any problems.

    There's two Feather arguments now. Feather=true and Feather2=true. The latter just adds more feathering.
    Both can be used with plain black/colored borders and you can adjust the Blur and VBlur arguments when feathering is enabled. Keep in mind they're independent now though, so specifying a value for Blur doesn't automatically apply the same value to VBlur.

    The Bright, Cont and Sat arguments can now be applied to plain black/colored borders.
    Quote Quote  
  16. Originally Posted by hello_hello View Post
    thebib62,
    Sorry it took a while, but I've updated the link in the opening post with a newer FrostyBorders (dated 2021-08-27).
    I was a bit slow because I somehow put my neck out and I couldn't sit or stand for more than 5 minutes without the neck-ache becoming a massive headache.
    I seem to be recovering now but I'm still full of painkillers and somewhat vague so let me know if there's any problems.

    There's two Feather arguments now. Feather=true and Feather2=true. The latter just adds more feathering.
    Both can be used with plain black/colored borders and you can adjust the Blur and VBlur arguments when feathering is enabled. Keep in mind they're independent now though, so specifying a value for Blur doesn't automatically apply the same value to VBlur.

    The Bright, Cont and Sat arguments can now be applied to plain black/colored borders.

    Thanks for the update! I will try it out asap. In the meantime,

    I had a couple of questions about frosted borders that I'm hoping you could answer.

    I really like how the previous AVI synth script that I was using would blur the edges. I've noticed with your script that the blurring seems to be much more aggressive and possibly using a different technique and adding some sort of distortion. Is it possible to remove the distortion, which might be the temporalsoften, and just use the fast blur method with your script? Essentially, I would want blurring to look like the attached photo to this post. That photo illustrates how I have my current script set up.

    Going back to my previous script, I've noticed that it will automatically downsize the blurred sides in order to save on system resources. With your script, I've noticed the video lag a lot and I'm going to assume that's because the size of the video are not downscaled and are played at full resolution. If that is the case, would you be able to somehow implement a method that down scales the sides of the video?

    Can frosty borders automatically crop black pillars that are added into a video? Most notably, 4 x 3 content that's re-released in today's day and age tend to have black pillars added rather than cropped to the correct 4 X 3 ratio. I am essentially looking for a completely automated script that will automatically give me frosty borders on the appropriate 4 x 3 media. I obviously don't want frosty borders to be applied to a widescreen video, and having a script automatically detect and crop the black bars and have as little user input as possible would be the best case scenario. Again I don't know if it's possible to achieve this because my scripting knowledge is nonexistent.

    P.S. I hope you feel better.
    Image Attached Thumbnails Click image for larger version

Name:	PotPlayerMini_on_2021_08_27_mbQj.png
Views:	34
Size:	654.5 KB
ID:	60467  

    Last edited by thebib62; 27th Aug 2021 at 19:14.
    Quote Quote  
  17. thebib62,
    Looking at your screenshot I think it might be the texture over the borders you're not liking. It has to be included in the feathering but you can reduce it or disable it completely with Texture=0. The default is the height of the picture divided by 100.
    Unlike your screenshot though, FrostyBorders only uses 16 pixels or so from the edge of the picture to create the borders, so it won't have the same "mirror" type look, even when the blurring is reduced and the texture disabled, but that's by design.

    The FrostyBorders function is really just designed to add borders to an already "prepared" picture. For cropping etc, try the CropResize script in my signature. It'll do auto-cropping if the auto-crop plugin is loaded, and there's a cropping aspect ratio argument that can be used to (optionally) crop to a specific aspect ratio. It also has the ability to add FrostyBorders, although I'm updating it to add the feathering etc at the moment but I should be able to upload the new version later today.

    In order not to clutter the CropResize arguments with options that won't be used much, the "frosty" options are set by a separate function, so it'd work something like this. To auto-crop and ensure the cropped picture is 4:3 while adding black borders:

    CropResize(832,468, AutoC=true, CropDAR=4.0/3.0, Borders=true)

    To do the same when adding FrostyBorders you need to use the global FCropResize function if you want to adjust the border arguments. FCropResize creates the FrostyBorder options as global variables for CropResize and passes the video through to CropResize untouched. The same as above, only with FrostyBorders, would be something like this:

    FCropResize(Feather=true, Texture=20)
    CropResize(832,468, AutoC=true, CropDAR=4.0/3.0, Frosty=true)

    Or you could do the cropping with CropResize and then use the FrostyBorders function to add the borders. If you're upscaling that may be a bit faster as the FrostyBorders function can create the borders using the picture before it's upscaled, whereas CropResize always has to do the cropping and resizing first. Other than that though, the borders should be pretty much the same.

    Auto-cropping isn't always perfect if the border edges aren't sharp. It might sometimes leave a little black behind, so I prefer to still check the cropping myself. It's easy to adjust though. If the auto-cropping left behind a couple of pixels of black at the top and on the right (for example), you can crop them manually.

    CropResize(832,468, 0,2,-2,0, AutoC=true, Frosty=true)

    Anyway, I'm at the testing stage so check out the link in my signature and hopefully I'll be uploading a new version of CropResize with the new FrostyBorder options later today.
    Last edited by hello_hello; 29th Aug 2021 at 00:42.
    Quote Quote  
  18. The distortion that I was mentioning before was not the result of the texture value being applied. I've included another screenshot to better illustrate what I'm referring to. The screenshot included illustrates the image being what can only be described as squeezed or skewed at a certain angle. I would like to disable that and have an exact copy on the sides rather than whatever affect is being applied with frosty orders default value and apply a simple fast blur. The other screenshot shows how my current script acts. Also, it seems like the borders refresh at a slightly slower rate than the main video. I was wondering if I could set both the borders and the main video at the same refresh rate?

    As for the cropping, I'm very excited to try out your newly updated plug-in. Should be much easier to enjoy content with all different types of aspect ratios. With that being said, will your updated plug-in be able to force 720 X480 resolutions to 4 x 3 ratios? In other words, all media sourced from DVD do not have a 4 x 3 aspect ratio. It's usually up to the video player to squeeze the image to the correct aspect ratio. I've noticed with frosty borders and with the script that I've been using up until now, this type of media does not play nicely with these scripts. The image is stretched out and these scripts are not being applied to the correct aspect ratio. I'm hoping there is a script that can fix this issue. In the meantime, I've had to run a batch file that re-encodes the entire media file to force it into a 4 x 3 aspect ratio.

    The bat file i am using is below;

    for %%a in ("*.*") do ffmpeg -i "%%a" -vf scale=720:540 "%%~na.mp4"
    pause
    Image Attached Thumbnails Click image for larger version

Name:	ATHF S03E03 Remooned.mp4_20210829_030016.851.jpg
Views:	42
Size:	92.5 KB
ID:	60489  

    Click image for larger version

Name:	old-script.jpg
Views:	38
Size:	66.4 KB
ID:	60490  

    Last edited by thebib62; 29th Aug 2021 at 12:05.
    Quote Quote  
  19. Originally Posted by thebib62 View Post
    The distortion that I was mentioning before was not the result of the texture value being applied. I've included another screenshot to better illustrate what I'm referring to. The screenshot included illustrates the image being what can only be described as squeezed or skewed at a certain angle. I would like to disable that and have an exact copy on the sides rather than whatever affect is being applied with frosty orders default value and apply a simple fast blur. The other screenshot shows how my current script acts. Also, it seems like the borders refresh at a slightly slower rate than the main video. I was wondering if I could set both the borders and the main video at the same refresh rate?
    Both those things were by design.
    The original idea was to create borders that change color with the video, but aren't too distracting. They weren't designed to be a duplicate of the picture as such. The script takes pixels from each side (128 or a bit more depending on the resolution), stacks them, runs TemporalSoften on them, then takes 16 or so TemporalSoftened pixels from each side, blurs them and stretches them out to the full border dimensions. The reason for running TemporalSoften over more pixels than are actually used for the borders was to ensure it's scene-change detection would generally be the same as if it was run over the entire picture. Anyway, the idea was to have borders that are quite temporally softened (I assume that's the lag you're referring to) except on scene changes when the borders would change instantly with the scene change.

    So yeah, it's pretty much designed to do exactly what you don't want, or so it seems.

    If you want to post the script for creating the borders you prefer, I could try to create a version that adds those borders, but what would be the advantage of that compared to using your current script? Not that I mind giving it a go if you want me to. We're in lockdown again where I am, so it'd give me something to do.

    Originally Posted by thebib62 View Post
    As for the cropping, I'm very excited to try out your newly updated plug-in. Should be much easier to enjoy content with all different types of aspect ratios. With that being said, will your updated plug-in be able to force 720 X480 resolutions to 4 x 3 ratios? In other words, all media sourced from DVD do not have a 4 x 3 aspect ratio. It's usually up to the video player to squeeze the image to the correct aspect ratio. I've noticed with frosty borders and with the script that I've been using up until now, this type of media does not play nicely with these scripts. The image is stretched out and these scripts are not being applied to the correct aspect ratio. I'm hoping there is a script that can fix this issue. In the meantime, I've had to run a batch file that re-encodes the entire media file to force it into a 4 x 3 aspect ratio.
    If I understand you correctly, FrostyBorders can resize to the correct aspect ratio, but it won't do an anamorphic output. It always resizes an anamorphic source to "square pixel" dimensions. It can't know that a source is anamorphic though unless you tell it using the input DAR (InDAR) or InSAR (sample aspect ratio) arguments. Assuming you had a 4:3 source that's already nicely cropped, you can just tell FrostyBorders it's 4:3. The source dimensions aren't relevant, just the aspect ratio. The script calculates the resizing based on the InDAR you tell it to use.

    This (as an example) should resize any 4:3 source to 4:3 dimensions, which based on the specified height would be 720x540, then borders would be added to the sides for 16:9 (960x540).

    FrostyBorders(960,540, InDAR=4.0/3.0)

    If the source is non-anamorphic (the dimensions and display aspect ratio are the same) there's no need to specify an InDAR.

    The CropResize script is more clever because it can also crop, and if you don't want to resize to square pixel dimensions you can also specify an output display aspect ratio or sample aspect ratio. Personally if I'm re-encoding I always resize to "square pixel" dimensions, but that's just me.

    For CropResize it works the same as for FrostyBorders by default, but you can specify cropping and/or ensure the picture is cropped to a specific aspect ratio. For 4:3 DVDs though, the correct DAR is almost always 15:11 rather than 4:3 (a story I can go into some other time). To take a 4:3 DVD source, crop away some crud, resize to square pixel dimensions and add borders for 16:9, it'd be something like:

    CropResize(960,540, 8,4,-6,-2, InDAR=15.0/11.0, Borders=true, Frosty=true)

    Same again, with the 4:3 (15:11) source, but this time with 16:9 NTSC DVD dimensions as the output. You'd need to set the correct SAR for encoding when the output is anamorphic. Info=true will tell you what it is if you're not sure. Naturally that will look squished as it's up to the player to resize it to the correct DAR on playback. It doesn't matter if you need to crop or how much you crop, as long as you specify the correct InDAR for the source (prior to any cropping as the script will take the cropping you specify into account when it calculates the resizing).

    CropResize(720,480, 8,4,-6,-2, InDAR=15.0/11.0, OutDAR=16.0/9.0, Borders=true, Frosty=true)

    There's two screenshots below as example of each. The first was resized to 960x540 with "square pixel" dimensions and the second is resized for a 16:9 720x480 DVD output. If you resize the second image to 16:9 dimensions as a player would on playback, it'll have the same aspect ratio as the first one.

    Image
    [Attachment 60502 - Click to enlarge]


    Image
    [Attachment 60503 - Click to enlarge]


    Anyway.... I haven't got around to finishing the new CropResize version yet so I haven't uploaded it. I'll try to pull my finger out and finish it off tomorrow but you can play around with the current version. It doesn't have the new FrostyBorder options, but maybe that doesn't matter if you prefer your current script for borders.
    Last edited by hello_hello; 30th Aug 2021 at 19:40.
    Quote Quote  
  20. I think your script has more room for me to be able to customize it. Also, having the ability to correct the AR of DVD 4x3 source videos is great!
    FrostyBorders(960,540, InDAR=4.0/3.0)
    I tried this, and that was exactly what I was looking for. Thank you for taking the time to explain this to me. I understand exactly what you have said.
    I am curious about the video and audio De-syncing on my end, though. These are the current entries of i have entered in avisynth
    Code:
    FrostyBorders(960, 540, InDAR=4.0/3.0, blend=0.0, bright=5, Iterations=1, Feather2=true, Texture=2, blur=15, vblur=15, Resizer="Bicubic", RStr="b=0.5,c=0.5", info=true)
    Would re-sizing the video to a lower resolution fix the de-sync issue? I don't have this issue when using my older script, unless it was very high resolution 4x3 video and the boarder resolution wasn't being resized


    My current script is;

    Code:
    uncropped = potplayer_source()
    src = uncropped.Crop(8,0,-8,-0)
    
    ZOOM = 1.04
    
    Spline36Resize(src, int(uncropped.width*ZOOM)/2*2, int(uncropped.height*ZOOM)/2*2)
    Crop(0, (height-src.height)/4*2, -0, src.height)
    alpha = Overlay(BlankClip(last, color=$000000), BlankClip(last, color=$ffffff).Crop(16,0,-16,-0), x=16, y=0).ColorYUV(cont_y=50).BilinearResize(width/20*2, width).BilinearResize(width,height)
    bg = Spline36Resize(width/16*2,height/16*2).FastBlur(1, dither=yes).Spline36Resize(uncropped.height*16/18*2,uncropped.height).AddGrain(var=3.0)
    Overlay(bg, last, x=(bg.width-width)/4*2, y=0, mask=alpha)
    Spline36Resize(uncropped.width, uncropped.height)
    
    float(uncropped.width)/float(uncropped.height) < 1.76 ? last : uncropped
    Quote Quote  
  21. Chances are any audio de-sync is due to the video not being able to run in real time, probably due to TemporalSoften as it checks 5 frames either side of the current one for it's temporal smoothing. Well... only part of each frame, but it's still probably the slowest part of the process. If I put a new function together I won't bother including TemporalSoften unless you want me to. Or I can add an option to configure it.

    For the new function there may be no point re-inventing the wheel, so something you can use in combination with CropResize might suffice. CropResize obviously doesn't have to add borders, so it can do the cropping and resizing, and you can specify just the desired output height and let it sort out the width.

    This would give you 720x540, assuming the cropping resulted in a 4:3 picture, but if not, the width would be a little more or a little less according to the resizing for the correct aspect ratio.

    CropResize(0,540, 8,4,-6,-2, InDAR=15.0/11.0)

    Then maybe you could follow it with a function that doesn't resize, but just adds borders according to the width you specify.

    CropResize(0,540, 8,4,-6,-2, InDAR=15.0/11.0)
    BorderFunction(960)

    I'll play around with it later today.

    Cheers.

    PS The script you posted... I vaguely remember that discussion. The script was for use with Potplayer I assume?
    If I remember correctly, the issue then was not being able to change the aspect ratio when using a script with PotPlayer. I'm just checking, as the script you posted takes a 4:3 image and outputs a video with borders but still with 4:3 dimensions, and it appears the intention would then be for the player to stretch it to 16:9 on playback.

    Is that still the goal or are you after a script that'll resize the output to the correct aspect ratio itself?
    Thinking about it, if I use CropResize to do the work there's probably no reason why it can't do both by specifying the correct OutDAR for CropResize as required, but I thought maybe I should confirm what the goal is at this stage so I don't end up going in the wrong direction.
    Last edited by hello_hello; 31st Aug 2021 at 10:10.
    Quote Quote  
  22. yes, that is correct. But with your script, I followed your solution on how to get get it working with potplaer. Your solution was to install FF D show.
    After that it was not necessary to have the video players stretch the image to a 16 x 9 aspect ratio on playback. Your script takes care of everything.

    I think you've taken care of my goal already in terms of resizing. I want the script to be able to automatically crop black borders/pillars and resize DVD sourced content..
    Quote Quote  
  23. In the end the way to do it with the least amount of wheel re-inventing was to add the borders you want to CropResize. That way you can crop/auto-crop with it and resize etc and all I had to do was add the new type of borders.

    There's a temporary link for the updated CropResize below if you'd care to torture test it a little. It should be fine but there's a couple of non-border related things I want to check before I add the new version to the CropResize thread.

    The FCropResize function just sets the frosty border options for CropResize. It has a version of the FrostyBorders function included. To use it you need to specify Frosty=true for CropResize. Other than that, the FCropResize border arguments are the same as for FrostyBorders now, with the addition of "Clone" and "Mirror". They're the same borders, only Mirror=true flips them. When either Clone or Mirror are true the default for both blur arguments is 5, for iterations it's 1 and for Texture it's 10. I can change those defaults, but I had to pick something for the moment. The Clone/Mirror borders can't be blended (unless you want it?) and there's no temporal smoothing (unless you want it?). The borders aren't stretched at all (unless you want it?). Whatever the width/height of the borders, that's what's taken from the edges of the picture.

    Now CropResize is doing the work it probably wouldn't be hard to use it with Potplayer and let PotPlayer resize to 16:9 if you want to do that. It should only be a matter of setting an (in)correct width and OutDAR for PotPlayer to stretch. I could probably create a little function to automate it so there's no need to work it out manually for each video. Let me know if you want something like that.

    As a starting point, for a 4:3 source, this should give you the borders you're after (I hope). Let me know if you find any gremlins. I've only added a link for the script itself below, as I haven't updated the help file yet.

    FCropResize(Clone=true, Feather2=true)
    CropResize(832,468, InDAR=4.0/3.0, Frosty=true)

    Image
    [Attachment 60518 - Click to enlarge]


    FCropResize(Mirror=true, Feather2=true)
    CropResize(832,468, InDAR=4.0/3.0, Frosty=true)

    Image
    [Attachment 60519 - Click to enlarge]


    CropResize test version.zip

    By the way, the new CropResize has the same RStr argument as FrostyBorders, only better because you can change the little functions at the end of the script to use your preferred resizing method and specify a string for it's options. If you open the script and scroll down to the end, changing the appropriate functions would save you having to type it all each time.

    When you look at the end of the script you'll see the following:

    Code:
    # Default resizer functions
    function CR_ResizerDefault() { return "" }
    function CR_ResizerX() { return "Resize8" }
    
    # Functions for specifying resizer strings for the default resizers
    function CR_RStrDefault() { return "" }
    function CR_RStrX() { return "" }
    If you modify the two default functions like this, it'll become the default resizing.

    Code:
    # Default resizer functions
    function CR_ResizerDefault() { return "Bicubic" }
    function CR_ResizerX() { return "Resize8" }
    
    # Functions for specifying resizer strings for the default resizers
    function CR_RStrDefault() { return "b=0.5,c=0.5" }
    function CR_RStrX() { return "" }
    Last edited by hello_hello; 31st Aug 2021 at 21:48.
    Quote Quote  
  24. Man, this script is turning out to be amazing! I tried

    FCropResize(Clone=true, Feather2=true)
    CropResize(832,468, InDAR=4.0/3.0, Frosty=true)

    And that is exactly what I was looking for. I'm able to use it in potplayer without any issues that I'm noticing so far.

    "It should only be a matter of setting an (in)correct width and OutDAR for PotPlayer to stretch. I could probably create a little function to automate it so there's no need to work it out manually for each video. Let me know if you want something like that."

    That would be wonderful! Essentially, whatever functionality or scripting that makes the process of using frostboarders more automated and require less manual input would be what I'm looking for.

    I also would like to restrict frosty borders from being applied to 16 x 9 videos, and apply to all other aspect ratios..
    Last edited by thebib62; 1st Sep 2021 at 00:48.
    Quote Quote  
  25. In normal resizing mode, CropResize won't add borders to the picture unless the output aspect ratio and the picture aspect ratio are different.

    When borders are not enabled, CropResize would crop the picture as required to prevent aspect error. For example, if the picture aspect ratio is 16:9 and the output dimensions are 4:3 (and no OutDAR is specified), CropResize will crop a heap from each side to make the picture 4:3 and then resize it. When borders are enabled, instead of cropping to give you an undistorted picture, it adds borders top/bottom or left/right instead. Whether borders are enabled or not, if the output aspect ratio is 16:9 and the picture is 16:9, it'll just resize.

    So you know.... if you don't know exactly what the picture aspect ratio will be after cropping and you and don't want any extra picture cropped or borders added, you can do that by specifying an output width, or an output height, but not both (use zero for one of them if need be). Whichever one you specify, the script will calculate the other accordingly. You can still crop any black though. This sort of thing... cropping 40 pixels of black top and bottom, specifying an output width of 960, and letting the script calculate the correct height.

    CropResize(960,0, 0,40,0,-40, InDAR=16.0/9.0)

    I'll give some thought to a function for Potplayer and post back later. A few hours ago it was a simple to do in my head, but now I'm not sure if it'll work the way I originally thought it should. I think I've taken a few too many pain-killers today and my brain has wandered off somewhere.
    Last edited by hello_hello; 1st Sep 2021 at 09:01.
    Quote Quote  
  26. Maybe it's a good thing my brain wandered off, because without it I'm not over-thinking the Potplayer problem. It should be easy, no additional function required, if I'm remembering the problem correctly.

    A fake 4:3 NTSC pic to demonstrate:

    Image
    [Attachment 60521 - Click to enlarge]


    For PotPlayer, all you should need to do is keep the original dimensions, crop the black, and tell CropResize it's 4:3 in and you want 16:9 out (I'd still use 15:11 instead of 4:3 though).

    FCropResize(Clone=true, Feather2=true)
    CropResize(720,480, 10,14,-10,-24, Frosty=true, InDAR=15.0/11.0, OutDAR=16.0/9.0)

    Image
    [Attachment 60522 - Click to enlarge]


    If you have Potplayer set to resize to 16:9, it'll display correctly (same thing, only with MPC-HC).

    Image
    [Attachment 60523 - Click to enlarge]


    To zoom in and reduce the border size a bit, you can increase the top and bottom cropping to your taste. When zooming in on a 4:3 source, generally I find it's better to crop more from the bottom than from the top, as the important stuff is mostly in the middle to the top of the frame.

    FCropResize(Clone=true, Feather2=true)
    CropResize(720,480, 10,34,-10,-60, Frosty=true, InDAR=15.0/11.0, OutDAR=16.0/9.0)

    Image
    [Attachment 60524 - Click to enlarge]


    Resized.

    Image
    [Attachment 60525 - Click to enlarge]


    If you want to pander to PotPlayer rather than use ffdshow, I'm pretty sure that'll do it.
    Last edited by hello_hello; 1st Sep 2021 at 07:28.
    Quote Quote  
  27. I think pop player has to use FFDshow if I'm not mistaken. Under the AVI synth settings of pop player it says that video resize processing cannot be used. I would like it if I didn't have to install FFDshow, but I don't think it's possible and if it's too difficult to implement, don't go to crazy over it.

    "To zoom in and reduce the border size a bit, you can increase the top and bottom cropping to your taste. When zooming in on a 4:3 source, generally I find it's better to crop more from the bottom than from the top, as the important stuff is mostly in the middle to the top of the frame.

    FCropResize(Clone=true, Feather2=true)
    CropResize(720,480, 10,34,-10,-60, Frosty=true, InDAR=15.0/11.0, OutDAR=16.0/9.0)"

    I like doing this, however I've noticed that the cropping values still apply to a 16 x 9 video. With my old script, I would also crop from the top and bottom, but these cropping values would never apply to a 16 x 9 video. Is it possible to have Frosty borders automatically not apply crop settings to 16 x 9 video? I've tried playing around with the settings and suggestions that you've made, but i wasn't able to figure out a solution.
    Quote Quote  
  28. Originally Posted by thebib62 View Post
    I think pop player has to use FFDshow if I'm not mistaken. Under the AVI synth settings of pop player it says that video resize processing cannot be used. I would like it if I didn't have to install FFDshow, but I don't think it's possible and if it's too difficult to implement, don't go to crazy over it.
    If you use the same dimensions for CropResize as the source video though, that'd probably be okay, because even though it's being processed by the script, to Potplayer the size won't have changed. That should be easy enough to do, regardless of the resolution. Something like:

    Source = potplayer_source()
    W = width(Source)
    H = height(Source)
    Source.CropResize(W, H, InDAR=15.0/11.0, OutDAR=16.0/9.0)

    CropResize is setting 16:9 as the output display aspect ratio, so you just need to configure Potplayer to stretch the picture to 16:9.

    Originally Posted by thebib62 View Post
    I like doing this, however I've noticed that the cropping values still apply to a 16 x 9 video. With my old script, I would also crop from the top and bottom, but these cropping values would never apply to a 16 x 9 video. Is it possible to have Frosty borders automatically not apply crop settings to 16 x 9 video? I've tried playing around with the settings and suggestions that you've made, but i wasn't able to figure out a solution.
    Try the attached Crop43 function below instead of CropResize (I couldn't think of a better name).
    CropResize still needs to be loaded, as Crop43 just passes everything along to CropResize untouched, except for the cropping. It's passed along when the source aspect ratio is less than 16:9, but for 16:9 or greater, it resets all cropping to zero.

    FCropResize(Clone=true, Feather2=true)
    Crop43(720,480, 10,4,-10,-4, Frosty=true, InDAR=4.0/3.0, OutDAR=16.0/9.0)
    Image Attached Files
    Last edited by hello_hello; 1st Sep 2021 at 14:31.
    Quote Quote  
  29. FCropResize(Clone=true, Feather2=true)
    Crop43(720,480, 10,4,-10,-4, Frosty=true, InDAR=4.0/3.0, OutDAR=16.0/9.0)

    That worked in regards to the cropping not being applied to 16x9 video, but frostyboarders is still being applied to 16x9 videos.
    Is it possible to automatically implement that restriction as well?

    Code:
    float(uncropped.width)/float(uncropped.height) < 1.76 ? last : uncropped
    That line was able to accomplish that restriction in my older script.
    Last edited by thebib62; 1st Sep 2021 at 16:55.
    Quote Quote  
  30. Is it because you haven't changed the InDAR? If that's not correct and it's still InDAR=4.0/3.0, the script will assume the source is 4:3.

    Take 2 for Crop43. When the aspect ratio is greater than or equal to 16:9, it forces Frosty=false.
    As a bonus, Frosty=true when the aspect ratio is less than 16:9, so you don't need to specify Frosty=true yourself.

    You can use a similar method for disabling CropResize to the one you posted above, but it's based purely on the source dimensions being the same as the display aspect ratio. It won't work for an anamorphic source such as a 16:9 DVD, but then I guess it wouldn't have been working for anamorphic sources previously either.

    Source = potplayer_source()
    W = width(Source)
    H = height(Source)

    float(W) / float(H) >= 1.76 ? Source : \
    Source.FCropResize(Clone=true, Feather2=true)\
    .Crop43(W,H, 10,34,-10,-60, InDAR=15.0/11.0, OutDAR=16.0/9.0)

    Anyway..... Frosty is disabled automatically too now if it helps.
    Image Attached Files
    Last edited by hello_hello; 1st Sep 2021 at 18:43.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!