Log in

View Full Version : Resize to Aspect Ratio (4/3,16/19)


zerowalker
23rd August 2014, 11:59
Okay wanted to ask what the options are to make an accurate "manual" aspect ratio correction through resize.

This is mainly for use with Capture Card and a signal at 720x480.

But it will be either 4/3 or 16/9 in Square Pixels.

So, what are the options to correct this?

Is it just 640x480 and 853x480 (RGB conversion here....) ?
PAL is easier there though as it's just 768x576 and 1024x576, which both are upscaling and YUV compatible, but what to do.


And of course, which Resizing, is there any rules for that?

Through playing around, i am leaning towards Spline/Lanczos, rather than Bicubic and other Upscaling ones, as it just seems to blurry.

Thanks

TheSkiller
23rd August 2014, 14:50
My first advice if you want to do it right is, learn about the difference between so called ITU compliant scaling (using PAR, Pixel Aspect Ratio) and generic/MPEG scaling (using just the DAR, Display Aspect Ratio). Currently you seem to be aware of the latter only, but it's not that easy. :p

If you are capturing older analog sources simply resizing your 720x480 capture to 640x480 does not quite yield the correct aspect ratio in true square pixels. To do it right you would either have to scale from 720x480 to 654x480 or crop from 720 to 704 first before resizing to 640x480.

Without going too deep into the cruel details why it's like that it is simply related to how long the active analog image area is and the fact that 720 pixels cover a longer line than that. This is also the reason why usually you will find that not all of the 720 pixels carry image.


Is it just 640x480 and 853x480 (RGB conversion here....) ?640 loses some horizontal resolution, ableit it depends on the source if this is really any loss or not. An alternative would be 720x528 (ITU) or 720x540 (generic).

For 853x480 you can just round it up to 854x480; it is actually 853.333 anyway, so rounding it up introduces an error of only two thirds of a pixel.


And of course, which Resizing, is there any rules for that?Lanczos can be a bit more ringy than Spline but basically the differences are small. What's best really depends on what you prefer. Most people probably would agree that Spline and Lanczos are preferable over Bicubic for upsizing.

zerowalker
23rd August 2014, 14:57
Ah, have seen the ITU being mentioned, but never actually understood what it meant.

Currently i have never really bothered about it, as if a DVD or whatever is set to 16/9, it will stretch and i see what i am supposed to see (right?).

However, it's good to know about that analogue source thing, as i capture from VHS tapes and the like at times, and have always assumed,
that i should just capture at 720x576, and DAR to 4/3. But i guess that's incorrect?

This is also the reason why usually you will find that not all of the 720 pixels carry image.

Ah, always wondered about that, especially on non-tape sources.

640 loses some horizontal resolution, ableit it depends on the source if this is really any loss or not. An alternative would be 720x528 (ITU) or 720x540 (generic).

Confused here. For me 720x540 = 4/3 is correct.

Won't 720x528 be distorted?
Or is that the correct "4/3" is the source is ITU compiant or something?


I can probably make 2 captures to be able to know how my source act.

1 from the source, and 1 from the PC in with the same content.

Both should then be made to look identical (except noise, sharpness etc).
Actually did something similar before, but pretty much just played around with resizing till they were very close.

TheSkiller
23rd August 2014, 15:18
However, it's good to know about that analogue source thing, as i capture from VHS tapes and the like at times, and have always assumed,
that i should just capture at 720x576, and DAR to 4/3. But i guess that's incorrect?Almost certainly always it was incorrect, yes. But the error isn't so big that one would really notice.


Confused here. For me 720x540 = 4/3 is correct.Let me explain. So now you know that our 720 captured pixels cover an area that is slightly longer/wider than our actual 4:3 image within it. In return this means, if we resize straight from 720x480 to square pixels, without any cropping before doing so, we need to resize to a square pixel frame size that is slightly wider than 4:3, it's 15:11 to be precise. It's because we still have that extra space that makes the frame wider. The actual active image within it is perfectly correct.

That's why 720x528 would be correct, although it is a 15:11 frame rather than 4:3. But since that extra space is usually useless (black anyway) you might as well crop from 720 to 704 and resize just the height from 480 to 528 leaving you with 704x528 which is a perfect 4:3 frame but without the extra space. Makes sense? ;)



I can probably make 2 captures to be able to know how my source act.

1 from the source, and 1 from the PC in with the same content.Not sure what you mean by that. Isn't the VHS tape your only source?

zerowalker
23rd August 2014, 15:54
Almost certainly always it was incorrect, yes. But the error isn't so big that one would really notice.

Error is still an error, if it can be corrected, i would like to do it.;)

Let me explain. So now you know that our 720 captured pixels cover an area that is slightly longer/wider than our actual 4:3 image within it. In return this means, if we resize straight from 720x480 to square pixels, without any cropping before doing so, we need to resize to a square pixel frame size that is slightly wider than 4:3, it's 15:11 to be precise. It's because we still have that extra space that makes the frame wider. The actual active image within it is perfectly correct.

That's why 720x528 would be correct, although it is a 15:11 frame rather than 4:3. But since that extra space is usually useless (black anyway) you might as well crop from 720 to 704 and resize just the height from 480 to 528 leaving you with 704x528 which is a perfect 4:3 frame but without the extra space. Makes sen

So basically, you mean that black borders that always appear (but it's different depending on Device)?
If so, i understand the concept, but i can't say that it's always 16 pixels wide, i think it's quite random.
And some also have it at bottom or top (often 2pixel height).

Not sure what you mean by that. Isn't the VHS tape your only source?

In my case i am not talking about VCR in general, but my usage would be Game Consoles.

http://i57.tinypic.com/2mwibkk.png
http://i58.tinypic.com/jl068g.png

Here are 2 fairly similar images.
one is from Nintendo Wii, the other is from an Emulator (640x480).
Both should be "identical" except the characters movement.

So the correct resize from the Wii to 640x480 should make it look the same (except details and such).

Edit:

The closest i could get to mimic the Emulator image was this.

.Crop(8,0,-9,-2)
.AddBorders(0, 2, 0, 0, color=$000000)
.Lanczos4Resize(640,480)

TheSkiller
23rd August 2014, 16:59
Fits almost perfectly, have a look:

http://screenshotcomparison.com/comparison/88771


As your script suggests, I had to re-add the two lines you cropped off and then resized from 704x480 to 640x480, comparing to the 640x480 emulator screenshot.

The reason for those two black lines in your capture is probably the dreaded issue of nobody (even in the industry) really knowing which of the 486 lines that are actually needed to capture the entire amount of active NTSC lines need to be cropped for a domestic 480 lines result (but most source material, including consoles, do not make use of more than 480 lines, so don't worry).
If you have 2 black lines at the bottom either the wii places the active image 2 lines too early or your capture window starts two lines late. It's annoying because in this case you actually do lose 2 lines worth of video...

Why you rather need to crop 17 pixels than 16 to make it fit perfectly is most likely related to sub-pixel placement errors and/or very slight DAC/ADC inaccuracies. But it proves the Wii sticks to ITU scaling. The original Xbox and the Xbox 360 stick to ITU as well by the way; the PlayStation consoles, from 1-3, don't.

So basically, you mean that black borders that always appear (but it's different depending on Device)?
If so, i understand the concept, but i can't say that it's always 16 pixels wide, i think it's quite random.Yes, it is pretty much not fixed at all. It also depends on whether it's NTSC or PAL because they have slightly different active image widths. For analog PAL sources there will be almost always at least 16 black pixels while for NTSC it can be much less than 16.

But that doesn't change the aspect ratio at all – those different amounts of black originate from blanking the active signal at the edges, overriding slight amounts of actual image with black at some point in the video's history. But with clean digital sources such as the Wii you won't encounter this.

zerowalker
23rd August 2014, 18:21
If you have 2 black lines at the bottom either the wii places the active image 2 lines too early or your capture window starts two lines late. It's annoying because in this case you actually do lose 2 lines worth of video...
Damn that's something i didn't want to hear. But well in this case it's acceptable. It's most likely the Capture Card, as it always does have 2 lines at the bottom.

Hmm wonder though about another capture i have, which is from a DV camera, as there is 1 line top that's black.
So i am guessing i don't lose any information in that case?


Why you rather need to crop 17 pixels than 16 to make it fit perfectly is most likely related to sub-pixel placement errors and/or very slight DAC/ADC inaccuracies. But it proves the Wii sticks to ITU scaling. The original Xbox and the Xbox 360 stick to ITU as well by the way; the PlayStation consoles, from 1-3, don't.

But isn't 17 != ITU, how does that prove it to stick to it?

Yes, it is pretty much not fixed at all. It also depends on whether it's NTSC or PAL because they have slightly different active image widths. For analog PAL sources there will be almost always at least 16 black pixels while for NTSC it can be much less than 16.

But that doesn't change the aspect ratio at all – those different amounts of black originate from blanking the active signal at the edges, overriding slight amounts of actual image with black at some point in the video's history. But with clean digital sources such as the Wii you won't encounter this.

The PAL/NTSC difference i get.

But what do you mean with the other thing.

You mean that, let's say in NTSC on a Digital Device, i get 8 pixel width left/right border.
But on a VCR this may be different (ignoring tape borders)?


Here is a picture from a DV camera, confused how to act about this as it's uneven on left/right border.
http://i59.tinypic.com/11v4ie0.png

TheSkiller
23rd August 2014, 20:33
Damn that's something i didn't want to hear. But well in this case it's acceptable. It's most likely the Capture Card, as it always does have 2 lines at the bottom.I wouldn't worry about it because, more importantly, the capture looks very good as far as I can tell from a screenshot: the levels and colors certainly match the emulator quite exactly.


But isn't 17 != ITU, how does that prove it to stick to it?Because it's so close, almost spot on (~1 Pixel). If it wasn't ITU (meaning 720x480 = 4:3) the cropped and resized screenshot would be off by ~14 pixels and there would be no black border of 17 pixels to begin with.


But what do you mean with the other thing.Keep in mind the edges of video are not of much importance due to overscan at display stage (at least on a TV). Video produced and recorded with older equipment may lose minor parts at the edges that actually did contain real picture (even if was just on the camera's CCD sensor) at some stage(s). It's as if you use the Letterbox() filter. It overrides image with black but it does not change the proportions.

It's not your VCR or the VHS system that does that because the VCR just plays back what on the tape.

But on a VCR this may be different (ignoring tape borders)?Yes, borders can be smaller than 16 pixels for real analog sourced NTSC. Just like there can be picture in those extra 6 lines (486).


Here is a picture from a DV camera, confused how to act about this as it's uneven on left/right border.It's pretty much impossible to tell in such case whether the image really got slightly skewed horizontally or if there was just more blanking going on on the right side. If I was you I'd crop 6 pixels on the left and 10 on the right which leaves you with standard 704 pixels and the image pretty much centered.

zerowalker
24th August 2014, 08:15
I wouldn't worry about it because, more importantly, the capture looks very good as far as I can tell from a screenshot: the levels and colors certainly match the emulator quite exactly.

True, as it's Component i probably have that to thank for the accuracy.

Because it's so close, almost spot on (~1 Pixel). If it wasn't ITU (meaning 720x480 = 4:3) the cropped and resized screenshot would be off by ~14 pixels and there would be no black border of 17 pixels to begin with.

True, disturbing that it's not spot on, but as Analogue is never just that what to do. But that explains it.

Keep in mind the edges of video are not of much importance due to overscan at display stage (at least on a TV). Video produced and recorded with older equipment may lose minor parts at the edges that actually did contain real picture (even if was just on the camera's CCD sensor) at some stage(s). It's as if you use the Letterbox() filter. It overrides image with black but it does not change the proportions.

It's not your VCR or the VHS system that does that because the VCR just plays back what on the tape.

True, but does shouldn't be cropped right?
Overscan can easily be seen on anything this days, compared to the good old days.

I mean what should the Set rule be. Is it cropping the width to 704 and try to align it centrally like:
It's pretty much impossible to tell in such case whether the image really got slightly skewed horizontally or if there was just more blanking going on on the right side. If I was you I'd crop 6 pixels on the left and 10 on the right which leaves you with standard 704 pixels and the image pretty much centered.

And if so, how would you act with:

Yes, borders can be smaller than 16 pixels for real analog sourced NTSC. Just like there can be picture in those extra 6 lines (486).

As you can't crop 16 pixels without removing information?

hello_hello
26th August 2014, 16:58
True, but does shouldn't be cropped right?
Overscan can easily be seen on anything this days, compared to the good old days.

Even modern TVs overscan. Usually by default, but often it can be disabled. If you put your TV in 4:3 mode (where it displays the picture using a 4:3 aspect ratio with black borders down the side) I'm pretty sure you'll find your TV overscans. The same applies to 16:9 mode.

If you watch square pixel video using a USB media player or a PC though, chances are putting your TV into 4:3 mode isn't something you do often. I don't. I'm pretty sure my TV uses a straight 16:9 aspect ratio (when the input resolution is 720x576 over HDMI). I'm not sure about 4:3.

As you can't crop 16 pixels without removing information?

Sometimes you can't.
As a rule of thumb for DVD video, most 4:3 DVDs are ITU. If there's a decent amount of crud down the sides of a 16:9 DVD (8 pixels or more) it's probably ITU. If there's only a pixel or two it's probably 16:9.

In a perfect world you'd crop the crud (10 pixels one side, 6 the other, or whatever it takes), maybe remove the line or two of black top and bottom, leave the remaining height "as-is" and stretch the width to the correct aspect ratio (ITU or not ITU).

After cropping, in order not to distort the picture, mostly I adjust the cropping a little further so I can resize to exactly 16:9 or 4:3. Sometimes that involves cropping a little of the picture, sometimes more than a bit.
For 4:3 I resize to either 640x480 or 656x480 (the latter sometimes works better for ITU without needing to crop as much picture).

Technically it's better not to adjust the height when resizing but I invariably do. After removing a line or two top and bottom I'll often resize NTSC 4:3 back to 640x480. For PAL I mostly resize anyway. 960x540 for 16:9 or 640x480 for 4:3 helps keep the file sizes down a little and I rarely see any loss of detail.

There's an aspect ratio calculator here. It's an exe, but it's safe.
http://www.mediafire.com/download/09v9bldu9a6hm00/YodaResizeCalculator.exe
You select the input resolution, ITU or not, set your desired cropping and resizing and it'll calculate any aspect ratio distortion for you. That way you can fiddle with the cropping/resizing to reduce any distortion without needing to work it out yourself.

For reasons I don't understand, Yoda's Resize Calculator uses marginally different ITU pixel aspect ratios than most other programs. I'm not sure where it gets it's PARs from but the difference is very small. Yoda says 4:3 ITU NTSC has a display aspect ratio of 1.3656. The calculator built into MeGUI says it's 1.3674

That's another possibility. MeGUI's script creator calculates the aspect ratio distortion for you when resizing so you can adjust the cropping and resizing to minimise it.

zerowalker
26th August 2014, 17:39
Even modern TVs overscan. Usually by default, but often it can be disabled. If you put your TV in 4:3 mode (where it displays the picture using a 4:3 aspect ratio with black borders down the side) I'm pretty sure you'll find your TV overscans. The same applies to 16:9 mode.

If you watch square pixel video using a USB media player or a PC though, chances are putting your TV into 4:3 mode isn't something you do often. I don't. I'm pretty sure my TV uses a straight 16:9 aspect ratio (when the input resolution is 720x576 over HDMI). I'm not sure about 4:3.

Ah true, but well i only use my PC, so nothing ever overscans as long as it's not done by either the Capture card or it's "hardcoded".
But other than that, yeah pretty sure TVs overscan, other than the "HDMI Scan Mode" or what it's called. But then it's up to the TV box as well if you got that, as it may also Crop/Overscan or whatever before it reached the TV.

In a perfect world you'd crop the crud (10 pixels one side, 6 the other, or whatever it takes), maybe remove the line or two of black top and bottom, leave the remaining height "as-is" and stretch the width to the correct aspect ratio (ITU or not ITU).

Is this only if the capture card does this?
For example, mine as you saw, adds 2 botton and miss 2 at top, so i have to adjust this.
Not sure if it's Always there, but i think it is, meaning it's not the Device signal but the "Decoding", wonder if that can be fixed though, will need to contact the company.

EDIT: Forget that, it doesn't appear in another game, even though it appeared in 2 others, however this had A Lot more black border all around it.

After cropping, in order not to distort the picture, mostly I adjust the cropping a little further so I can resize to exactly 16:9 or 4:3. Sometimes that involves cropping a little of the picture, sometimes more than a bit.
For 4:3 I resize to either 640x480 or 656x480 (the latter sometimes works better for ITU without needing to crop as much picture).

How does cropping affect so you can resize to exactly 16:9 or 4:3?
Can't you do anything, like Crop all over the place, then just Resize to 640x480? (of course it will be distorted, but i mean it's technically 4:3)

Never heard of "656x480", is that a Legal resolution, and from the calculator, you mean it should be used if there is no black borders to crop (so no information is lost?)

hello_hello
27th August 2014, 06:08
How does cropping affect so you can resize to exactly 16:9 or 4:3?
Can't you do anything, like Crop all over the place, then just Resize to 640x480? (of course it will be distorted, but i mean it's technically 4:3)

That's all I was referring to, resizing without distorting. Sometimes doing so requires cropping a little of the picture too.

Never heard of "656x480", is that a Legal resolution, and from the calculator, you mean it should be used if there is no black borders to crop (so no information is lost?)

When it comes to resizing to square pixels just about any resolution is legal. It's no longer PAL or NTSC etc, it's just video.

If you were to resize a 4:3 ITU DVD without any cropping, then yes, 656x480 would be what I'd use as it doesn't distort the picture (less the 0.1%). If you need to crop a fair bit from the sides then 640x480 might be closer to being right.
Sometimes though, you might need to crop a bit from the top and bottom as well as the sides, so I'd use whichever resizing distorts the picture the least, then adjust the cropping if need be to minimise it.

Mind you, there's no rule which says you need to stick to those dimensions. Resolutions such as 640x480 and 704x528 were traditionally used because the video needed to be mod16 (both width and height evenly divisible by 16). These days it doesn't matter as much, especially when it comes to x264 encoding, in which case it doesn't matter at all.
If you want to be really safe, you can stick to mod4 widths (the width evenly divisible by 4) but the height can be whatever you like. Realistically though, players don't care any more. I've got lots of video with a mod2 or mod4 width or height and never had a problem playing it with an MKV/MP4 capable Bluray player or the media player built into my TV.

2Bdecided
2nd September 2014, 17:51
Here is a picture from a DV camera, confused how to act about this as it's uneven on left/right border.
http://i59.tinypic.com/11v4ie0.pngI think most people with that source, if wanting to create a clean square pixel no overscan encode, would just crop off all the black (and any "unclean" pixels/lines), and resize the result to 4x3 (or 16x9).

The exception is when what's left clearly isn't 4x3 (or 16x9) using ITU or generic because there was too much junk/black that needed cropping in one dimension vs the other, in which case you either need to add some clean black borders (or crop away actual content) to maintain the correct aspect ratio.

Resizing can be surprisingly benign for all but pixel-sharp sources, but obviously you can't vertically resize interlaced content before you deinterlace it.

Cheers,
David.