Log in

View Full Version : Anamorphic resizing


Pages : [1] 2

chipzoller
16th February 2007, 18:56
@blutach
The one sure way to determine this (and I'd trust the ripper) is to open the rip in PgcEdit, go to the main movie, right click and select Domain Stream Attrributes. This will tell you if it is 16:9 or 4:4 with hard matte.
This is the post I was referring to in my PM.

I'd like to re-open this and ask about proper anamorphic resizing. I've spent several hours reading various digests and tutorials about anamorphic and widescreen, namely:
http://www.dvdfile.com/news/special_report/production_a_z/anamorphic.htm
http://gregl.net/videophile/anamorphic.htm
http://en.wikipedia.org/wiki/Anamorphic

But would like to see if this method yields lowest quality loss and most correct intended AR. If a DVD says Widescreen (2.35:1) but enhanced for 16:9, the 2.35:1 is an indication of it being anamorphic, correct? And assuming I want to rip and encode the movie resizing back to the intended AR, is the most acceptable and lowest quality loss method to just do 720x304? Using this AR (closer to 2.36:1) only introduces a slight bit of AR error while still maintaining the mod16 dimensions. Basically, I understand the theory behind anamorphic and displaying it properly on TVs, but I'm mainly interested in how to resize this back to proper display ratio.

Bascially, I think it works something like this:

The image below is a direct capture from the DVD stream, which is 720x480. It contains black bars already encoded (and thus taking up space on the disc with this info.) in order to be compatible with fullscreen TVs (this part I'm not 100% sure about why exactly they are encoded directly into the frame)
http://czoller.myweb.uga.edu/orig.png

The next image is the same frame from the DVD but cropped to remove the encoded black bars. After this is cropped, the effective 'active' area of the picture we're concerned about is 716x358 (2:1 AR)-still not correct as you can see it's stretched on the vertical.
http://czoller.myweb.uga.edu/cropped.png

The final image below is then resized back to its intended display aspect ration of 2.35:1 resizing on the vertical to 716x304.
http://czoller.myweb.uga.edu/correct.png

So in short I ask you, is my logic correct in this process and for a full-resolution encode of the title is this final frame resolution correct in maintaining optimal quality while restoring the movie back to its intended resolution?

thanks for any help.

Turtleggjp
16th February 2007, 19:09
I think I have seen this before. It looks like the 2.35:1 movie has black bars added to make it 16:9 (1.77778:1). It is then encoded at 720x480 anamorphic 16:9. I think the most proper way to do this would be to resize the 720x480 to a 16:9 resolution (720x405 I believe) and then crop out the black bars that are left. Whatever this resolution is, should have the movie in its proper shape. The only problem is that when you resize video with black next to it, some of the edge pixels may get blended with the black. What I've done from here is noted this resolution, then gone back to the 720x480 size, cropped the black bars from there, then resized the video to the resolution I found earlier. This would hopefully eliminate the blended edges.

Matt

chipzoller
16th February 2007, 19:14
Well, this is my weekend project: to fully understand ARs and encoding/resizing the various ones.

Turtleggjp, if what you say is correct about resizing with black bars then cropping blurring edges, then is the method I outlined above "better"? Better aside, should my method also produce a correct frame shape?


EDIT: And likewise if the DVD says 1.85 widescreen (for which both IFOedit and PGCedit report 16:9 letterbox) and after cropping black areas from the left and right side of the frame it becomes 704, then the best vertical size would then be 384 to maintain as little AR error as possible while still maintaining mod16. Would this be considered "full correct resolution" to the resized frame? Or would this be the highest correct resolution given the DVD source resolution of 720x480?

chipzoller
16th February 2007, 19:57
Thanks for reminding me of that. After reading through it again I noticed one thing:

So the 720x480 stream will be stretched horizontally to 853x480 during playback. This allows to use the full vertical resolution of the DVD which retains maximum quality.

My reasoning was with the opposite dimension. I was assuming to keep maximum DVD quality that you would keep the full horizontal resolution (after cropping) and resize the vertical.

Is one better than the other? What is common practice for retaining maximum quality?

IanD
16th February 2007, 20:32
I've spent most of my Christmas vacation archiving my dvd collection to a media server using ripit4me with Decrypter and FixVTS. I'm up to 150 movies and counting, but have stumbled on several movies that say they are 16x9 but the ripping software says they are 4x3, what gives? BTW some say "with black bars" so those I understand, but others appear to be anamorphic, yet they also rip as 4x3...

I notice that when I play these back (using Media Player Classic) the window that my MPC displays is indeed 4x3 but the image of the actual movie inside this frame is 16x9.

Can someone enlighten me? Also, once I start playing these movies back on my 16x9 HDTV, I'm concerned about formatting. How will these movies appear on my tv? WIll I be able to stretch the actual movie image to fill my 16x9 display area on my tv?

Thanks!

brad
The basic standard DVD frame is 720x480 (for NTSC) or 720x576 (for PAL). There are other "standard" resolutions, but for the purpose of this exercise, we will concentrate on this basic standard.

Unlike HDTV, HD formats or other video formats (e.g. divx) where the frames are sized to suit the actual image, DVD always uses 720x480 or 720x576, regardless of how much of the frame is occupied by actual image and so may have some part of the frame wasted with useless black pixels.

Within this frame, the image can represent full-screen (i.e. fills a 4:3 aspect TV screen), letterbox (i.e. the image occupies a band across the 4:3 screen with black bars of varying widths above and below depending on the image aspect ratio) or anamorphic (i.e. the letterbox image is stretched vertically to occupy more of the frame so that a 16:9 movie occupies the full frame and other aspect ratios have varying sizes of upper/lower black bands: this stretch is unsqueezed on playback).

The first 2 options (full screen or letterbox) are flagged as 4:3 and designed to display on a 4:3 TV with the correct aspect ratio. The 3rd option (anamorphic) is flagged as 16:9 and designed to display on a widescreen TV with the correct aspect ratio.

It is up to the player and display device as to how the frame is scaled for display.

When output to a 4:3 TV, the first 2 options are output unchanged, whilst the 3rd is either scaled to letterbox or a 4:3 portion of the widescreen image extracted from the centre.

When output to a widescreen TV, the first 2 options have black bars applied on the sides, whilst the 3rd is stretched horizontally to fill the screen width (thus restoring the correct aspect ratio).

There may be additional zoom options on the player and TV to provide more flexibility in displaying letterbox on a widescreen TV. In theory, zooming in on a letterbox frame should enable filling the full widescreen TV width (instead of having black bars all round the image).

Some DVD cases say 16:9, when in fact the movie frame is actually letterbox and not anamorphic. A letterbox DVD (with a movie aspect of 16:9) would display in MPC as a 4:3 window with a 16:9 band of movie inside it. It is generally unreliable to go by what is printed on the DVD case as there does not appear to be a widespread standard adopted within the industry to describe the formatting of the content and much different terminology is used. Hopefully though, the aspect ratio flagging on the disc will be correct, but even this can not always be guaranteed and I have seen a few examples where the wrong flagging was applied.

It is possible to use Ifoedit to modify the .ifo files in a DVD structure to change the aspect ratio flagging if it is incorrect. DVDs are flagged as either 4:3 or 16:9 and then additional 4:3 Pan&Scan or letterbox "hints" are also provided to assist the player in scaling those formats depending on how the image is actually constructed within the frame.

How the 3 DVD aspect options will appear on your HDTV is dependent on the abilities of your player and TV zoom functions.

chipzoller
16th February 2007, 20:34
I've also noticed for one of my discs that Widescreen 1.85:1 is printed on the back cover, yet it gets displayed as 16:9 widescreen. Why is this? Which DAR is correct here as there's no DAR flag for 1.85:1.


EDIT: I understand what's going on here. The camera captured the film at a ratio of 1.85:1 yet because this isn't a standard AR value, when the DVD was produced, they letterboxed or added black bars around the picture to produce a frame AR of 16:9 even though the active area is still 1.85:1. At least I think this is what's going on :)

r0lZ
17th February 2007, 08:14
Your edit is right. The movie has been filmed in Cinemascope, and no TVs have the proper aspect ratio to display it without black borders. Therefore, it is necessary to letterbox the image in a 16:9 frame. Hence the black bars. This is also why PgcEdit reports it as 16:9. Being an IFO editor, it cannot know the original AR of the movie, but only the AR of the encoded video frame, including the black bars.

I fully agree with the explanations of Turtleggjp and IanD above. But note that you have to take the pixel aspect ratio of the target display into account when you resize the image. The pixel AR is (usually) 1:1 on a PC monitor, but is different on a PAL and NTSC TV. The method explained by Turtleggjp assumes you do not change the target device, and is therefore suitable only if you want to display the movie on a NTSC TV.

chipzoller
17th February 2007, 14:39
@r0lz, thanks for your response, however could you look at my 3 previous posts and tell me your impressions? I'm particularly interested in which axis to keep and which to resize; to do as Doom9's guide suggests and keep the vertical but resize larger on the horizontal, or vice versa.

But note that you have to take the pixel aspect ratio of the target display into account when you resize the image.

I'm assuming a PC in all these instances, but I think I understand his point that for display on a TV via a DVD player, you just have to resize the frame to a 16:9 rez and not correct for the anamorphic properties. The device should "unsqueeze" it on playback, at least this is what I understand. I could be wrong.

cc979
17th February 2007, 15:00
@r0lz, thanks for your response, however could you look at my 3 previous posts and tell me your impressions? I'm particularly interested in which axis to keep and which to resize; to do as Doom9's guide suggests and keep the vertical but resize larger on the horizontal, or vice versa.



I'm assuming a PC in all these instances, but I think I understand his point that for display on a TV via a DVD player, you just have to resize the frame to a 16:9 rez and not correct for the anamorphic properties. The device should "unsqueeze" it on playback, at least this is what I understand. I could be wrong.

regarding the AR stretching, the human eye is more sensitive to the vertical - that's why it's better to stretch horizontal

r0lZ
17th February 2007, 17:23
IMO, the choice of resizing horizontally or vertically depends again of what you want to do.

If you plan to display the resized material on a TV, it is better to have exactly the number of scanlines supported by the TV (ie 480 or 576) as the hardware vertical resize introduces usually visible artifacts, and can create watered effects. Also, on analog TVs, the number of lines is really fixed, but the number of pixels per line is only a convention. You can freely change it. (This is why the DVD standard supports several horizontal resolutions (720, 704 and 352) but only one vertical resolution per video standard (480 or 576.) This consideration is especially important if your source material is interlaced.

Of course, if you want to display the material on a monitor or a digital TV, do not take my explanation into account. I have never heard that the eye is more sensible to the vertical dimension, but it's possible.
Anyway, you should take another fact in consideration. If you want to reencode to a relatively small file, it is better to reduce the image, as it gives usually better results than compressing more a larger image. But if disc space doesn't matter, I suggest enlarging the width.

The formula to resize Cinemascope for a display with 1:1 pixels is very simple: multiply the (real) height by 2.35 to compute the width, or divide the width by 2.35 to compute the height.

Note that some codecs require an height (and also sometimes the width) being a multiple of 8, 16 or even 32! So, you might be forced to crop the image a little bit before encoding!

chipzoller
17th February 2007, 19:23
r0lz,

If you want to reencode to a relatively small file, it is better to reduce the image, as it gives usually better results than compressing more a larger image. But if disc space doesn't matter, I suggest enlarging the width.


Let's say for example that I'm shooting for 1 CD rips (~710MB for overburn) and that everything less than or equal to 2 hours 20 minutes will be encoded with this amount in mind and that the source material is anamorphic, you suggest down-sizing the resolution rather than keeping it at max size (again, either keeping the vertical rez. and stretching on the horizontal or vice versa) in this case?

This is a bit off topic, but I was under the impression that encoding at a larger frame size would ultimately yield a higher picture than encoding the same material with a smaller frame size (but obviously still a correct AR) and letting the software player (again, all this with computer software players and monitors assumed) stretch upon full-screen playback.

r0lZ
17th February 2007, 19:29
Putting more than 1.5 hour on a CD is difficult without loosing quality. So, yes, I suggest reducing the image. An half resolution is really better than full-res badly encoded.
IMO, 720x306 is still a bit too large for a good compression.

chipzoller
17th February 2007, 19:34
Is it important to mention that I have x264 in mind as a compressor with everything turn on/up to the max? Wouldn't that determine or allow a higher than usual frame size?

r0lZ
17th February 2007, 19:40
I suppose so, but honestly, I haven't used that compressor yet. I prefer to copy the DVDs on DVDs! ;)

chipzoller
17th February 2007, 19:56
Ok, well let me see if I have this down and I'll leave you alone :)

If I take a DVD source that after cropping the frame size is 720x358 (which indicates it's stored as anamorphic widescreen based on these cropped only dimensions???), then to return to a FULL resolution as it would be displayed on a widscreen TV (meaning, if I'm not mistaken, that it must be stretched on the horizontal) the final encoded resolution would be something like 840x358?

So the cropping and resizing portion of the script would just be:
crop( 0, 60, -0, -62)
BilinearResize(840,358)

Am I on the right track here?

525/60
17th February 2007, 20:29
PAR is a ratio which explains how much each pixel needs to be stretched; it is independent of the starting frame and the destination frame.

720x480 --> 16x9 yields a PAR of (480·16)÷(720·9)=32÷27=1.185

Yet according to from the DVDFAQ by Jim TaylorFor anamorphic video, the pixels are fatter. Different pixel aspect ratios (none of them square) are used for each aspect ratio and resolution. 720-pixel and 704-pixel sizes have the same aspect ratio because the first includes overscan. Note that conventional values of 1.0950 and 0.9157 are for height/width (and are tweaked to match scanning rates). The table below uses less-confusing width/height values (y/x * h/w).

720x480 720x576
704x480 704x576 352x480 352x576
4:3 0.909 1.091 1.818 2.182
16:9 1.212 1.455 2.424 2.909

Two things jump out at me from this:
1) there is no PAR of 1.185,
2) the proper pixel aspect ratio corresponds to

704x480 --> 16x9 yields a PAR of (480·16)÷(704·9)=40÷33=1.212

The same thing works for PAL. That is, the easiest way to resize is to clip to a width of 704 from 720 and then resize to the proper DAR (16:9 for anamorphic; 4:3 for regular). The discarded video content can't be viewed on an interlaced TV anyway because it is in the overscan. Interestingly, if you author your DVD 704 pixels wide, you get the exact same aspect ratio and you see the exact same amount of picture when viewed on the telly. Of course, I know this is not what you are doing, but my point is that what can't be seen on the TV anyway can't be a critical loss.

Knowing that the exact PAR is 40:33 allows you to fudge in the right direction, for instance, applying a par of 40:33 to the 2:1 ratio frame yields a ratio of 80:33=2.42. So now I know that anything between 2.35 and 2.4 is an acceptable fudge factor.

In your case, I would have clipped to 720x360 (2:1 AR) and then resized to 720x304 (720x300 is more accurate, but then you lose the multiples of 16) or clip to 704x360 and resize to 768x320 or for spot-on accuracy clip to 704x480 and resize to 768x432 and then clip to 768x320.

OK, so in your case, if you want to make it smaller than what I just suggested above, clip to 704x480 and resize to 704x396 and clip to 704x288. clip, resize, clip is the only way to get spot-on accurate results; its the factor of eleven from 704 that throws a monkey wrench into the works.

I'm not saying it makes any practical difference if you are perfectly accurate or not. My point is to clear up the common misconception that 720x480 --> 16x9 equalin a ratio of 1.185 is the proper PAR for anamorphic NTSC DVDs; it's not. Also I am pointing out that a movie that has a DAR of 2.35 can be more accurately resized to a 2.4 DAR; this I first noticed with the movie 'Matrix'. (again, clipping to 720x360 gives a 2:1 AR multiplied by a 40:33 PAR yields a 2.42 DAR)

I know this is getting long, but maybe I can respond to the websites cited above where appropriate?

Regarding the Wikipeadia article, I like to use the term Scope also and agree that the proper DAR is 2.4 (stretch a 2.35 movie it to a 2.4 DAR if you clip off the matting first), but skip to the 'DVD video' section to understand how the term anamorphic applies to DVD. 'The World's Easiest Explanation' neither confirms nor contradicts my observation since it does not spend a lot of time discussing the 720x480 pixels that are stored on a DVD. It focuses on DAR but not PAR. Again, DVDFILE.COM 'What the Heck is Anamorphic DVD?' sticks strictly to a discussion of DAR, not PAR. PAR is what you need if you want to convert the PAR from the DVD to the 1:1 ratio PAR of your computer screen.

Finally, my earlier suggestion to resize up to 768x320 for a scope picture will maximize, in my experience, the resolution of the picture. In general, stretching one dimension while squeezing the other preserves maximum detail while maintaining sharpness. Stetching it as wide as 864 or 960 as in 720x360 --> 960x396 or 720x480 -->960x528 clipped to 960x400 or (using a PAR of 1.2 instead) 720x360 --> 864x360 maintains maximum resolution.

These are the maximum resolutions, but if you maximize sharpness instead of the total resolution, as in 768x320, it scales better for full screen viewing. Using a PAR of 1.2 gives a simple resize ratio or 6:5 which will also help to maximize sharpness and detail. It is also vastly easier than struggling with the correct PAR of 40:33 with its nasty factor of 11 to deal with and it can also be seen as a compromise between the correct ratio of 1.212 and the more commonly used ratio of 1.185, since no one seems to notice the error of the latter, why not use the simpler 1.2 ratio?

Stephen

chipzoller
17th February 2007, 22:25
Stephen, thanks for the response but I feel I'm getting more confused. Can you at least tell me what you think about my previous post? I want to keep it simple for as long as possible here.

525/60
17th February 2007, 23:08
@chipzoller
My previous post took me 4 hours to write, so I missed your discussion with r0lZ.

@r0lZ
Our use of the term PAR are not in harmony.

@all
I haven't addressed the thread directly yet, so here goes.

@chipzoller
So the 720x480 stream will be stretched horizontally to 853x480 during playback.
This implies a PAR of 1.185 which is the common misconception I spoke of.

So your script should look like this instead:crop( 0, 60, -0, -62)
BilinearResize(872,358)orcrop( 8, 60, -8, -62)
BilinearResize(840,358)Both imply the exact same PAR, but a different DAR.

But as previously stated, a compromise PAR of 1.2 might yield the best results due to a sharper scaling factor.crop( 0, 60, -0, -60)
BilinearResize(864,360)I also switched to a mod 16 frame to accomodate the MPEG macroblocks.

For the sharpest possible picture that resizes to full screen better, go a little smaller withcrop( 8, 0, -8, -0)
BilinearResize(768,432)
crop( 0, 56, -0, -56)And for better compressioncrop( 8, 0, -8, -0)
BilinearResize(640,360)
crop( 0, 48, -0, -48)It cuts the top and bottom off a little and is not mod 16 but mod 8, yet it uses the most accurate PAR of 1.212.

I have experimented with re-sizing for the computer a lot, although now I am concentrating on DVD and VCD instead of Divx. For VCD, I might use the codecrop(8,0,-8,-0)
ReduceBy2
to keep the aspect ratio of the original.

Have a nice day.

Stephen

chipzoller
17th February 2007, 23:35
Stephen, thanks again for your answer, but perhaps you should look at my last and most enlightened post (http://forum.doom9.org/showthread.php?p=955761#post955761) that concurs with your last post and code:crop( 8, 60, -8, -62)
BilinearResize(840,358) except I didn't crop on the left and right sides because that contains picture information and not black pixels.

For the code you posted, lets assume I did crop 16 pixels off the horizontal, this would leave me with a cropped frame size of 704x358, which would still mean to achieve the least amount of aspect ratio error while upholding a mod8 resolution I'd have to resize to 840x358.
Can someone at least address this post and #15 (above) to make sure I'm correct thus far?
I appreciate all the help and advice I can get!

525/60
17th February 2007, 23:54
@chipzoller

Sorry, again I missed your post while posting my own. But I think I am making it clear enough by giving you some concrete examples using the AviSynth scripting language. A scripting language is nicely unambiguous.

I tried to explain how I derived the NTSC PAR of 1.212 and did cite a good authority backing me up with the DVDFAQ by Jim Taylor.

The way you apply the PAR is by multiplying the starting AR by the PAR to get the DAR as in 1.5 times 1.212 equals 1.818 which in terms of exact ratios is:

720x480 times 40:33 equals 20:11

to see the relationship with what you know, let's express it like this:

704x480 times 40:33 equals 16:9

So you see, on a computer, the correct target for anamorphic video is 20:11 instead of 16:9, because on the TV the two sides are cut off due to overscan. This applies to both NTSC and PAL even though the PAR for PAL is different:

704x576 times 1.455 equals 16:9

Both NTSC and PAL have the same scan line length and nearly the same speed. The difference is that the refresh rate for PAL is a little slower which gives it more time to scan more lines for each frame. This is because the framerate is synced to the frequency of the alternating currnet (AC). In PAL countries, the frequency of AC is 50 Hrz and in NTSC countries, AC is 60 Hrz. It is really interlace fields per second, but I am focusing on the relative difference: PAL has more time to write more scan lines for greater resolution per frame, but a slower frequency for video. For Film it effectively has a higher frequency as well as a higher resolution, but then the trade off is that NTSC can store more minutes of Film for the same data rate. For video, the same data rate will yield an equal amount of minutes on DVD.

Stephen

525/60
18th February 2007, 00:11
@chipzoller
I will be very brief:crop( 8, 60, -8, -62)
BilinearResize(840,358)The above code is wrong:( :(
crop( 8, 60, -8, -62)
BilinearResize(872,358)THIS is right:D :D

A PAR of 1.185 will leave your avi slightly too narrow. The correct PAR is 1.212 which correlates to:

704x480 times 1.212 yields 16:9 or 1.778

But it is not necessary to crop the sides:

720x480 times 1.212 yields 20:11 or 1.818

So 20:11 is the proper DAR for anamorphic DVD on your computer.
872:480 is approx. equal to 20:11.
872:720 (1.211) is close to the ratio 40:33 (1.212).

Stephen

chipzoller
18th February 2007, 01:44
Well, I'm all but totally confused right now. I was hoping this wouldn't drag into a discussion of pixel aspect ratios because I don't fully understand proper resizing much less pixel ratios. But I desperately want to learn how to do something so simple as cropping and resize correctly yet each post confuses me further.

(sigh) let me try to pull my dumb ass out of the clouds here. Please bear with me and I apologize I seem so utterly dense. I'm really not.

Stephen, you say this is correct:
crop( 8, 60, -8, -62)
BilinearResize(872,358)
Just for clarity's sake when I go back and spend the 12 hours necessary to re-read this thread tomorrow, the process for this cropping and resizing does the following: Crops 720x480 to a resolution of 704x358 thereby removing overscan (I think). The resizing produces an end frame of 872x358 which has a DAR of ~2.44 (rounded to the closest hundredth).

But then you say 720x480 times 1.212 yields 20:11 or 1.818. I interpret this to mean that ONLY with anamorphic widescreen content, to find the proper display aspect ratio (DAR) on a computer you multiply the DVD aspect ratio (720/480=1.5) by the correct pixel aspect ratio (PAR) that you said is 1.212 to get 1.818.

And before this you state OK, so in your case, if you want to make it smaller than what I just suggested above, clip to 704x480 and resize to 704x396 and clip to 704x288. clip, resize, clip is the only way to get spot-on accurate results; its the factor of eleven from 704 that throws a monkey wrench into the works. But this end DAR is 2.44

I know that PAR is an important consideration, but we can't manipulate that; all we can do is alter the shape of the video frame size and thereby altering the pixel shape. So while PAR is important but behind-the-scenes info., our end consideration must ultimately be the frame aspect ratio. So the way I see it is PAR directly influences DAR.

I know you've spent a lot of time responding in this thread and I hope eventually people that have the same problems will be able to refer to this (maybe even as a sticky?). But is there some way you can really explain concretely for an idiot (at the time being) like myself? I'm literally pulling my hair out trying to comprehend this stuff yet I get balder with each successive post. What do you think, should I just shut up, not think so hard, and use the same code for each source? I don't mean to cause undue pain and a waste of anyones time :( :stupid:

525/60
18th February 2007, 04:15
In case all the numbers I am throwing around are confusing, here are my recommendations in order of decreasing resolution:

#PAR 1.211
crop( 0, 64, -0, -64)
BilinearResize(872,352)#PAR 1.2
crop( 0, 64, -0, -64)
BilinearResize(864,352)#PAR 1.212
crop( 8, 0, -8, -0)
BilinearResize(768,432)
crop( 0, 56, -0, -56)#PAR 1.212
crop( 8, 0, -8, -0)
BilinearResize(640,360)
crop( 0, 48, -0, -48)Here is a frame from the Matrix movie in the original AR followed by the resized versions of the same frame.
6800

6801

6802

6803

6804
The main point of these attachments is to demonstrate how little the slight cropping of the 'active area' affects the result. The correct AR renders the skewed perspective more forcefully, I think. 'Dodge this.'

Stephen

chipzoller
18th February 2007, 04:30
Thanks. I'll save these and do some tests soon. But could I also beg you to look at my last post (#22) and put some of those things to rest when you have a chance? I want to understand the concepts behind your suggestions but need to clear up a few inconsistencies in my mind first.

EDIT: Also something else I wanted to ask. Would it perhaps be easier to just go from the DVD resolution and crop any black bars, then set the 2.35 AR in the container (AVC in MKV for example)?

r0lZ
18th February 2007, 04:36
In the past, when I encoded my movies in XviD, I have written a little tool to compute easily the target resolution for any pixel aspect ratio. It might be useful. You can download it here (http://download.videohelp.com/r0lZ/pgcedit/third_party/r0lz/ResCalc.zip).

You have to enter the source pixel aspect ratio and image dimension, the target pixel aspect ratio and the eventual constraints of the encoder. Don't worry, there are presets. Then, use the slider to find a good target resolution, with the minimal error.

There is also an advanced mode, but don't ask me how it works! I haven't used this program since a while!

chipzoller
18th February 2007, 05:01
r0lz, thanks so much! I think this will come in very handy at least until I emerge from my idiot state :)

One confirmation question about its usage relating to anamorphic:

If you're trying to compute the best resolution (lowest AR loss) with anamorphic, for the source resolution you have to determine the frame size AFTER cropping the black bars from the top and bottom, correct? If it's normal 16:9 widescreen you just go ahead (since the vertical rez. is not matted)?

I've attached 4 files from 2 different DVDs I have. The first is "Dr. No" (1962) and is not anamorphic (right?) from the first pic, which is the original unresized from the DVD. The second I've cropped the right and left sides and correctly(?) resized to 768x432 which introduces no AR error(?).

The last two pics are from "For Your Eyes Only" (1981) and shows the first unresized and straight from the DVD while the second shows the black bars cropped from the top and bottom and resized to 800x328 which only introduces 0.05 of AR error.

Can you please tell me if my math and judgment is best (or at least correct)? Do I understand this correctly?

525/60
18th February 2007, 08:18
@chipzoller
Your specifically mentioning the overscan made me notice my mistake:crop( 8, 60, -8, -62)
BilinearResize(872,358)The red is wrong, there is no need to crop the sides if you stretch it that much.

The math is:
720 times 1.212 PAR equals 872.72crop( 0, 60, -0, -62)
BilinearResize(872,358)is what I meant, as I wrote in my subsequent post.

It bothered me that I did find a low resolution resize that does not crop the sides. Initially, I thought the wide DAR of 2.5 was unacceptable, but that is not the case:LanczosResize(640,352)
crop(0,48,-0,-48)
This works very nicely, as the attachment verifies:6812
Basically, I do not think it is important to get AR perfectly. What bothers be is the mistaken notion that causes most people to derive a PAR of 1.185 instead of the correct PAR of 1.212.
The quote that I find just plain wrong is:So the 720x480 stream will be stretched horizontally to 853x480 during playback.853÷720=1.185 PAR
Properly 720·1.212=872
So the quote should have been:So the 720x480 stream will be stretched horizontally to 872x480 during playback.However, if you play that on an interlaced TV, only 853 worth of each line will be visible, the rest will be lost in overscan. Still, you have to stretch it that much to get the proper AR on a computer screen, where you can see the whole line and where there is no overscan. That is a run-on sentence of course.

Bear in mind that the pixels on a TV are not square. 704x480 gets squished into a 4:3 DAR without any resizing on a TV, but on a computer the 704x480 frame must be resized to 640x480 due to the computer 1:1 AR.

Regarding post 22, I have already explained my mistake with the resize. Yes, I have been discussing only anamorphic, although a parallel problem arises for non-anamorphic: The proper DAR for 720x480 DVD is 15:11, not 4:3; the PAR is 10:11. So what is the proper DAR for a 704x480 DVD?

Stephen

525/60
18th February 2007, 08:25
@chipzoller

Regarding your post 26, I am not going to respond for now, because I think you will catch your mistakes as you take the time to read more and think it through tomorrow (today, I mean next).

Stephen

blutach
18th February 2007, 09:18
Guys,

In order to get attachments quickly displayed and not wait for us to come along, you might consider www.imageshack.us

Regards

r0lZ
18th February 2007, 11:19
If you're trying to compute the best resolution (lowest AR loss) with anamorphic, for the source resolution you have to determine the frame size AFTER cropping the black bars from the top and bottom, correct? If it's normal 16:9 widescreen you just go ahead (since the vertical rez. is not matted)?Right.

The first is "Dr. No" (1962) and is not anamorphic (right?) from the first pic, which is the original unresized from the DVD. The second I've cropped the right and left sides and correctly(?) resized to 768x432 which introduces no AR error(?).I assume the source is 4:3, not anamorphic, but it is difficult to be sure with the image you have posted.
Not sure what you did, but I have those values:
Pixel AR: I've selected "NTSC 4:3 - 10:11" from the dropdown list, which gives 0.909090909091.
I've used 708x480 as the resolution.
I assume a target square pixel AR of 1.
With a constraint to blocks of 16x16 (not sure it's what you need), I obtain a final resolution of 592x448 (error is 1.47%, negligible.) This is really a 4:3 image, with a minimal error. We can verify that easily, as the target pixel is square. The horizontal resolution must be approximately 1.33x the vertical one. 592/4*3=444. That's correct.
Obviously, you don't have the same thing at all. Have you assumed a 16:9 movie?

The last two pics are from "For Your Eyes Only" (1981) and shows the first unresized and straight from the DVD while the second shows the black bars cropped from the top and bottom and resized to 800x328 which only introduces 0.05 of AR error.
In this case, I use the NTSC 16:9 - 40:33 (1.21212121212), 720x360 for the source. No change in the target. For a width of 800, I obtain 336 for the height, with an error of 1.82%. 800/2.35 = 340. Again, it's a very minimal error.
IMO, a better resolution is 704x288 (error 0.83%), or, if you don't want to resize horizontally, 720x304 (2.36%).

Note that the target pixel aspect is exactly square on a PC monitor for the resolution 1024x768 (1024/4*3=768) but not for 1280x1024 (as 1280/4*3 = 960, not 1024) but it is good practice to consider the pixel as square for a PC display. The difference is minimal anyway. If you want really square pixels, you have to use 1280x960.

chipzoller
18th February 2007, 14:19
@r0lz,
I assume the source is 4:3, not anamorphic, but it is difficult to be sure with the image you have posted.
Not sure what you did, but I have those values:
Pixel AR: I've selected "NTSC 4:3 - 10:11" from the dropdown list, which gives 0.909090909091.
I've used 708x480 as the resolution.
I assume a target square pixel AR of 1.
With a constraint to blocks of 16x16 (not sure it's what you need), I obtain a final resolution of 592x448 (error is 1.47%, negligible.) This is really a 4:3 image, with a minimal error. We can verify that easily, as the target pixel is square. The horizontal resolution must be approximately 1.33x the vertical one. 592/4*3=444. That's correct.
Obviously, you don't have the same thing at all. Have you assumed a 16:9 movie?
Yes, I assumed widescreen because this is a DVD that says widescreen format on the case. And just for testing purposes I resized to a 4:3 resolution assuming a true frame size of 704x480 and resized to 640x480 (so no AR loss) and it definitely does not look right. And that's another big question I had; How to tell the aspect ratio just by looking at the video stream itself?


In this case, I use the NTSC 16:9 - 40:33 (1.21212121212), 720x360 for the source. No change in the target. For a width of 800, I obtain 336 for the height, with an error of 1.82%. 800/2.35 = 340.Then we did the same thing only I used 720x328 (and cropped off 2 more pixels on the bottom than you did), but I think we're close enough.

I'm going to read the last few posts very carefully now...

r0lZ
18th February 2007, 15:03
I can't be sure it is 4:3 by looking at your image, as it is difficult to see if it is stretched vertically or not.
Usually, I use PgcEdit to examine the aspect ratio of the title domain. But you can also use any software player, and look at the size of the video window. (I mean the real window, including the black borders, if any.)

Note also that, in a DVD, the aspect ratio must be either 4:3 or 16:9 anamorphic. It cannot be something else.

Of course, there is also the possibility to have a 16:9 video letterboxed in a 4:3 container, with black borders. But for ResCalc, you have to give the pixel aspect ratio, which, in this case, is 4:3, even if the original movie is 16:9.

Anyway, if your movie is coded in 16:9, your calculation is right. 768x432 is correct. But you can also use, for example, 800x448, or, for a better compression, 544x304.

Your calculation for the second movie is correct. 2 pixels less can explain the little difference.

chipzoller
18th February 2007, 15:31
@r0lz
Usually, I use PgcEdit to examine the aspect ratio of the title domain.IfoEdit reports the title domain is 16:9 letterboxed, so I guess that settles it. Even if it didn't I can clearly see when resizing to 4:3 and 16:9 that the former is much distorted and therefore cannot be correct.

@all
I think I understand how best to go about determining correct aspect ratios now, but let me try and get you guys to tie up some loose strings I have by addressing them directly. You see, even though to yourself what you may be saying makes sense, to someone else who doesn't see it that way it may not make sense at all. So let me pose these questions directly and hope for a direct response:

I earlier asked How to tell the aspect ratio just by looking at the video stream itself? to which r0lz responded there is only 4:3 or 16:9 coding of pictures, which I understand. What I had to realize is that this is only the DVD encode FRAME and NOT the actual active picture information. Anamorphic is encoded within a 16:9 frame, but the active picture information is not 16:9, it's just that we must use the PAR of 16:9 to restore it to its correct DAR. The way I saw this was like the following: xyzMovieReal -> 16:9 encoded frame=xyzMovieStored | xyzMovieStored -> 16:9 decoded=xyzMovie Real. If this makes sense I'm not sure, but what I realized is that a movie, regardless of it's active frame captured from the camera, coded in a certain AR must be returned via that AR to achieve the correct end-result look.

So in summary, the end dimensions of an encoded anamorphic frame should be closer to 2.4 AR than 2.35. This is what I've gathered from all these posts.

r0lZ
18th February 2007, 17:34
A final note:
I have already seen several commercial DVDs where the original image aspect ratio was not respected at all. The movie was cropped! (This is normal in pan & scan DVDs, but when they precise that the original dimensions are respected, they should not crop the image at all!)
Furthermore, due to human errors, the pixel aspect ratio might be wrong also.
Therefore, use the rules with caution. It might be necessary to compensate those errors. Your eye is the final judge.

Also, note that the "letterboxed" flag displayed by IfoEdit (and PgcEdit) doesn't mean that the movie has black borders in the DVD. This flag instructs the player of what it must do when a 16:9 anamorphic image is displayed on a 4:3 TV. When the letterbox flag is set, the player must shrink the image vertically and add black borders to build a 4:3 image, compatible with the old TVs. When the Pan&Scan flag is set, it must zoom in the image, and crop the left and right borders. When both flags are set, the user preference (configured via the player menu) takes precedence. At least one flag must be ON. Usually, the pan&scan flag is used only in menu domains.

On the other hand, there is also an "already letterboxed" flag for the 4:3 mode. (I think it is called "top and bottom cropped" in IfoEdit.) When this flag is set, the player must send a signal to the 16:9 TV to tell that the image is not really a 4:3 image, but rather, a 16:9 image already letterboxed in a 4:3 container, with black horizontal borders. The 16:9 TV can therefore automatically zoom in the image to display it full screen. Of course, that's not at all 16:9 anamorphic. Unfortunately, very few TV and/or players support that.

In your second James Bond above, the Cinemascope movie is letterboxed in a true 16:9 anamorphic container, and a 16:9 TV cannot zoom further, as the image occupies already the full width. This is not an "already letterboxed" 4:3 image.

525/60
18th February 2007, 20:41
even if the original movie is 16:9
@r0lZ
16:9 is not a move aspect ratio, it is a television aspect ratio.

A movie can be in that AP if there are no matte bars above and below, but it probably was cropped to fit the DVD widescreen standard. "Dr. No" is a good example of a DVD that isn't coded for picture information in the overscan area at each side. This makes sense since that part of the image can't be seen on an interlaced TV anyway. I think it is anamorphic and your right, it can't really be determined from that picture.

Stephen

chipzoller
18th February 2007, 20:41
I'd also like to ask a small yet specific question about detecting 16:9 formats: Is the definitive way to know if a DVD source is widescreen or anamorphic (both have 16:9 flag encoded) is to merely look at the raw DVD resolution (720x480 in my case) and see if there are black bars encoded on top and bottom versus just a stretched image (and therefore no black bars on top or bottom)?

A movie can be in that AP if there are no matte bars above and below This is what Dr. No looks like. How could it be anamorphic in this case? And if it can't be determined in the screen shot from the source DVD, how else would you tell?
Well, I played the DVD back in PowerDVD to see how it would render, and based on the prog. setting the window size and capturing a frame from it, it captured 768x432 or 16:9. Doing the same thing with VLC captured a shot of 853x480 (also 16:9). So does this determine it is NOT anamorphic?

Borbus
18th February 2007, 21:21
I'd also like to ask a small yet specific question about detecting 16:9 formats: Is the definitive way to know if a DVD source is widescreen or anamorphic (both have 16:9 flag encoded) is to merely look at the raw DVD resolution (720x480 in my case) and see if there are black bars encoded on top and bottom versus just a stretched image (and therefore no black bars on top or bottom)?

No. It can still be 16:9 anamorphic AND have black bars. 16/9 = 1.78:1 so if the AR is higher than this (e.g. 1.85, 2.35 etc.) then it will still have black bars.

I find simply looking at a DVD at it's OAR (720x576 or 720x480) enough to decide if it's 16:9 or 4:3. I am used to PAL DVDs though, it may be easier to tell with PAL than with NTSC.

chipzoller
18th February 2007, 21:25
It can still be 16:9 anamorphic AND have black bars. Well this is what I mean :) If it's 16:9 anamorphic then it WILL have thick black bars on top and bottom. If it's simply widescreen it will either have none or much thinner ones (like the one DVD I had that was shot in 1.85:1 and letterboxed to reach 16:9)

525/60
18th February 2007, 21:27
@chipzoller
You are looking at the problem from the wrong end. The DVD standard is defined in terms of how the image on the DVD is viewed on two types of TVs, regular 4:3 AP TVs and 16:9 widescreen TVs. The difference between them is a ratio of 4:3rds as well (the square of 4 is 16 and the square of 3 is 9). This is how the aspect ratio in a DVD is defined. Furthermore it is defined that the equivalent of 702 pixels by 486 pixels in the digital domain will be viewable on a TV. (I started to say 'regular TV', but I then realized the same is true for both regular and widescreen). Because TVs are analog and not digital, there are no pixels on a TV screen. The image from a non-anamorphic DVD does not need to be resized to attain the correct aspect ratio on a regular TV and the image on an anamorphic DVD does not need adjustment of the AP on a widescreen TV, because (unlike a computer screen) the aspect ratio of a TV is not square. To play an anamorphic DVD on a regular TV, the player will skip every forth line and add black mattes above and below.

The 702x486 frame is changed to 704x480 to accomodate the MPEG macroblocks. The PAR is defined in terms of this 704x480 frame.

But you are doing something entirely different, you are learning how to resize the image for the 1:1 square ratio of your computer screen. The information above is necessary for you to understand how to do this, but it is still a different operation entirely. Just remember that a TV does not have a square aspect ratio like a computer screen does, so the image does not have to be resized for a TV except in the common case when you are playing an anamorphic DVD on a regular TV.

Nevertheless you can derive the PAR you need by solving for one of the following equations:

720:480 · ? = 16:9
704:480 · ? = 16:9
702:486 · ? = 16:9
for anamorphic

720:480 · ? = 4:3
704:480 · ? = 4:3
702:486 · ? = 4:3
for non-anamorphic

Once you have solved these equations in terms of a ratio (like for instance 10:11, 40:33, or even maybe 12:13), you will understand my scribblings. You should know that the middle equation is the proper DVD standard, the top equations (in each group I mean) are the commonly understood way to derive the PAR, and the bottom equations are theoretically how the image might actually be rendered on a TV screen in terms of the computer screen . In terms of an AviSynth Script that bottom anamorphic equation would look like this:Crop(0,64,-0,-64)
LanczosResize(880,352)
(I mean if you solve the equation and use the ratio found thereby to stretch the width, this is the script you would use.)

Stephen

r0lZ
18th February 2007, 22:56
@r0lZ
16:9 is not a move aspect ratio, it is a television aspect ratio.I mean a movie coded in 16:9. If you have followed my explanation, that should be obvious.

chipzoller
19th February 2007, 03:09
@525/60
Not to be rude, but could you address this question before launching into another technical page? :) I am determined to understand this as well as you, but in order to do so I have to take it in small spoonfuls.

Let me see if I have this correct:

You've been trying to tell me that because the PAR of a TV is different from the PAR of the computer, the aspect ratio of a DVD (whether designed for 16:9 or 4:3) must be different on a TV than on a computer. So something that is anamorphic widescreen on DVD will be displayed as 2.35 on a TV, but on a computer to reach the same "shape" it must be a different aspect ratio.

Also, what do you mean by "AP" above?


And how about if I did this to see if I can realize and apply correct resizing techniques (with correct PARs): Post VOB clips from about 3 various DVD sources along with statements about their capture and display properties along with crop/resizing scripts. Would one or both (or anyone else reading by now) of you be up to checking over my work?

525/60
19th February 2007, 07:32
@r0lZ
This is the part that threw me:
there is also the possibility to have a 16:9 video letterboxed in a 4:3 containerThe original movie wouldn't be in 16:9 AP, as I said, that is the widescreen TV AP. If a dvd formatted a movie in 16:9 AP, it would have to be an anamorphic DVD. I don't think I am taking anything you said out of context and I do respect your knowledge.

@chipzoller
AP means aspect ratio.

I am not launching into anything that isn't directly related to resizing DVDs for viewing on a computer. Sorry to say, I have no idea why I appear to be going off on a tangent to others.

There is no PAR for television; a DVD player feeds the TV the video stream straight into it without any resizing. A non-anamorphic NTSC DVD's data is stored exactly how a regular 4:3 NTSC TV needs it.

It's not apparent to you why I need to make that point, but trust me, it helps to clarify the discussion to understand that. We need to go over a little background just so we don't confuse our terms. There are too many aspect ratios: there is the aspect ratio of the data as it is stored on the DVD (there are two of those), and there is the 1:1 square aspect ratio of the computer screen, there is the aspect ratio of the TV screen and there is the ratio needed to convert the data on the DVD for the computer screen, which I call PAR for 'pixel aspect ratio'. There is no equivalent PAR for the TV, because the data on the DVD is designed for the TV and there is no conversion necessary.

According to a link you cited at the start of the thread and which I had assumed you read: 2.35 films are really shot in 2.39 aspect ratio starting from October 1970. Read: Anamorphic widescreen (http://en.wikipedia.org/wiki/Anamorphic#2.35.2C_2.39.2C_or_2.40.3F)

I don't mean to sound like a wiseguy, but I really assumed you had carefully read all the material in the links you posted at the start of the thread. I used those links as a starting point for my own posts. Here's another quote from that link:
With the exception of certain specialist and archivist areas, generally 2.35, 2.39, and 2.40 mean the same to most professionals, whether they themselves are even aware of the changes or not.
If a movie says it is 2.35 on the DVD cover, the proper display aspect ratio (DAR) for the 'active picture' part is 2.40 .

I studied ITU-R reccomendations for YV12, NTSC, and Broadcast TV as a background, but I am trying to stick to the technical information relating to resizing anamorphic DVD video for the computer screen, only.

Do you know that the word 'derive' means?
I ask because you might speak English as a second language.
Did you note what I said in my previous post?Once you have solved these equations in terms of a ratio (like for instance 10:11, 40:33, or even maybe 12:13), you will understand my scribblings.
So, let me show you what I mean.
I derive the correct PAR for anamorphic DVD by solving this equation thusly:

704:480 · ? = 16:9
? = (16 · 480):(704 · 9)
? = (1 · 480):(44 · 9)
? = (1 · 160):(44 · 3)
? = (1 · 40):(11 · 3)
? = 40:33
? = 1.212; <-- PAR!

Then sticking that PAR back into the formula:

720:480 · 40:33 = (720 · 40):(480 · 33)
720:480 · 40:33 = (240 · 40):(480 · 11)
720:480 · 40:33 = (240 · 1):(12 · 11)
720:480 · 40:33 = (20 · 1):(1 · 11)
720:480 · 40:33 = 20:11
720:480 · 40:33 = 1.818

This is how to use the PAR to determine the ratio of the frame you want to resize into. As in:Crop(0,0,720,480)
LanczosResize(20,11)As I demonstrated above, the PAR is the same for both 720x480 and 704x480, as stated at this site:
What's widescreen? How do the aspect ratios work? (http://www.dvddemystified.com/dvdfaq.html#3.5)

Reading this post and the two sites linked from this post will help everyone to understand my points. I promise.

Stephen

chipzoller
20th February 2007, 15:55
After some experimentation and re-reading your posts carefully I think I understand the relationship between PAR and DAR.

I didn't realize that the DAR may have nothing to do with the PAR.
Essentially, PAR is the "stretchability" of a given image in relation to the display device. So it seems to me that if we have a non-anamorphic movie that is flagged as 16:9, the PAR must be 1.212 but reinserting this into the equation yields 1.818 for the full frame AR (no matte cropping yet). Depending on the "active picture area" that the movie was shot in, cropping mattes away may yield a different AR but the same PAR since no stretching is occurring, only remove pixels, not reshaping them.


Would it be fine when resizing to resize the frame first, then crop the mattes? This way it may be simpler to determine the frame size based on the PAR and once resized, crop unneeded black pixels.

Also I was hoping you could clarify this assumption on my part:

There are two widescreen formats (I'm referring not to as stored on DVD but actual "active picture area" formats) flagged on DVD as 16:9 - "regular" widescreen and anamorphic. Is this so or am I mistaken?
Or if something is flagged as 16:9 on DVD then the content HAS to be anamorphic?

I know I started this thread with anamorphic in mind, but I want to broaden the scope now to include other types.

Stephen, thanks for your continual responses. I'll eventually understand this perfectly well with your help.

mpucoder
20th February 2007, 17:30
There are two widescreen formats (I'm referring not to as stored on DVD but actual "active picture area" formats) flagged on DVD as 16:9 - "regular" widescreen and anamorphic. Is this so or am I mistaken?There is only one 16:9 format, it is called anamorphic (but see next comment)
Or if something is flagged as 16:9 on DVD then the content HAS to be anamorphic?Yes and no. The term "anamorphic" refers to film and lenses, if the lens is non-spherical it is called anamorphic because the image on film is compressed in one dimension. Technically the word should not be used for digital images, and if it is used it should refer to images with PAR other than 1:1 (like avi and bmp). However the word is used to describe 16:9 on DVD because the image is compressed horizontally compared to a 4:3 image.

chipzoller
21st February 2007, 01:28
So for example, these two screen shots, although they appear on the DVD differently (matted vs. non-matted), they are both anamorphically shot (but flagged as 16:9)?

http://img136.imageshack.us/img136/1114/169anaps0.th.jpg (http://img136.imageshack.us/my.php?image=169anaps0.jpg)
http://img136.imageshack.us/img136/9096/169qt4.th.jpg (http://img136.imageshack.us/my.php?image=169qt4.jpg)

What terminology do I use to describe a distinction between the two? What are the differences? Perhaps I'm just ignorant of what to call these. The first shot is from "Fearless" (2006) and the second "Footloose" (1981).

525/60
21st February 2007, 02:03
Essentially, PAR is the "stretchability" of a given image in relation to the display device. Right ON!:)So it seems to me that if we have a non-anamorphic movie that is flagged as 16:9, the PAR must be 1.212If the DVD is flagged as 16:9, we call it an anamorphic DVD and its PAR must be 40:33=1.21212121..........(it is a rational number with a decimal that never ends). If the DVD if flagged as 4:3, it is non-anamorphic and its PAR is 10:11=0.909090...(on and on forever).but reinserting this into the equation yields 1.818 for the full frame AR (no matte cropping yet)'no matte cropping yet'? Yeah, That's right. Still --> The frame that you resize your image into is not the PAR, don't confuse them. Instead take the advice of the wise man who said this:I didn't realize that the DAR may have nothing to do with the PAR.Wait! That was you!;)

mpucoder was right in pointing out that the term 'anamorphic' has two meanings, the first is an anamorphic lens used for filming and the second is the DVD AP that compresses the image in a way similiar and analogous, but not precisely like how that lens compresses the image on film. The purpose of anamorphic is analogous too: to waste less space above and below the active image on the film or in the 720x480 pixels of stored image on a DVD. But never mind that, you need to either ignore the way images are recorded on film entirely or you need to study film well enough that you do not confuse the aspect ratio issues of film with the aspect ratios on the DVD (which are only two: 4:3 and 16:9).

Depending on the "active picture area" that the movie was shot in, cropping mattes away may yield a different AR but the same PAR since no stretching is occurring, only remove pixels, not reshaping them.Yes, but do you know how to apply the PAR properly?

Would it be fine when resizing to resize the frame first, then crop the mattes? This way it may be simpler to determine the frame size based on the PAR and once resized, crop unneeded black pixels.You are right, it is easier to resize first and then crop. But people resist this because then you are resizing area that you crop out later. And this wastes processing power. In particular: 1.818 refers to a resize without any cropping.

The formula for using par is to take the width divided by the height of the frame after cropping (or 720:480=1.5 if you do not crop first) times PAR (40:33=1.212 if the DVD is anamorphic). If you do not crop anything, and just resize, it looks like this:

720:480 x 40:33 =
(720 x 40) : (480 x 33) =
(240 x 1) : (12 x 11) = 20:11 = 1.818

LanczosResize(640,352)

But then, if the film was shot in 'Scope' with a nominal apect ratio of 2.35, you would reduce the height of the frame (when you chop off the black mattes above and below the active picture) enough so that the aspect ratio of the frame (width/height) would increase to 2.4 or more.

LanczosResize(640,352)
Crop(0,40,-0,-40)

Or you could crop it first the then resize to 2.4.

720:360 x 40:33 =
(720 x 40) : (360 x 33) =
(2 x 40 ) : (1 x 33) = 80:33 = 2.42424242...

720:357 x 40:33 =
(720 x 40) : (357 x 33) =
(80 x 40 ) : (119 x 11) = 3200:1309 = 2.44461420932

Crop(0,60,-0,-60)
LanczosResize(640,264)

OK, so in practice, it is even a little bigger than 2.4; that's fine, that's a consequence of using the PAR correctly, it is not wrong.

As you said 'pixel aspect ratio' tells us how much to stretch each pixel and is independent of the starting frame AP. For each starting frame AP, there is a unique target frame AP that the PAR tells us to resize into.

Finally, let me tell you that it is easier to start by ignoring the 'active picture/black matte' issue and just resize then cut. So therefore in response to the next quote:There are two widescreen formats (I'm referring not to as stored on DVD but actual "active picture area" formats) flagged on DVD as 16:9 - "regular" widescreen and anamorphic. Is this so or am I mistaken?

Ignore the film widescreen formats entirely and just concentrate on the two types of DVDs 4:3 and 16:9. Those two refer to the type of TV they are made to show their material on and not the type of film that is encoded on them. A widescreen TV is a 16:9 aspect ratio TV. As I said before, the ratio between the two aspect ratios is 4:3, that is 16:9 is four squared divided by 3 squared. 4:3 x 4:3 = 16:9.

So let's forget about cropping, let us pretend that we want to keep the full frame. If that were the case (it's not really, since you do not reallly want to encode the black mattes), there would be only two aspect ratios to resize into, one for each PAR, one for each DVD 4:3 and 16:9.

For a 16:9 DVD (we can stop using the term 'anamorphic' altogether. mpucoder is right, it is more properly used to refer to a type of film lens):

720:480 times 40:33 equals 20:11 equals 1.818.
Which equals also 640:352 and also 960:528 (try 720:396 too).

And for a 4:3 DVD (Let's decide for our purposes that these are the names of the two types of DVDs):

720:480 times 10:11 equals 15:11 equals 1.364.
Which equals 480:352 and 720:528 and also 630:462.

The factor of 11 makes these ratios difficult to work with, so I prefer to crop to something that allows me to cancel the factor of 11 out. (You should have a calculator in had as you read this.) For instance 704 has a factor of eleven, which makes that factor cancel out:

704:480 times 40:33 equals 16:9
Which equals 512:288 and 768:432.

But as anyone would tell you other than me, there is no need to be so exact. It doesn't have to be perfectly correct, only close.

I'm only being mathmatically correct for the purpose of these examples.

I do prefer to use the ratio 40:33 instead of the approximation to that ratio 1.212 on my calculator, but the difference is not crucial.

Or if something is flagged as 16:9 on DVD then the content HAS to be anamorphic? Yes, Hoorah, Hip Hip Hooray! That is 100% correct! If it's flagged as 16:9, that will tell you how to resize it to look right on your computer screen. On the packaging, if it says widescreen, that refers to the type of TV it's meant to be played on and not to the aspect ratio of the film, a 16:9 widescreen TV. With enough practice, you can learn to distingish the format of the film from the format of the DVD on the packaging, even thought the terminology is ambiguous, inconsistent, and just plain wrong;:mad:

I know I started this thread with anamorphic in mind, but I want to broaden the scope now to include other types.Again, I want to emphasize that there are only two types to choose from. There are many aspect ratios to crop to, but only two PARs.

I like this stuff *BECAUSE* it is a challenge to explain, but it really isn't hard to understand.

By the way, notice that these are exactly the same:

LanczosResize(640,352)
Crop(0,44,-0,-44)

Crop(0,60,-0,-60)
LanczosResize(640,264)

And I would prefer to change the height to mod 16, even though to do is I have to crop out part of the picture and change the aspect ratio of a 2.35 movie to 2.5:

LanczosResize(640,352)
Crop(0,48,-0,-48)

Crop(0,60,-0,-60)
LanczosResize(640,264)
Crop(0,4,-0,-4)

So do you crop first and then resize? It doesn't matter. And by the way the only reason I discuss the aspect ratio of the film is because it affects how much black matte border there is to crop off, not because it affects the aspect ratio of the DVD in any way. A 1.85 movie would have much thinner black mattes. (1.85 is called 'flat' aspect ratio and 2.35 is called 'Scope'.)

My first source of information on the technical aspects of DVDs was the DVDFAQ back nearly when it first came out. It was there that I noticed a fact that often goes unrecognized even by the most knowledgeable among us;)

Stephen

chipzoller
21st February 2007, 02:32
Stephen, continual thanks are in order for your detailed and informative posts. I'm going to read carefully.
But in the mean time, while you were working on your last post you must have missed my previous one. And for the time being I'm particularly interested in practical application to this theory.
See this: http://forum.doom9.org/showthread.php?p=958093#post958093

chipzoller
21st February 2007, 04:08
In response to your last post:

'no matte cropping yet'? Yeah, That's right. Still --> The frame that you resize your image into is not the PAR, don't confuse them.

I just wanted to confirm this. What I've finally realized is that while the PAR and frame AR (not sure how you get 'AP' to represent this but OK) they are related, the PAR is used to derive the correct DAR. And English is my first language, however knowing how to derive a value from an equation has little (if any value) if you can't relate this back into a functional perspective. Mathematics by itself means nothing until applied.

Yes, but do you know how to apply the PAR properly?
From reading (and re-reading, and re-reading) your informative posts the math makes sense and I now know how to apply the PAR. In a nutshell, this is my stumbling block that I think I've now demolished and I'll explain rationale:

I was trying to calculate proper DAR (at this point I didn't know of PAR) for the encoded frame, for example, 16:9 which as you know yields a value of ~1.778. In a world in which material was shot with a 1:1 PAR in mind, this would have been a fine and dandy value for an encoded frame's AR (nevermind mattes), however ~1.778 should NOT be the number for a DAR as stored on a computer--this is because the video (like the DVD spec. was designed to uphold) is encoded/stored with television in mind. When we take the DVD out of its natural environment (TV), we have to make certain compensations, the PAR adjustment being the most important of those compensations.
So we can set an initial frame size with the PAR and from there we can crop whatever we want...black mattes, skewed/defunct pixels, whatever...and come up with any DAR we want. But as long as the frame was initially sized (stretched, if you will) with this PAR in mind, any subsequent cropping that is done will not affect this value.

it is easier to resize first and then crop. But people resist this because then you are resizing area that you crop out later. And this wastes processing power.
Ah, I figured this would be the case. The only reason I asked is because you would have to be much more careful in considering the frame size after cropping. I haven't quite worked out in my head the correct process for ensuring the PAR is respected in resizing after a crop. What I'm thinking about in my head to make sure the resizing after the cropping doesn't obscure the PAR taken into consideration.


With enough practice, you can learn to distingish the format of the film from the format of the DVD on the packaging, even thought the terminology is ambiguous, inconsistent, and just plain wrong;
This is now what I'd like to transition into (see post #45, please) as I consider is the goal of this whole discussion (well, part of it). It was never my intention to involve any one person on this extended lecture for the purpose of learning how to resize 1 DVD at a time, regardless of the format. I remember a saying something like "Give a man a fish and you've fed him for a day. Teach a man to fish and you've fed him for a lifetime." Well I'm learning how to fish, but at present my reel keeps backlashing on me (if anyone here fishes) :)

And by the way the only reason I discuss the aspect ratio of the film is because it affects how much black matte border there is to crop off, not because it affects the aspect ratio of the DVD in any way.
&
you need to either ignore the way images are recorded on film entirely or you need to study film well enough that you do not confuse the aspect ratio issues of film with the aspect ratios on the DVD (which are only two: 4:3 and 16:9).
These, I think, are the most important statements I've come to realize. While I spent so much time trying to study and understand the different camera ARs they captured (read: 'active picture portion of the frame'), what I didn't realize was that all these could be encapsulated in black mattes and packaged as 16:9 on a DVD. This doesn't affect how to resize it as long as we still constrain ourselves to the correct PAR (40:33, or the less, albeit slightly, value of 1.2121). If we do resize it with this PAR in mind, then the mattes don't matter--even if you keep them--the playback will be correct in respect to its intended dimensions.

525/60
21st February 2007, 05:17
@chipzoller
And English is my first language, however knowing how to derive a value from an equation has little (if any value) if you can't relate this back into a functional perspective. Mathematics by itself means nothing until applied.I am a little offended that you think any math I presented doesn't apply directly to the problem at hand. I don't expect you to wade through anything that does not have value to you.

Way back at the beginning of the post, you used the wrong resize based on the wrong pixel aspect ratio. I have deomonstrated how people commonly arrive at the 1.185 aspect ratio resize, why it is wrong, and how to calculate (using math and solving equations, I thank you) the correct PAR and why it is the correct PAR.

Acually you wouldn't have so much trouble, if you focused on the task at hand, which is to make the image look right.

I was trying to calculate proper DARThe thing is you were so focused on how you were trying to do it and your own method that you didn't track very well with other peoples methods and how they think about it. Yes, in fact resizing is always a ratio, you want to stretch the width of the image 1.212 times as much as you stretch the height. But only for 16:9 DVDs, regular 4:3 DVDs require the width to be stretched less than the height by a 10:11 ratio.

In a world in which material was shot with a 1:1 PAR in mind, this would have been a fine and dandy value for an encoded frame's AR (nevermind mattes),Relax, it is all perfectly reasonable; its not hard. Film has no pixels, neither do televisions. The image is transferred digitally to the DVD as the television will read it.

however ~1.778 should NOT be the number for a DAR as stored on a computerNo, its a great DAR for storing on the computer:
crop(0,8,-0,8)
LanczosResize(786,432)

"Dr. No" (1962) and is not anamorphic (right?)I think it is anamorphic. Did you notice the the black bars at the sides? That is the part that wouldn't be visible on a TV. So cropping to 704x480 and resizing is the best method for that. Resizing is a ratio, not a number! Well, a ratio is a rational number.

The only reason I asked is because you would have to be much more careful in considering the frame size after cropping.Don't consider frame size after cropping. Just calculate the ratio between the width and the height. It can be any size, that is a separate matter.

It was never my intention to involve any one person on this extended lecture for the purpose of learning how to resize 1 DVD at a time, regardless of the format.In the future, when you post a question on a forum, you should be prepared to hear the answer. Meaning that you should put your preconceptions aside, and listen (or read) with an open mind.

While I spent so much time trying to study and understand the different camera ARsHey, I think camera ARs are fascinating. But DVD players can only read the information in the headers of the mpeg2 stream on the DVD, there are only two flags in that stream concerning aspect ratio: 4:3 and 16:9. End of story.

There are many other interesting aspects to this topic, but they can only mean something to you once you have got that in your head. Your job is to replicate what a DVD does, but adapt it for your computer screen. Since in one scenario, the ratio between the width of the frame to its height needs to be increased and in the other it needs to be decreased, it is very easy to spot the difference.

Stephen

chipzoller
21st February 2007, 13:18
I think it is anamorphic. Did you notice the the black bars at the sides?
Yes, although these are sidebars and not top/bottom mattes.
How about the two examples I posted in this post (http://forum.doom9.org/showthread.php?p=958093#post958093)? They are both anamorphically shot although one has mattes and the other doesn't?


No, its a great DAR for storing on the computer:

crop(0,8,-0,8)
LanczosResize(786,432)
Actually this resolution (1.8194) is closer to the desired 1.8181 than 1.778.

At present I'm trying to determine how to determine the desired frame size after cropping while still keeping the ratio the same. I'll have to post my thoughts and questions when I have a bit more time.

thanks again for your help with this!

EDIT:

Or you could crop it first the then resize to 2.4.

720:360 x 40:33 =
(720 x 40) : (360 x 33) =
(2 x 40 ) : (1 x 33) = 80:33 = 2.42424242...

720:357 x 40:33 =
(720 x 40) : (357 x 33) =
(80 x 40 ) : (119 x 11) = 3200:1309 = 2.44461420932

Ah, simple. I was thinking too much about this. Just determine crop values from the raw DVD frame size first and reduce that size by the cropped amount, then just multiply that by the PAR to come up with the DAR for the 'active' portion.