VideoHelp Forum

Try DVDFab Video Downloader and rip Netflix video! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 5 of 5
  1. I used this script on vertically shot phone YouTube footage attached which is 480 x 854p to upscale to 1080p:

    nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=1920, fheight=1080)
    I forgot it was vertical footage and needs to be upscaled to smaller dimensions and then borders added to keep the correct proportions. So what size should I upscale to and what size of borders should I add?

    Is there a calculation program I can use or a calculation I can do to figure out the correct upscale size for things such as this with weird dimensions?

    I know I used the wrong script but why did the video fail to encode and give this error?:

    nnedi3_rpow2: for YV12, YV411, YUY2 and YV16 input width must be mod 4 (482)!
    What does that mean? The input width is already 480 which multiplied by 4 is 1920. Is it saying the width needs to be 482? Why when that would give 1928 width?

    Also do you have a seperate script to make the picture as wide as possible while keeping everything in proportion - I know some of the top or bottom needs to be cropped to do that which is fine as there's nothing important there that needs to be kept. Don't care what size I end up with as long as it's 720p or bigger.
    Image Attached Files
    Last edited by VideoFanatic; 27th Oct 2020 at 10:29.
    Quote Quote  
  2. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Deep in the Heart of Texas
    Search PM
    How about you keep the political stuff off these boards, as per the rules, ok?

    In one sentence, you say you want to keep the aspect ratio, and then in another you say you don't mind cropping some of the image. These are at odds with each other.

    A universal resize formula is just plugging in the universal AR formula into the corresponding (matching) variable.

    The universal AR formula is:
     ( Resolution Width / Resolution Height ) * Pixel AR = Display AR
    In your circumstances, let's say you want to have matching DARs.
    W1 / H1 * PAR1 = DAR1 = 1.7777777 (aka 9/16), 9/16 being 16/9 rotated into portrait mode
    W2 / H2 * PAR2 = DAR2 = 1.7777777 (aka 9/16)

    Since the DARs match (DAR1 = DAR2), plug the rest in. Aka

    W1 / H1 * PAR1 = W2 / H2 * PAR2

    Since you know (or can confidently assume) that for both phones and HDTVs use square pixels, that means PAR1 and PAR2 are both 1.

    That means:

    W1 / H1 = W2 / H2

    Plugging in the numbers and solving for x,

    480 / 854 = x / 1080
    480 * 1080 / 854 = x
    Or ~607

    Since that's not mod4, round up or down to nearest mod4. In this case, that would be 608. This means that there will be a very minor AR mismatch (1 pixel's worth), but that can happen with modX constraints (especially constraints that don't apply equally to both sides). Not enough to worry about.

    So you resize to 608x1080. Then pad sides out to 1920 (simply = 1920 - 608 = 1312. Half that to 656 for each side).


    If you do want to crop, you have nothing matching, so it's a free-for-all and it's up to you how much you are comfortable cropping.

    Last edited by Cornucopia; 27th Oct 2020 at 00:29. Reason: Typo
    Quote Quote  
  3. I agree, either the content needs to be cropped or it should be resized to 656x1080 (normal resizer is good enough no gain from using nnedi3 here) and then letterboxing to 1920x1080 should be the way to go.

    I know I used the wrong script but why did the video fail to encode and give this error?
    without knowing the whole script: no clue, but it seems like nnedi3 things the input isn't 480, but 482 so you probably did something before feeding the input to nnedi3.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  4. Since both are square pixel the aspect ratio of an image is defined as:

    aspect_ratio = width / height
    Since you want the upscaled image to have the same aspect ratio as the old video:

    old_aspect_ratio = new_aspect_ratio
    old_width / old_height = new_width / new_height
    If you want the new height to be 1080:

    old_width / old_height = new_width / new_height
    old_width / old_height  * new_height = new_width
    480 / 854 * 1080 ~= 607.026
    You probably have YV12 of YUY2 so you need an even number. You can round up to 608. If you need a 1920x1080 frame add borders to the left and/or right.

    Another way to look at is: you're going to scale the height from 854 to 1080. A factor of 1080/854 = 1.2646... To keep the aspect ratio you want to scale the width by the same amount: 480 * 1.2646 = 607+.

    If you want to scale the width to fill a 1920 pixel wide frame you are going to scale by a factor of 1920x480 = 4. So also scale the height by 4: 854 * 4 = 3416. Crop that 1920x3416 to 1920x1080.
    Last edited by jagabo; 27th Oct 2020 at 11:37.
    Quote Quote  
  5. I wonder why I end up at 656,... LOL,.. I had another vertical clip in my temp download folder.
    -> I agree 608x1920
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  

Similar Threads