Log in

View Full Version : DVD Resizing


EpheMeroN
29th August 2005, 11:36
This is an AVI I want to convert to dvd. I have the script all made out but I can't get a good grasp on proper resizing. Samples are below:

VIDEO SAMPLE:
http://rapidshare.de/files/4489898/infection-sample.avi.html

IMAGE SAMPLE:
http://img387.imageshack.us/img387/8900/infectionsample2eh.th.jpg (http://img387.imageshack.us/my.php?image=infectionsample2eh.jpg)

Boulder
29th August 2005, 13:09
Try using FitCD, it will do the math for you.

EpheMeroN
29th August 2005, 18:40
There's a lot of options in FitCD I don't know if to use or not. Like if I should tick the Anamorphic option, the ITU-R BT .601-4, DVD 704, DVD 720.

Boulder
29th August 2005, 19:04
Well, your source appears to be non-anamorphic (and your destination as well). Open the avi file in FitCD and it'll set most options correctly. Then just choose the destination, DVD720 means 720x576 etc. The Avisynth script will show you what's happening to the source. Select accurate cropping to have minimal A/R error although this will crop the image if needed, sometimes quite a lot.

mic
29th August 2005, 19:17
If it helps, I think you appear to have PAL anamorphic wide screen that has been downsampled with 4 pixels cropped - ie. should be 576 x 324 vs 320. You'd want to resize it to PAL DVD with anamorphic, & I wouldn't sweat the 4 pixels :)

EpheMeroN
29th August 2005, 23:20
It's actually an NTSC source, that's why I uploaded a clip. Vdub says its fps is 23.976.

Please tell me also if I am right/wrong on this. Anamorphic dvd's are of 1.85:1 AR, and regular widescreen has an AR usually of 2.35:1? I see these on the back of the dvd boxes, but I confuse them regularly.

mic
30th August 2005, 00:26
It's actually an NTSC source, that's why I uploaded a clip. Vdub says its fps is 23.976.
Please tell me also if I am right/wrong on this. Anamorphic dvd's are of 1.85:1 AR, and regular widescreen has an AR usually of 2.35:1? I see these on the back of the dvd boxes, but I confuse them regularly.
NTSC w/s pixel aspect should be 1.2121 & PAL 1.4568. NTSC w/s I think translates into ~853 x 480, or 960 x 540 square pixel in something like PowerDVD. DV/DVD aspect (non-square pixel) should be close to 960 x 480.
PAL w/s should translate into ~ 1048 x 576 square pixel I think, or DV/DVD non-square pixel aspect of 960 [720 * 1.4568 = 1048][1048/1.0926 = 960]

Edit:
Prior info I believe correct (added to it for clarity), but caught myself making some math & other errors that I carried over on notes. Please forgive...

At any rate, if you open an image at your original frame size of 576 x 320 in a photo imaging app., then scale it proportionately, the match-up is to NTSC 853 [prior post of PAL was in error, I think based on cropped frame].

It is entirely possible though that it wasn't resized properly in the first place, or that some letterboxing (in addition to DVD playback) was cropped. Suggest add letterboxing back in, resizing to 853 x 474 with letterboxing to 480, then resizing width only to 720 for anamorphic. And yes, you can skip the first resize. :) I put it there for clarity. Please check playback of mpg2 in DVD software (should appear as square pixel).

The frame rate for NTSC is 29.976 i. Film is 24 & PAL of course 25 i. Using IVT to remove the extra frames added to film normally gets your 23.976, but you can't really rely on that to determine your source. A whole lot of programs and procedures will give you 23.976, including from time to time mistakes. :(

If it helps...
Square pixel is 1:1, NTSC DV/DVD is .9091... open up calculator & divide 10 by 11 to get repeating decimal of rounded .9091. The actual ratio is 10/11, or in notation you've used 11/10 = 1.1 or 1:1.1 -- :p Just different notations, like saying for every 1 pixel you get now 1.1 pixels. The PAL ratio is 59/54.

And if doing the calculations something doesn't seem to fit, to convert from non-square DV to square pixels "by-the-book", you have to do some width cropping, which is where the 704 comes in.
-------------
Please note: sorry for extra info making longer post -- wanted to answer question on aspect ratio off box. Also sorry for original errors. This is difficult for me to keep straight, and going by notes I misread or made math error or both. :(

Backwoods
30th August 2005, 01:03
My guess is:

Lancozs4Resize(720,356)
Addborders(0,62,0,62)

Marius-the-Mad
30th August 2005, 22:55
@ EpheMeroN:

This is almost perfect 16:9, so I'd just use


Lanczos4Resize(704,472)
AddBorders(8,0,8,8)


and encode with AR 16:9. :)

mic
31st August 2005, 00:00
RE: Lancozs4Resize(720,356)
Addborders(0,62,0,62)
&
Lanczos4Resize(704,472)
AddBorders(8,0,8,8)

Just curious where the measurements come from.. Probably stupid questions but...

Assuming NTSC originally...
Original DVD playback as square pixel would be proportional to 853 x 480 [sq pixel 720 * 1.2121 w/s] [sq pixel 720 * .9091 f/s], & would be expanded from (anamorphic) 720 x 480 DVD frame. Wide screen size would be needed to calculate amount of letterboxing/border to add. Proportional resize from starting frame of 576 x 320 = 853 x 474. It would be optional to add (1 ea) 2 pixel bars to top and bottom of original clip for final 6 pixel difference, and clip would be resized to 720 x 480. The video would appear as small clip on PC (no stretch), narrower on TV.

Please note: edited above for clarity. I tend to get very confused by ratios, which is why I asked about sizes suggested. :)

I'm also editing prior posts, and adding this if it interests (stuff that gets me confused:()
DV & DVD video appears stretched wider on a PC (which is simplified why the fuss about square & non-square pixels I think). The DV/DVD w/s non-square pixel frame size I think is close to 960 x 480, based on .9091 figure used to stretch known 853. [square pixel 655 / .9091 to get 720][square pixel 853 / .9091 to get 960] This I have tested comparing DVD to TV display and it's close.

Backwoods
31st August 2005, 22:27
RE: Lancozs4Resize(720,356)
Addborders(0,62,0,62)

How I went about it was:

a) resize the width to 640, which made the height 355

b) resize the height to 720 and evening out the height to 356

c) added borders to fill up what was left of 480 (height)

Is it a correct method? I'm not sure, that is why I posted "my guess." Personally if it was my project I would use this method and export it to my television to test.

mic
31st August 2005, 23:15
@Backwoods
Thanks :)

"Is it a correct method? I'm not sure..."

Frankly, neither am I. :) That's why I asked, and thanks again...

FWIW, there is a lot of info if you dig back far enough, that talks about the origin of the 720 x 480 & 720 x 576 frames we use, and how that relates to the so-called square pixel video we see on our PC. Unfortunately I haven't seen anything authoritive that's been written recently, that goes into details like: you can convert 720 to 655 NTSC, but have to crop to get to 640 -- but going backwards now you can only convert to 704. I could assume people are just ignoring the difference, but most video software lists 704.

And since the sources I have found go back so far in time, there was no widescreen or anamorphic. You mention: "...export it to my television to test." I very much agree. :)

Even then it's difficult because of the difference in devices... I've even taken pictures of anamorphic clips I made & one from a retail DVD, played by different DVD players to different TVs, then overlaid those pictures on the originals. The absolute most I could ever say was it's close. :(

I've added your reply to my notes -- something to play with another day -- and something I didn't have earlier. :)

Wilbert
1st September 2005, 00:03
2.35:1 can also be anamorphic. Depends how it is encoded.

I've nothing new to add. Let's do some math:

For simplicity, i assume non-ITU resizing:

avi: 576x320
real aspect ratio: 1.8

dvd ntsc anamorphic: 720x480
real aspect ratio with black borders: 16/9 = 1.78, ie 853x480 (=576x324)

1) Thus add black borders to get 576x324 (which is also 1.78), then resize to 720x480.

2) Resize first, add black borders later. You get 720x480 with "h" vertical black border.

16/9*480 / (480-h) = 1.8 (source)

thus

h = 480 - 480 * 16/9 / 1.8 = 6

Thus scale to 720x474 and add black borders to get 720x480.

phædrus
1st September 2005, 00:15
This is a subject that gives me fits. I would rather do a calculus problem than resizing from anamorphic formats to square pixels or vice versa. Must be a mental block.

I don't have Gordian Knot on my computer anymore, but when I used to back up an anamorphic DVD rip to DivX, GK would suggest me a final output of 640x352. That's a 1:1.82 aspect ratio.

That aspect ratio is very close to the display I get when I play a DVD on my monitor with WinDVD. I've measured it myself on the screen with a millimeter rule, so it seems correct. Somewhere around 1:1.81 or 1.82.

The problem is, some people are talking here about a proper display of 854x480 for anamorphic DVD. That is only 1:1.78 aspect ratio.

So which is it? 1:1.78 (which is exactly 16:9), or 1:1.82?

It is only a two percent difference, but some people take pride in being precise. :-)

mic
1st September 2005, 05:26
Edit: FWIW: Included my logic and figures not because I'm certain that I'm right, but so if someone saw any holes they could point them out.:) W/S aspect has bugged me for quite a while [as phædrus posted, had less trouble with calculus in school :)]. So spent a few more hours with Google this am, hoping to find something, instead finding only a hint that w/s pixel aspect might be the subject of some controversy. Perhaps that explains why no one writes about it beside folks like you and me, and we do not [unfortunately :)] write the standards. The original f/s specs reference actual scanning of TV signals, but, there is no analog w/s TV signal to scan or measure, so perhaps there is no real standard, just common practice? I suspect this might be so, and posts like Wilbert's do help in that regard; I'll have to just accept a perhaps less precise video world than I might like.:)

@Wilbert
Thank You. :) It does help.

@phædrus
"...play a DVD on my monitor with WinDVD"

Please be careful here... Not to change anything, but to be aware I guess, most software players will automatically try to compensate for non-square pixel aspect by stretching the frame. An example, open PowerDVD (probably WinDVD too), and load (2) 720 x 480 files, one avi & one mpg2. Start playback & hit the chapter fwd button & watch your window size. You'll see the window compensate with the mpg2, not compensate (like wmplayer) with the avi.

"This is a subject that gives me fits. I would rather do a calculus problem than resizing from anamorphic formats to square pixels or vice versa. Must be a mental block."

Some people have more trouble then others - I'm one that has trouble.:(

"So which is it? 1:1.78 (which is exactly 16:9), or 1:1.82?"

The long and short of it, phædrus, I've just spent another good bit of time playing with it, and I'm not sure at all. The amount of perspective distortion you get on any TV when comparred to your PC monitor is enough that I could never tell 100% overlaying a picture of the TV screen onto the original on my PC.

The original difference between square & non-square pixel video is 10/11 NTSC, 54/59 PAL. That I've verified. In a NLE, they'll list it as .9091 & 1.0926 -- multiply 720 by those numbers and you get the frame width of square pixel video, the correct aspect for PC, but too narrow (NTSC) or too wide (PAL) on TV, because something like a set-top DVD player will change the aspect.

A NLE will give you a w/s number of 1.2121 & 1.4568 (NTSC & PAL). I've never read what that number represents. :( All I've got is PowerDVD gives a frame of 960 x 540, compensating for non-square pixels with a perspective close to TV, and that can be sized (maintaining aspect) to 853 x 480.

1:1.78 is a frame ratio (rather then pixel), (1.78 * 480) = 854.4 ... (1.82 * 480) = 873.6 ... From NLE: (720 * 1.2121) = 872.712 ... Does that mean w/s should be 853 X 480 (or 16:9) on a PC, And for display on TV too? Or is 16:9 & 853 actually off a bit, and it should be 873? I don't know...:(

Now a twist using NLE NTSC & PAL numbers: (720 * 1.2121) = 872.712 & (873 / .9091) = 960 ... (720 * 1.4568) = 1048.896 & (1048 / 1.0926) = 959 ... Does that mean 960 is the non-square pixel width one should use to create an anamorphic DVD for TV display?

The 960 width is what PowerDVD displays, only bumping the height to 540, same as when playing f/s DVDs it bumps the window to 720 x 540. I might expect a DVD player to just narrow every picture by a set amount, in this case I think ~ 9% for both sizes works. I also wouldn't be surprised if Cyberlink didn't just bump the height to 540 on every NTSC DVD.

(704 * 1.2121) = 853.3184 ... That 704 number is cropped video [(720 * .9091) = 655 cropped to 640] & [(640 / .9091) = 704]. Is all this just playing with numbers and a coincidence, or is it meaningful?

At the moment I'm afraid all I've gotten for this evenings work is a much clearer idea of what I'm unsure of, what I don't know... :(
Good Night...

phædrus
1st September 2005, 20:03
Thank you mic, for confirming my confusion. :-) I am vindicated. Just how I'm vindicated, I'm not sure.

Unless some great prophet of DVD standards descends from the mountain to tell us otherwise, I am going to go with 872x480 as a starting point for calculation, because this seems to agree with an original frame of 720x480 and a 10/11 non square pixel.

Cropping introduces more complication, but I think if I keep that 10/11 ratio in mind, it will be easier. Now I am going to have to work my brain a little harder to figure how to use that ratio in an actual formula for a frame that departs from the standard 720x480, but when I do, I believe I will have solved the problem for myself.

One more thing. What about a 4:3 frame? Is there universal agreement that a 720x480 DVD frame should be resized to 640x480?

Wilbert
1st September 2005, 20:39
That aspect ratio is very close to the display I get when I play a DVD on my monitor with WinDVD. I've measured it myself on the screen with a millimeter rule, so it seems correct. Somewhere around 1:1.81 or 1.82.

The problem is, some people are talking here about a proper display of 854x480 for anamorphic DVD. That is only 1:1.78 aspect ratio.

So which is it? 1:1.78 (which is exactly 16:9), or 1:1.82?
There are two kinds of people on this forum. Those who follow the ITU standard and those who do not. Those who follow the ITU standard use 1:1.82, and those who do not use 1:1.78. There is no agreement on which one is correct.

More technical. ITU says that 702x576 and 711x486 constitute the 4:3 (or 16:9 when being anamorphic) image. Non-ITU says that 720x576 and 720x480 consitute the 4:3 (or 16:9 when being anamorphic) image.

(4/3*720/711*480) = 648 (4:3 stuff) (so that makes playback at 648x480)
(4/3*720/711*480)*4/3 = 864 (anamorphic stuff)

One more thing. What about a 4:3 frame? Is there universal agreement that a 720x480 DVD frame should be resized to 640x480?
ITU believers: no, that should be resized to 648x480.
non-ITU believers: yes.

Btw, the specs are clear (should be ITU), the main question is whether the production companies follow the standard.

mic
2nd September 2005, 01:01
Thank you mic, for confirming my confusion. :-)
You're more then welcome :)
Cropping introduces more complication, but I think if I keep that 10/11 ratio in mind, it will be easier...Is there universal agreement that a 720x480 DVD frame should be resized to 640x480?
This may help...
To capture (digitize), there have always been a set number of lines scanned side to side present in the broadcast signal (orig. there was nothing else). But just as you can sample music at different freq, from what I gather a company decided their new hardware would sample each line of video at a higher freq then the accepted practice (no real std.). To save the extra data, it was decided to use 720 width, which later became std. -- remember height couldn't increase. To convert to old style, so-called square, you've got to lose the extra data -- or just accept the inaccuracy. :)

This may not help (as far as complication :)):
For video 640 x 480 is cool, but in some cases if you intend to go to DVD, the size to use is 655 x 480 because of that crop. This shows up most noticably when doing titles, graphics, stills etc., and drives folks nuts in NLEs when they 1st encounter it. Include a picture of your aunt in say an NTSC slideshow & I can almost guarantee she'll notice. :)
There are two kinds of people on this forum. Those who follow the ITU standard and those who do not.
Know this too well, & if you hadn't been a big help, I would be wishing I kept my mouth shut. :) (please forgive my being selfish) I think it's important for DVD, where a set top player will narrow everything, or with DV for PC playback, but that's me -- any change in aspect just bugs me to the point where I've spent days running tests and measuring stuff. OTOH, my tolerance for color would drive some to fits. :) It really does help to know what others are using, and not just get the equivilent of a blank stare. Again, thanks. :)
...the main question is whether the production companies follow the standard. :rolleyes: :rolleyes: :rolleyes:

Marius-the-Mad
2nd September 2005, 01:14
Hi. Sorry for the late reply.


Just curious where the measurements come from.. Probably stupid questions but...Not stupid at all, as you can see from the answers given! :)

I'm equally lost in this, BTW. As for where do 704*472 + borders came from...

I read quite a lot of threads on it and there seems not to be a universal, correct way - as Wilbert says. I read once (a few times, really) that 702*xxx seems to be used more often in practice. This seems to be scaled to 704*xxx really on most DVDs, to align it with 8x8 blocks.

Given all that and the fact, that most of the DVDs I own have 8 pixel black bars on both sides, I tend to follow 704*xxx way. I try to align Y-axis resolution to 8x8, too. In this particular case, 474 was closer to 472 than to 480, so I chose 472.


I do not have the link to the thread where I read about 704*xxx being used more often at hand, but I can try to find it if needed (the thread in this forum). However, it's been quite a few months, so someone please correct me if I managed to post something... well... silly. :)

Regards. :)


<edit> mic, you type way faster than me. :)

<edit #2> And - thank you very much for another informative post. :)

mic
2nd September 2005, 01:41
@Marius-the-Mad
Thanks. :)

It helps me a lot to know what others are using.

I have bought and have read about commercial DVDs that conformed to spec, but no one could play them. An extreme example, but maybe shows that common practice, what everyone else is doing is more important, in this case because it's what viewers expect. :)

Marius-the-Mad
2nd September 2005, 01:50
Yes, the thing being used most often seems to set the standard, despite the official one already exists. :)

phædrus
3rd September 2005, 21:19
Maybe this sounds dumb, too simple, and maybe there are complications, but if you really wanted a definitive answer to the 1:1.78 vs. 1:1.82 question, you'd have to get an original film frame from a matted widescreen movie, measure the vertical distances between two specific points in the frame (with a microscope), and the horizontal distances between two points -- the sides and roof of a building might be a good thing to use, if it is vertically oriented in the frame. Then you could look at a DVD of the same movie, and check whether 1:1.78 or 1:1.82 produced a closer match to the ratio of those two measurements.

Let's say that in the original film frame a building was 400 units high and 250 units wide. In the same frame of the DVD, would you more closely duplicate those measurements if you used 1:1.78 or 1:1.82? Problem solved.

Obviously ITU is meaningless unless that is the standard used when the film was mastered. Since I'm not in the business of transferring celluloid to pixels, I have no idea what methods are used. If I had to guess, my guess would be that the process is not standardized, or that different standards are used in different countries. But I don't know.

Perhaps instead of 1:1.78 or 1:1.82 a person could compromise at 1:1.80. If you did that, it wouldn't matter as much which ratio was used in mastering -- you would be within 1% of the correct value, whether they used 1.78 or 1.82 or anything in between. Maybe not perfect, but close enough for government work.

Gordian Knot seems to be settled on the 1:1.82 standard, if my recollection of their resizing calculator is correct. I assume it has not been changed. The last version I used was .27 or .28.

mic
3rd September 2005, 22:10
@phædrus
Could only find one out of a few old web pages that dealt with film transfer, but thought none-the-less you might find it interesting. :)
http://www.digieffects.com/frames/transferfilmtovideo/filmtovideo.html

I think your method might work, measuring actual film, and I think it would probably work out to a few generally used methods, if only because there aren't all that many places where they can have cinema scanned & digitized. On the other hand, there's little chance of me at least getting my hands on actual film. :D

phædrus
4th September 2005, 22:25
Right, mic. You'd have to work in a theater. And then be very quick with scissors and splicing tape. :-)

Mug Funky
6th September 2005, 07:55
film is anamorphic...

there's tons of 35mm here, but i doubt anyone's allowed to touch it. and we don't have telecine facilities (though that would be the epitome of awesome... and would probably pay for itself pretty quickly).

Backwoods
7th September 2005, 00:06
On the other hand, there's little chance of me at least getting my hands on actual film. :D

I could mail you a trailer from the theater, if you like.

mic
12th September 2005, 04:11
I could mail you a trailer from the theater, if you like.
That would be really great! :D

Really sorry to take so long in replying to your generous offer, but on top of some sort of virus (as can tell with pic :)), wanted to set up a workflow, to make sure I wasn't wasting your time. I set up new e-mail adress, which is entered with my profile here. If you would be kind enough to send me an email address where I can reach you, I'll send mailing address as promptly as possible.

Again, Thanks :D