VideoHelp Forum

+ Reply to Thread
Results 1 to 16 of 16
Thread
  1. I want to find the max integer scale to convert old console video footage (atari, nes, snes, etc) using this information, however depending on the source height or target height this maximum integer value change, example from a 320x240 source:

    Code:
    720  / 240 = 3
    1080 / 240 = 4.5
    1440 / 240 = 6
    So for a 1440 target I manually do:

    Code:
    PointResize(width*6,height*6)
    Source:


    Target:


    The height of the source isn't always 240, sometimes it might be 224, 304 or other funky height. Is there a way to make avisynth automatically use the height information from the video source and calculate/find this max integer value for me?

    Something like Replace '?' with the result of 1440 / height of source?

    Code:
    PointResize(width*?,height*?)
    Thank you.
    Quote Quote  
  2. So you the maximum integer value that gives you a height of 1440 or less?

    Code:
    iscale = int(1440 / height)
    PointResize(width*iscale, height*iscale)
    Last edited by jagabo; 10th Sep 2021 at 08:45.
    Quote Quote  
  3. another example, if you want to stay inside 1920x1080, you could use:
    Code:
    iscale = Min(int(1920/ width), int(1080 / height))
    PointResize(width*iscale, height*iscale)
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  4. Thank you jagabo and Selur!
    Quote Quote  
  5. If you want something that's easy to customize for each video:

    Code:
    MAXWIDTH =2560
    MAXHEIGHT = 1440
    iscale = Min(int(MAXWIDTH/width), int(MAXHEIGHT/height))
    PointResize(width*iscale, height*iscale)
    Just change the MAXWIDTH and MAXHEIGHT to the limits you need.
    Quote Quote  
  6. Nice!

    Thank you jagabo.
    Quote Quote  
  7. Jagabo asked me a question however I was working at the moment and I couldn't answer it before he edit the post. So, yes it would be nice to find the max integer scale I can find although still I want to always keep a 4:3 aspect ratio since some source aspect ratio it's 12:7, 8:7, 5:4 so on and so forth.

    Thank you.
    Quote Quote  
  8. If the source isn't a 4:3 frame size you cannot multiply both the width and height by the same number and get a final 4:3 frame. One or the other will have to use a different number. For example, with a 352x240 source:

    Code:
    iscale = int(1440 / height)
    PointResize(height*iscale*4/3, height*iscale)
    iscale will be 6 and you will get the desired frame height of 1440 but to get a final 4:3 frame (1920x1440) the horizontal scaling factor will be 5.45454..., not 6.
    Quote Quote  
  9. What would be the best action?
    Correct the frame before upscale?
    Quote Quote  
  10. If you want the point resize look it will usually be best to let the upscale use a non-integer scaling rather than scaling the source to a 4:3 frame size first.
    Quote Quote  
  11. Thank you jagabo.
    Quote Quote  
  12. examples:

    scale low res image to 4:3 first, then upscale to 4:3:
    Image
    [Attachment 60668 - Click to enlarge]


    upscale low res image directly to 4:3:
    Image
    [Attachment 60669 - Click to enlarge]


    Smooth upscale with nnedi3:
    Image
    [Attachment 60670 - Click to enlarge]
    Quote Quote  
  13. Originally Posted by jagabo View Post
    examples:

    scale low res image to 4:3 first, then upscale to 4:3:
    Image
    [Attachment 60668 - Click to enlarge]


    upscale low res image directly to 4:3:
    Image
    [Attachment 60669 - Click to enlarge]


    Smooth upscale with nnedi3:
    Image
    [Attachment 60670 - Click to enlarge]
    Amazing!!!

    Please, show me how.
    Quote Quote  
  14. You can do the smooth upscale like this:

    Code:
    LWLibavVideoSource("00vnHM2.png") 
    ConvertToYV12()
    nnedi3_rpow2(8, cshift="spline36Resize", fwidth=1920, fheight=1440) # upscale 8x, 320x240 to 2560x1920, then downscale to 1920x1440
    aWarpSharp2(depth=20)
    Sharpen(0.3)
    Quote Quote  
  15. Originally Posted by jagabo View Post
    You can do the smooth upscale like this:

    Code:
    LWLibavVideoSource("00vnHM2.png") 
    ConvertToYV12()
    nnedi3_rpow2(8, cshift="spline36Resize", fwidth=1920, fheight=1440) # upscale 8x, 320x240 to 2560x1920, then downscale to 1920x1440
    aWarpSharp2(depth=20)
    Sharpen(0.3)
    Thank you jagabo!
    Quote Quote  
  16. It looks amazing, here a few samples.
    Thank you jagabo.
    Image Attached Files
    Quote Quote  



Similar Threads