View Full Version : How to set aspect properly?
bur
23rd October 2007, 17:28
edit: After some more reading I found this formula: SAR = DAR * heigth/width. If I'm correct this would that for each video you had to set the aspect ratio individually, is that true? I never knew that was needed and certainly never did it with asp/avi encodings. So in my case I had to set it to 1 * (560/464) = 1.21? But is there no way to just have the video play at the given resolution and a DAR of 1:1 directly i.e. without the need to calculate and set --sar manually? I thought leaving --sar out had this effect and that was what I mostly read on the net. Just that in my case it produces a 4:3 video for whatever reason.
I'm a little desperate as this problem never occured before and I have no clue what to do:
I have a DVD source from which I made a d2v file and this avs:
LoadPlugin("d:\video\DGMPGDec\DGDecode.dll")
MPEG2Source("e:\DVD\dvd.d2v")
Crop(0,12,-2,-12)
LanczosResize(560,464)
I did a resize to 560x464 because after cropping the source had 696x574 resolution instead of going from the original 720x576. Was that okay?
Then I run x264:
x264 --pass 1 --stats "e:\dvd\pass1.stats" --output NUL "e:\dvd\dvd.avs"
x264 --sar 16:9 --pass 2 --stats "e:\dvd\pass1.stats" --bitrate 1600 --progress --no-ssim --no-psnr --threads auto --output "e:\dvd\Waechter.mkv" "E:\dvd\dvd.avs"
(I removed all the quality and zones related switches to keep it simple)
The resulting mkv looks a little too broad. And indeed MPC tells me it's 994x464 ... properly because he tries to get the 16:9 ratio. When leaving --sar out as I normally do the result is a 4:3 video (despite the resolution being 1:1.25 how does that come?).
What do I need to do, set --sar 6:5? But there should be a way to simply play the video at the given resolution. With the pixel ratio of 1:1 this should work fine.
It seems to me I don't get this aspect ratio thing right. So if anyone could shed some light... :) Or at least tell me if --sar 6:5 is okay (and maybe why I never set something like that before). Thanks.
Maccara
23rd October 2007, 19:16
Taking into account this was probably a PAL 16:9 DVD + resizing aspect error (-0,47%), you should get original aspect by using --sar 85:58 (or just use original pal dvd par - that's close enough too, as the aspect error is so little anyway).
Or, you could resize just to, for example, 560x320 to have 1:1 par (with ~-1% aspect error).
This was just a quick calculation by ITU values and haven't re-checked, so hopefully calculated correctly. :)
bur
23rd October 2007, 19:24
But why 560x320? The original source was 720x576 (1.25:1) or after cropping 696x574 (1.21:1) - so I thought resizing to 560x464 with a ratio of 1.21:1 was the right thing to do.
And also why do I need to set --sar manually? Shouldn't it be clear for any player to just play the video at the given resolution?
The way it is now MPC gives two different values for height/width in the properties tab: 994x464 (where does it get those extra pixels - by interpolating? and why?) and also my original setting of 560x464 which it doesn't use probably because I set --sar 16:9
From what I get from here (http://trac.videolan.org/x264/browser/trunk/doc/vui.txt), I should set --sar to 16*464 and 9*560 or 1.47:1 - but that's more like a guess since I don't get the formula...
Maccara
23rd October 2007, 19:36
But why 560x320? The original source was 720x576 (1:1.25) or after cropping 696x574 (1:1.21) - so I thought resizing to 560x464 with a ratio of 1:21 was the right thing to do.
And also why do I need to set --sar manually? Shouldn't it be clear for any player to just play the video at the given resolution?
The original DVD most definitely does not have 1:1.25 aspect ratio, as the original DVD PAR is not 1:1. Cropping also changes the DVD aspect ratio (but not PAR!). Some further reading here (http://www.doom9.org/index.html?/capture/par.html).
If you do not want to use --sar, you have to encode at 1:1 pixel aspect ratio and you then have to take into account what the original par was to be able to calculate the correct resizing.
Or just use megui, as it does this for you automatically. ;)
Edit:
One way to calculate resizing is
X = Source_PAR/Target_PAR*Target_height/Source_height
Y = Source_height*Target_PAR/Source_PAR*Target_width/Source_width
Source height/width are after cropping. Target_PAR = 1, if you do not want to make an anamorphic encode (i.e., use --sar)
One way to calculate the original DAR of the DVD:
DAR = Source_PAR*Source_width/Source_height
(height/width after cropping, again)
I think you can derive the rest from here.
bur
24th October 2007, 18:24
Okay, thanks alot I never knew this. But why isn' it necessary to set this for xvid? Or does the vfw-interface do it automatically?
Just one thing, what is the DVD PAR? Is that a constant value or does it differ, and if so how do I get the exact value?
And if you have some time on your hands ;) ... why do DVDs not use a PAR of 1:1? And how are they played on a CRT/LCD with a PAR of 1:1? Who does the conversion there?
edit: Never mind, I just had a look at the link you posted. Good article.
bur
24th October 2007, 20:13
Though I have to admit I didn't get what I was doing (had a long day at the lab ;)) I used your formula and this gave me 560x422 to get from the PAR=1.094 PAL-DVD with 696x574 after cropping to my PAR=1 encode. But since 422 mod 16 isn't 0 I had to resort to 416. Does that mean my aspect will be 416/422=98.5% of the original value? Should be okay then I guess.
It seems this whole aspect ratio business is a lot more comlicated than I thought so far. For example what will happen if I play my PAR=1 encode on a TV? Or even more common a PAR=1.094 DVD on my CRT with PAR=1? Does the software player do the conversion on the fly? Or is the picture really a little off?
edit: Sorry, but somehow I failed with the calculation. The video now definetely looks a little squeezed in VD i.e. height seems to be too big. I played around with avs and it looks like something like 560x330 does the job. But why? Or is this just because I directly view the avs and the encode later will be correct even with 560x416?
I doublechecked and both going from 560 and 422 gives the correct number repectively. And the DAR of the DVD is the same as when using 56X422 with a PAR of 1. So it all really seems right. But still VDmod shows a squeezed picture... I'll let x264 run now and check the result tomorrow - maybe all will be well. :)
Maccara
24th October 2007, 23:15
bur, is your dvd PAL 4:3 or 16:9? I suspected 16:9 initially, but you're using 4:3 PAR in your calculations now...
Please check that first. If it is 4:3, PAR is 1.09402 and if 16:9 use 1.45869 in your calculations. (note, that these are again different for NTSC DVDs)
Maccara
24th October 2007, 23:25
Does the software player do the conversion on the fly?
Yes, providing info is in the stream (as it should be with DVDs or x264 encoded with --sar) and the player supports it (vlc most definitely does, as probably all dvd players do too).
bur
25th October 2007, 07:14
It's 16:9, but I couldn't find any numbers for the PAR on such DVDs. I checked this site (http://lipas.uwasa.fi/~f76998/video/conversion/#conversion_table) as well as the one you posted.
I found this site (http://encodingwissen.de/video/anamorph-quelle.html) (german) that says a 16:9 PAL DVD has PAR=1.4545 This would make the height smaller (since target_par/source_PAR shrinks) so I guess that value will be correct.
Thanks a lot for you time, I finally got how this whole PAR thing works. Not that difficult once you really get what's going on, but you have to find someone to explain. :)
Maccara
25th October 2007, 19:23
It's 16:9, but I couldn't find any numbers for the PAR on such DVDs. I checked this site (http://lipas.uwasa.fi/~f76998/video/conversion/#conversion_table) as well as the one you posted.
Ah, yes, that's true. :) They focus on analog conversions only and don't derive every possible value. I have also just calculated those myself.
I found this site (http://encodingwissen.de/video/anamorph-quelle.html) (german) that says a 16:9 PAL DVD has PAR=1.4545 This would make the height smaller (since target_par/source_PAR shrinks) so I guess that value will be correct.
I don't speak german myself, so I couldn't immediately discern how they got that value, but seems that they used DVD resolution 704x576 for those calculations & "generic par" which, IMO, is not exactly correct (would result in 13,54 MHz sampling rate, which is not correct for DVDs). But, I'm not 100% sure if this would be normal for some mastering (or if I made some mistake in calculation myself :)).
Thanks a lot for you time, I finally got how this whole PAR thing works. Not that difficult once you really get what's going on, but you have to find someone to explain. :)
I found it easiest for me to just think in analogue terms + ITU standards (for digitizing video) and then just derive everything from that domain to digital.
But you're right. It is much simpler than it first seems - you just have to get around to it. :) Glad I could help.
Brother John
26th October 2007, 14:44
Since I’m the author of that German site I can shed some light on the numbers shown there. Actually three different PAR tables exist. Read the chapter about how to calculate those numbers (http://encodingwissen.de/spezial/itur-bt601.html). (A Google translation (http://translate.google.com/translate?u=http%3A%2F%2Fencodingwissen.de%2Fspezial%2Fitur-bt601.html&langpair=de%7Cen&hl=de&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools) might help.)
Exact PAR according to ITU-R BT.601
PAL NTSC
4:3 1150/1053 38800/42651
16:9 4600/3159 155200/127953
Almost exact and commonly used ITU-PAR according to Jukka Aho’s well-known article. However he did not account for the fact that the top and bottom half-lines of the analog image are only half-height.
PAL NTSC
4:3 128/117 4320/4739
16:9 512/351 5760/4739
MPEG-4 PAR taken directly from the MPEG-4 standard documents.
Very similar to exact ITU figures and usually used for MPEG-4 encodings.
PAL NTSC
4:3 12/11 10/11
16:9 16/11 40/33
Generic PAR (i.e. ignoring ITU)
This leads to an exact 16:9 DAR for an uncropped 16:9 PAL frame.
PAL NTSC
4:3 16/15 8/9
16:9 64/45 32/27
Those three tables contain all the numbers you will ever need for any DVD source. Which table you use is mainly a matter of personal preference because you have virtually no chance to find out the real DVD PAR (i.e. the PAR used in the mastering process) for sure. It might be generic, it might be ITU. Black bars left/right are an indication for ITU, but you can’t be certain. Also the absence of bars might mean generic, but it’s no proof either.
I prefer the MPEG-4 values, for three reasons: 1) Imo you’re more likely to encounter an ITU DVD than a generic DVD. 2) MPEG-4 PARs are well defined in the MPEG-4 standard (which H.264 is a part of). Everything else than those four default values is an out-of-the-way custom PAR as far as the MPEG-4 bitstream is concerned. 3) The numbers are nice and easy to remember. :)
If you want a traditional, resized, square-pixel encoding:
Take your cropped picture (696×574) and calculate it’s proper playback resolution (PAR only affects horizontal value):
696 × 16/11 = 1012,
which gives you 1012×574.
Scale down both dimensions proportionally (i.e. by the same percentage). Example: Your desired width is 560, which is
560 / 1012 = 0,5534 (55.34%)
of the full 1012. Apply the same to the height:
574 × 0,5534 = 318.
Which gives you 560×318.
Make sure both dimensions are evenly divisible by 16. This will introduce some distortion commonly known as »aspect error«. For our example: 560 is already mod16, but 318 is not.
363 / 16 = 19,9.
As you can see, 20 × 16 = 320 is the nearest proper number, which gives you a final resolution of 560×320.
If you want an anamorphically encoded MPEG-4
Crop, do NOT resize.
The cropped picture should ideally be mod16.
Set the appropriate PAR in the encoder. --sar for x264, -par for Xvid_Encraw
Make sure your playback method is compatible. Today most software players/filters/decoders are. Standalone players are a different matter, as usual.
Some more info:
SAR is just a different name for PAR.
PAR defines the shape of a single pixel.
DAR defines the shape of the whole frame, usually including black bars.
PAR is never affected by cropping but might change with resizing (usually to 1:1).
DAR is always affected by cropping and usually by resizing as well.
For a DVD source, DAR has almost no meaning. So don’t worry about weird DARs (e.g. 560×320 is 1.75:1) because you’ll hardly ever get those nice »round« values of 1.33, 1.78, 1.85 or 2.35 anyway.
bur
26th October 2007, 16:45
Thanks for the additional info, but I'm german (auch bei gulli übrigens... :)) so I read all the info on your site about anamorphic video and now finally came up with keeping the PAR to keep more vertical resolution instead of using PAR=1 which would have left me with about 320y or only 60% of the source instead of the 464 I could use now.
And since H.264 isn't standalone-compatible anyway using anamorphic mpeg4 is always the better choice as opposed to the "old" way, I think.
Just for the records, if someone else might have the same problem:
Source: 720x576 PAL-DVD 16:9
Target:
(anamorphic) 560x464 --sar 16:11
(standard) 560x320 --sar 1:1
That did it for me.
Now I'm working on an excel table to get the correct values semi-automatically. For example you enter desired heigth and it gives you the proper width for both anamorphic and standard as well as source_DAR/target_DAR, bits/pixel*frame and the such. Or is there any program that does just this?
pdanpdan
26th October 2007, 18:21
you can try this:
http://mail.mercury.ro/www/dan/AR Calculator.7z
bur
26th October 2007, 19:42
Thanks, but I already made my own. Since I also wanted the bits/(pixel*frames) and how wrong your target DAR is, i.e. target_DAR/source_DAR and also have the values mod 16 corrected. That way you can easily check which values are the best.
Though I got to admit your sheet looks more professional with the checkboxes and colors. Mine is a little crude... :)
Maccara
26th October 2007, 23:25
Since I’m the author of that German site I can shed some light on the numbers shown there.
Thank you very much for great explanation & reference.
I completely forgot myself the mpeg-4 standards, as I work mostly from analogue sources myself. Luckily, that does not end up with much difference anyway. :)
Brother John
27th October 2007, 01:00
@bur
You could just use good old Gordian Knot for the calculations. It can even switch between MPEG-4 and generic PAR.
@Maccara
Yep, that it’s three PAR tables and not only two really isn’t a too well known fact. Problem with the real ITU values: In an MPEG-4 ASP bitstream you couldn’t store most of them (except PAL 4:3) because custom PAR fields are unsigned 8-bit integers with a max value 255. No problem for H.264 though.
bur
27th October 2007, 23:47
You could just use good old Gordian Knot for the calculations.True, but I don't want to install GK just for the calculations. So I made an excel sheet that pretty much covers all the calculations GK makes.
Since this was only possible with the help of you too, maybe you want to have a look and if there are some features that could be added let me know: Excel sheet (http://forum.doom9.org/showthread.php?t=131206)
Overdrive80
2nd January 2014, 07:34
Hi, I am wondering if my reasoning is correct for doing anamorphically encoded MPEG-4.
Knowing that DAR=SARxPAR. SAR (DVD, NTSC, AR-16:9)= 720x480 and after cropping is: 716x474
For generic PAR
16/9=716/474*PAR
If 716/474=358/237
16/9=358/237*PAR
Clearance values:
PAR=16*237/9*358=3792/3222
Would be correct value of parametre? --sar 3792:3222
ITU PAR
DAR=(720/480)x(5760/4739)=(3/2)*(5760/4739)=17280/9478=8640/4739
8640/4739=716/474x(PARx/PARy)
If 716/474=358/237
8640/4739=358/237*PAR
Clearance values:
PAR=8640*237/358*4739=2047680/1696562=1023840/848281
Would be correct value of parametre? --sar 1023840:848281
Thanks in advance.
Brother John
2nd January 2014, 12:41
I’m not sure what exactly you want to achieve with your calculations.
If you just want to keep the original PAR you do not need to calculate anything. The PAR is not affected by cropping. --sar should be the appropriate value for NTSC 16:9 according to your PAR table of preference (see my post above).
If you want your cropped image to have an exact 16:9 DAR then your “for generic PAR” method is correct. Technically your “ITU PAR” method also seems sane (I didn’t check it in detail) but why would you want to force the final DAR to be the not-quite-16:9 ITU dimensions manually. You can achieve the same thing much simpler by just plugging the appropriate table values into --sar.
Edit: Strike that, it’s not quite the same. Forcing an ITU-ish DAR for a cropped image really does not make sense at all.
Note that the two SAR numbers in H.264 are 16bit fields, i.e. they cannot hold values greater than 65536. In old MPEG-4 Visual (Xivd, DivX) they were only 8bit, i.e. a max. value of 255.
Overdrive80
2nd January 2014, 16:33
I’m not sure what exactly you want to achieve with your calculations.
If you just want to keep the original PAR you do not need to calculate anything. The PAR is not affected by cropping. --sar should be the appropriate value for NTSC 16:9 according to your PAR table of preference (see my post above).
If you want your cropped image to have an exact 16:9 DAR then your “for generic PAR” method is correct. Technically your “ITU PAR” method also seems sane (I didn’t check it in detail) but why would you want to force the final DAR to be the not-quite-16:9 ITU dimensions manually. You can achieve the same thing much simpler by just plugging the appropriate table values into --sar.
Edit: Strike that, it’s not quite the same. Forcing an ITU-ish DAR for a cropped image really does not make sense at all.
Note that the two SAR numbers in H.264 are 16bit fields, i.e. they cannot hold values greater than 65536. In old MPEG-4 Visual (Xivd, DivX) they were only 8bit, i.e. a max. value of 255.
Ok, then I will take value of PAR like constant. Thanks.
benwaggoner
2nd January 2014, 22:37
Given that DVDs are SD only, my preference would be to keep SAR the same, and encode all the pixels left after you've cropped out letterboxing or edge noise. Downscaling only will throw out quality, and modern decoders do a fine job with anamorphic encodes.
Plus the math stays simpler :).
Overdrive80
2nd January 2014, 22:45
Given that DVDs are SD only, my preference would be to keep SAR the same, and encode all the pixels left after you've cropped out letterboxing or edge noise. Downscaling only will throw out quality, and modern decoders do a fine job with anamorphic encodes.
Plus the math stays simpler :).
Yes, I think that apply ITU PAR o Generic Par on x264, will depend of material DVD, if has black vertical bars (normally ITU) or generic.
Greetings.
SeeMoreDigital
2nd January 2014, 23:15
With respect... there are loads of newer topics about this subject on the forum already, that did not warrant posting in a topic dating back to Oct 2007 :eek:
Overdrive80
2nd January 2014, 23:56
With respect... there are loads of newer topics about this subject on the forum already, that did not warrant posting in a topic dating back to Oct 2007 :eek:
Thanks for your contribution. :cool:
hello_hello
8th January 2014, 16:32
Given this thread has been revived again and by co-incidence google has led me here twice in the last few days.....
Thanks to this thread I now know why MeGUI calculates ITU aspect ratios slightly differently to the YodaResizeCaclulator (http://www.mediafire.com/download/09v9bldu9a6hm00/YodaResizeCalculator.exe). It appears MeGUI uses the "Commonly used ITU-PAR" as listed in post #11, while Yoda uses the "Exact PAR according to ITU-R". Or something very close to it.
Now I'm curious. Anyone familiar with the YodaResizeCalculator and know why it's aspect ratio calculations seem to be very close to those you get when using the "Exact PAR according to ITU-R" (from post #11), but without being exactly the same?
Given that DVDs are SD only, my preference would be to keep SAR the same, and encode all the pixels left after you've cropped out letterboxing or edge noise. Downscaling only will throw out quality, and modern decoders do a fine job with anamorphic encodes.
There's a couple of TV's with built in media players in this house and a couple of Bluray players. The TVs don't support aspect ratios in MKV/MP4 files. One Bluray player does, while the other doesn't. Even though I use a PC as a media player myself, given support for anamorphic MKVs/MP4s seems somewhat inconsistent, I gave up on anamorphic DVD encoding. Rather than "downscale" though I resize "up". Depending on the ITU or non-ITU decision of course, that'd be something like 854x480 or 1024x576 for 16:9 DVDs. My preference is to crop and use the remaining height for the resize height, then resize the width accordingly.
I live in PAL-land... it probably applies more to PAL than NTSC due to the amount of resizing involved.... and discovered resizing "up" that way resulted in an unexpected side effect (I generally use Spline36Resize). With MPC-HC displaying the original DVD video, an anamorphic encode, and a "resized up" encode running fullscreen (or maximised) on my TV in order to compare them, it became pretty obvious the "resized up" encodes resulted in a sharper picture than even the original DVD video. It kind of made me regret all those previous anamorphic encodes.....
Anyone else compared "resized up" encodes to anamorphic encodes and found the same thing?
Sharc
8th January 2014, 19:15
.....The TVs don't support aspect ratios in MKV/MP4 files. One Bluray player does, while the other doesn't.
For this reason I prefer to stick to standard DVD / BD resolutions and containers rather than scale or stretch the pictures. Just to ensure best playback compatibility with various (HW) devices.
My preference is to crop and use the remaining height for the resize height, then resize the width accordingly.
I live in PAL-land... it probably applies more to PAL than NTSC due to the amount of resizing involved.... and discovered resizing "up" that way resulted in an unexpected side effect (I generally use Spline36Resize). With MPC-HC displaying the original DVD video, an anamorphic encode, and a "resized up" encode running fullscreen (or maximised) on my TV in order to compare them, it became pretty obvious the "resized up" encodes resulted in a sharper picture than even the original DVD video. It kind of made me regret all those previous anamorphic encodes.....
Anyone else compared "resized up" encodes to anamorphic encodes and found the same thing?
Interesting. I didn't try, but I imagine that the spline36resizer introduces slight ringing which makes the picture look sharper compared to MPC-HC's internal resizer.
(As for resizing to non-standard resolutions I would be a bit cautios for playback device compatibility reasons.)
Brother John
8th January 2014, 23:51
@hello_hello
Thx for the hint. I corrected the table in #11. It’s not surprising that no one noticed earlier though because I only added that table recently after Overdrive80’s initial post.
I don’t know YodaResizeCalculator. It’s slight deviation might be because of the limited max numbers that can be stored in the video stream. E.g. H.264 cannot store the exact ITU NTSC 16:9 PAR because the numbers are too large. Of course it could also be rounding error or something like that.
Anyone else compared "resized up" encodes to anamorphic encodes and found the same thing?
The default on-the-fly resizer is usually bilinear. Assuming you didn’t change that to something else it’s not surprising that Spline36 is sharper. However, in principle you can use any resizer you like on playback provided your computer is fast enough to run it in real-time.
hello_hello
9th January 2014, 04:41
For this reason I prefer to stick to standard DVD / BD resolutions and containers rather than scale or stretch the pictures. Just to ensure best playback compatibility with various (HW) devices.
To be honest I've never had an issue with encoding using "non standard" resolutions. If a player will play h264 video in MKV/MP4 it'll play it regardless of the resolution (in my experience). The issue seems to be whether it understands anything other than a 1:1 PAR.
I guess you could compare it to encoding with Xvid. Everybody used resolutions such as 640x368 despite there being nothing standard about them. AVI capable hardware players always displayed the encodes correctly if the video was resized to square pixels, but anamorphic support was fairly non-existent.
Edit: I even tested encodes with a 720x576 resolution and 16:9 aspect ratio as well as original mpeg2 video (same resolution and aspect ratio) using my TV's built in media player and each time it displayed with the wrong aspect ratio. In those instances I could use the TV's picture menu to stretch the picture to 16:9, but if the video isn't anamorphic I don't need to. One of the Bluray players is the same. Anything played via it's USB input has it's aspect ratio ignored.
1024x576, 960x540, 704x396..... they all display as they should. Likewise do "square pixel encodes" with resolutions other than 16:9.
hello_hello
9th January 2014, 04:48
@hello_hello
Thx for the hint. I corrected the table in #11.
I deleted the reference to your table from my earlier post given it's no longer required.
I don’t know YodaResizeCalculator. It’s slight deviation might be because of the limited max numbers that can be stored in the video stream. E.g. H.264 cannot store the exact ITU NTSC 16:9 PAR because the numbers are too large. Of course it could also be rounding error or something like that.
The calculator is predominantly designed to calculate resizing and aspect ratio error when resizing to square pixels, but it does also provide an appropriate "Matroska Aspect Ratio Tag" as you crop. It doesn't display pixel aspect ratios, but using the numbers you provided and doing the math I discovered it differs marginally.
For example for 16:9 PAL, your "Exact ITU PAR" numbers give a DAR of 1.82019626. Yoda (when using an ITU aspect ratio) displays it as 1.82098765 (295/162).
Anyway, it's no big deal. I was just curious and thought maybe someone more clever than I might know why and/or what PAR it's based on. Maybe it is just rounding.
The default on-the-fly resizer is usually bilinear. Assuming you didn’t change that to something else it’s not surprising that Spline36 is sharper. However, in principle you can use any resizer you like on playback provided your computer is fast enough to run it in real-time.
I guess you could look at it as resizing twice. Once when encoding, and then again to resize to fullscreen, as opposed to resizing directly to fullscreen for an anamorphic encode. The other consideration might be hardware players and how sharply they might resize. Unlike using a PC for playback, you're pretty much stuck with however they do it.
I did try changing resizers in MPC-HC. Using a sharper resizer enhanced the effect so obviously the initial resizing when encoding was providing some "additional" sharpening. In fact an anamorphic encode with MPC-HC using a sharper resizer looks similar to a "resized up" encode with MPC-HC using a softer resizer.... at least when they're both running fullscreen so MPC-HC is resizing them both.
Maybe someone would like to offer an opinion on these two little anamorphic vs resizing samples? The difference isn't massive, but if I pause each encode on identical frames while MPC-HC is running maximised on my TV and switch between them (same MPC-HC resizer each time), it's reasonably obvious. Especially comparing frames from the last second or so and the sharpness/detail on the wall and door. I picked the first 16:9 DVD I saw on the shelf. It's not the best quality but it'll do.
As I said previously, the effect may not be as pronounced when resizing NTSC DVDs as there's not as much resizing involved.
http://www.sendspace.com/file/2flpxb (17MB zip file)
Sharc
9th January 2014, 09:06
See here the characteristics of resizing filters (http://svn.int64.org/viewvc/int64/resamplehq/doc/kernels.html).
The sharpening (and ringing) contribution of spline36resize is obvious. If you want it even sharper (and ringier) use Lanczos4 or Sinc.
hello_hello
9th January 2014, 09:45
Obviously I can see the sharpening but I'm not sure about the ringing. Maybe I just don't know what to look for. Although running fullscreen the video has effectively been resized twice (first while encoding and then again on playback) so I'm not sure which resizing to blame if I could see it. ;)
I guess to my way of thinking, at least when it comes to my method of playback/viewing, one choice would be anamorphic encoding which is then resized to fullscreen on playback. MPC-HC and a soft resizer looks a little blurry to me, while MPC-HC and a sharper resizer, especially for low quality video, tends to look a little too sharp.
Resizing the anamorphic video to the correct aspect ratio with a sharpish resizer when encoding, then resizing the rest of the way to fullscreen on playback using a software resizer seems to work best for me, but I'm open to suggestions......
I'd prefer to stick to square pixel encoding though so I don't need to worry about anamorphic support.
Sharc
9th January 2014, 10:34
I'd prefer to stick to square pixel encoding though so I don't need to worry about anamorphic support.
Yes, while all (HW) players I am aware of are fine with square pixels, they may reject non-standard picture resolutions (my bad experience). In the case of a legacy DVD player this means for example that you would need to keep the horizontal resolution and reduce the vertical resolution (means loose details & sharpness) of anamorphic DVD sources, and add larger top&bottom borders to be DVD-format compliant. Otherwise, if we resize horizontally to >720 pixels the player may respond with "unrecognized format" or similar.
Of course we have a bit more freedom when we re-encode anamorphic DVD material to mpeg4/AVC, but even there I am cautious with non-standard frame resolutions (for player compatibility).
In addition, we have to be cautious with "blindly" resizing true interlaced (DVD) material. But this is another topic....
Anyway, we do have the choice.
hello_hello
9th January 2014, 14:26
These days it seems High Profile, Level 4.1 support is fairly universal. As far as I know, MKV/MP4 capable Bluray players support it.... even my smartphone does.... and I don't think it restricts the resolution or frame rate in any "standard" way.
As you mentioned de-interlacing..... since discovering the joy of "full frame rate" de-interlacing (ie 50fps for PAL or 59.94fps for NTSC) I've not considered the possibility of entertaining the notion of de-interlacing to 25/29.97fps, which mightn't be PAL/NTSC complaint either, but fortunately High Profile, Level 4.1 supports frame rates up to around 68fps for resolutions 720p or lower.
I must admit I've never had a bad experience with hardware players (MKV/MP4 capable ones) rejecting video due to non standard resolutions. For AVI capable DVD players I kept to a maximum width of 720 (I did have at least one DVD player which didn't support a width over 720), but I've yet to come across a TV's media player or Bluray player which rejects non-standard resolutions, assuming they're MP4/MKV capable. Anamorphic support seems to be the main inconsistency.
Motenai Yoda
22nd May 2015, 01:13
The calculator is predominantly designed to calculate resizing and aspect ratio error when resizing to square pixels, but it does also provide an appropriate "Matroska Aspect Ratio Tag" as you crop. It doesn't display pixel aspect ratios, but using the numbers you provided and doing the math I discovered it differs marginally.
For example for 16:9 PAL, your "Exact ITU PAR" numbers give a DAR of 1.82019626. Yoda (when using an ITU aspect ratio) displays it as 1.82098765 (295/162).
Anyway, it's no big deal. I was just curious and thought maybe someone more clever than I might know why and/or what PAR it's based on. Maybe it is just rounding.
Jeez I'm pulling up this topic only for this..
shouldn't be any rounding, it only multiply numerator and/or denominator and then divide both for gcd.
ITU par are the ones on the table in #11
pal 4/3 - (720*128*767)/(576*117*768) = 70686720/51757056 = 295/216
pal 16/9 (720*512*767)/(576*351*768)= 282746880/155271168 = 295/162
ntsc 4/3 (720*4320*767)/(480*4739*768) = 2385676800/1746984960 = 103545/75824
ntsc 16/9 (720*5760*767)/(480*4739*768) = 3180902400/1746984960 = 34515/18956
difference between these and those in Exact PAR according to ITU-R BT.601 is only 0,04347826086956521739130434782911%
Note I added a 767/768 Industry Standard/Square Pixel factor (maybe is a workaround for the half height of top and bottom lines? I know nothing).
hello_hello
23rd May 2015, 04:46
Motenai Yoda.
I hope you didn't think I was "having a go" at your calculator. I used it religiously before MeGUI's script creator was given a similar ability to calculate aspect error, and I still use it quite a bit when I'm not using MegUI. I've recommended it many times. In fact when MeGUI's resizing was given a similar function a few of us were testing the claculations and reporting problems and if I thought MeGUI was getting it wrong your calculator was my method of double checking. I think a few times I posted "MeGUI is calculating this, but Yoda says it's that". ;)
As I pointed out in post #29, the difference between the exact ITU as per the table in post #11 and the aspect ratio calculated by your calculator is very, very, very small, but I'd noticed there was one and I was curious as to why. So it's just due to tackling the calculation from a different starting point, so to speak?
If you happen to return, what's the latest version of your calculator? The version I'm using is 0.3.5.11 but it's not easy to find and I think I've seen two or three different versions, so I'm just wondering if 0.3.5.11 is the latest and greatest?
Cheers.
Motenai Yoda
25th May 2015, 01:00
I was just specifying, without any controversy
0.3.5.11 is the lastest, I dismiss it coz c# isn't so much portable
https://www.mediafire.com/folder/nracjn55rnjln/YDC
I don't know if "half heigh (width) scanlines" should be take into, coz I've see many dvd's with top/bottom lines starting and ending in the middle, as Brother John's link said "Resolved that is pragmatically by simply treats the digital half the line is complete and each missing half fills with black." And if at 574 + 2 × ½ are added 2 × ½ of black, then it'll be 574 + 2 × ½ + 2 × ½ = 576.
hello_hello
25th May 2015, 02:23
Thanks for the info.
Ghitulescu
25th May 2015, 10:22
I have found a lot of DVDs where the PAR differed from each other - while on paper it may have looked "perfect" it didn't. The most reliable were those scanned form film, and the less reliable were those made of analogue tapes (some movies were first set to tape then digitized).
I stopped splitting the hair into 16, since this wasn't an exact science anyway - and thanked BD for ending this nonsense.
8-BaLL
28th May 2015, 00:35
Having said all that- I got a 4:3 NTSC DVD here that I want to encode. After cropping, the size is 708x480 (6+6 pixels cropped).
Is it enough if I encode the dvd anamorphed as 708x480 and just use the --sar 8:9 to get the correct aspect ratio later or is there something else I should pay attention to?
Thx.
StainlessS
28th May 2015, 02:02
Not sure but I think only valid DVD resolutions for NTSC are 720x480 and 704x480 (not counting half width versions).
8-BaLL
28th May 2015, 02:15
Well it has black bars left and right, 6 pixels wide- thus 708 pixels after cropping.
And ofcourse Im going to encode it to x264, which I think doesnt really care for the resolution for the most part? As long as its mod2 or mod4..?
Ghitulescu
28th May 2015, 09:44
Having said all that- I got a 4:3 NTSC DVD here that I want to encode. After cropping, the size is 708x480 (6+6 pixels cropped).
Is it enough if I encode the dvd anamorphed as 708x480 and just use the --sar 8:9 to get the correct aspect ratio later or is there something else I should pay attention to?
Thx.
Actually you should have cropped the frame after adjusting it to quadratic pixels (PAR = 1). Computer based video always use PAR of 1:1 (except maybe some ancient CGA/EGA nobody remembers :) ).
If you intend to use the video on computer platforms (it includes smartphones and tablets) you should convert it to quadratic pixels - it is true that many software players can do this for you, but it's better to be sure.
Secondly, if you intend to play them in a video-environment you cut the margins completely useless - the borders will anyway be put back at playback as the 4:3 or 16:9 has to be restored AND you haven't saved any substantial bits since black bits (unless they contain noise) do not require a lot of bitrate.
Therefore once again, there is no video conversion for the sake of video conversion (this is what I like to believe, but the evidence seems to contradict me :) ), but a conversion to fulfil a need (that the original video cannot).
So think what do you want, check the features and characteristics of the playback device and reencode/reedit your video accordingly.
8-BaLL
28th May 2015, 10:41
So what exactly would it be, that you suggest?
No to crop 6 pixels left and right and just encode as 720x480?
Again I have a retail 4:3 NTSC DVD (anime) here that I want to encode to x264, keeping the best quality possible and preferably not adding extra pixels or reducing pixels(without resizing). Or is resizing the better way?
The encode will be watched mostly on a stand alone Media Player WDTV live, which should be able to handle all sorts of SARs/DARs etc. without problems.
What would your suggestion be, to keep the best possible quality and correct aspect ratio?
Isnt the anamorph encoding as 708x480 with --sar 8:9 the correct way?
Ghitulescu
28th May 2015, 12:18
In that case leave it this way. Depending on the TV-player configuration you may not get rid of the overscan anyway (I have heard that there are some models that can display the whole frame). Cutting the 12 anamorph-pixels will cause that you'll lose actual image if the overscan is on.
But since you'll reencode anyway, and provided you master the resizing procedures, you can PAR-resize it and encode it with PAR 1:1, which will also be compatible with smartphones and tablets and whatever else. However, depending on the scaling capabilities of your standalone, it may not be perfect for your TV.
The correct way is as I said the one that works (best) on the intended platform. By definition, best cannot be topped (there is no better best :) ), yet people converted VHS and DVDs to AVI (and DivX), then BDs and DVDs to MKV (and H.264), now MP4 seems to be the best (in particular if one can squeeze 25GB of a BD into a 300MB MP4 file).
8-BaLL
28th May 2015, 12:28
Overscan isnt on ofcourse. Most of the full HD TVs support the so called "Just Scan" option, which disables Overscan.
Even my Sony W4000 from around 2007 had "just scan" already. Sometimes it is called differently, but so far all fullHD TVs Ive seen- you could disable overscan in HD mode starting with 720p.
Since I will be watching the DVD through my WDTV live, which upscales the image to 1080p anyways, I dont think I should keep the black bars, do I?
hello_hello
28th May 2015, 12:47
Having said all that- I got a 4:3 NTSC DVD here that I want to encode. After cropping, the size is 708x480 (6+6 pixels cropped).
Is it enough if I encode the dvd anamorphed as 708x480 and just use the --sar 8:9 to get the correct aspect ratio later or is there something else I should pay attention to?
Thx.
You seem to be getting some odd advice in this thread. There's no special need to convert video to square pixels if you intend playing it on a PC. In fact anamorphic video is far more likely to be displayed with the correct aspect ratio using a PC than it is when using a hardware player as pretty much all software players support anamorphic video but the same cannot be said for hardware players. There's no need to resize to square pixels before cropping either.
If your hardware player displays anamorphic video correctly, use anamorphic encoding if you like. Personally, I resize everything to square pixels so there's no aspect ratio issues to worry about, but it's personal preference.
To answer your question.....
I'm not sure I've ever met a 4:3 DVD that uses a generic pixel aspect ratio. They're pretty much all ITU (or mpeg4 as it's virtually the same) so you'd want to use a 10/11 SAR (pixel aspect ratio) not 8/9.
Due to the 10/11 SAR the display aspect ratio is around 1.367 if you don't crop, or to put it another way, only 704x480 makes up the 4:3 aspect ratio. There's 8 pixels each side that don't count. They can be cropped and you'll still end up with a 4:3 display aspect ratio.
I crop the black bars and disable overscanning. I leave my PC connected to my TV at 1080p and for 4:3 video the player adds the black bars back down each side. 99.9% of the time the black bars down each side aren't nice and clean for 4:3 DVDs, so I crop the crud and let the player add back the black bars.
I also crop any crud top and bottom and I generally aim for a minimum aspect ratio of 4:3 to minimise the black bars each side. Sometimes that involves cropping a few pixels of picture top and bottom (or at the sides) to achieve 4:3, but keep in mind a small amount of picture you wouldn't have seen due to overscanning when using a DVD player and CRT TV. Some 4:3 DVDs have a lot more than 8 pixels worth of crud down one side, or both sides.
Use the resize calculator referred to earlier to adjust the cropping to achieve a 4:3 aspect ratio if it helps (even if you don't resize to square pixels) but keep in mind for anamorphic encoding if you don't resize at all and use a 10/11 SAR you can't go wrong no matter how you crop. Cropping doesn't change the shape of the remaining pixels. They're always 10/11 unless you resize.
8-BaLL
28th May 2015, 14:19
Alright so just in short- ITU means that most DVDs have 8 black pixels left and right, and because of that, the AR isnt the perfect 1.33333 but 1.367 in order to compensate for the black bars is that correct?
I posted here a small source example, maybe you could look into it really quick: http://forum.videohelp.com/threads/372097-Anime-DVD-need-help-with-Frame-Blending-Ghosting-and-mb-some-other-tweaks
Sometimes that involves cropping a few pixels of picture top and bottom (or at the sides) to achieve 4:3, but keep in mind a small amount of picture you wouldn't have seen due to overscanning when using a DVD player and CRT TV.
While I partially agree here, IMHO we cant ignore and shouldnt ignore picture information, only because it would probably not even be visible on old CRTs or DVD players.
I mean we need to allways think about the source, like lets say anime. Was it drawn in correct 4:3 aspect ratio? If it was, and the visible image on the DVD is, lets say 710x576, I dont think cropping the 6 visible pixels which carry real picture detail, in order to achieve the correct 704x576 resolution, should be considered the optimal solution.
See the question that arose while I was cropping DVDs was- some dvds have unsimilar black bars, like 2 pixels on the left side and 8 pixels on the right side- for example. So now if I crop out the black bars and have a VISIBLE image of 710x576- should the visibile image be seen as native 4:3 AR, like if I was going to resize the image to 640:480 pixels and keep the correct aspect ratio- should the black bars (2pixels+8pixels) be removed or should I keep them?
I know its a little irritating with that AR on DVDs. Good thing they made square pixels a standard for HD material.
Thanks for your replies though, it helps understand the stuff a little more, and I will make sure to use 10/11 SAR instead of 8/9 for NTSC.
So I assume the SAR 16:15 I was using for PAL wasnt the optimal choice as well and I should have rather used 12:11?
hello_hello
28th May 2015, 15:08
Alright so just in short- ITU means that most DVDs have 8 black pixels left and right, and because of that, the AR isnt the perfect 1.33333 but 1.367 in order to compensate for the black bars is that correct?
The presence or absence of black bars doesn't guarantee ITU or generic, but it can be a good indicator. I think virtually all 4:3 DVDs are ITU. Most 16:9 DVDs are generic, but you'll probably still come across older ones now and then that are ITU. Very occasionally I think I've found a 16:9 DVD without black bars that's ITU, but mostly they're generic.
I posted here a small source example, maybe you could look into it really quick: http://forum.videohelp.com/threads/372097-Anime-DVD-need-help-with-Frame-Blending-Ghosting-and-mb-some-other-tweaks
There's no way to know for sure. If you can find a straight on shot of something that should be round (a clock face or dart board etc) you can change resizing methods to see which makes it look the closest to a perfect circle.... that kind of thing.... but failing that I just follow my rule of thumb.
4:3 = ITU
16:9 = generic
16:9 with substantial black bars = ITU
Although having said that...... I suspect all BBC 16:9 DVDs are still ITU, but I don't know for sure.
I mean we need to allways think about the source, like lets say anime. Was it drawn in correct 4:3 aspect ratio? If it was, and the visible image on the DVD is, lets say 710x576, I dont think cropping the 6 visible pixels which carry real picture detail, in order to achieve the correct 704x576 resolution, should be considered the optimal solution.[/url]
It's personal preference.
For ITU 704x576 or 704x480 is the picture area. There's no rule that says the picture can't extend beyond that at the sides, but for ITU 704x576 = 4:3.
I crop the crud at the sides and usually a row or two top and bottom, then I look at the aspect ratio of the remaining picture. If it's narrower than 4:3 I crop whatever extra I need to from the top and bottom to make it 4:3 again (and it's usually not much), but that's just me. If it's a tad wider than 4:3 sometimes I crop a bit more from the sides to make it nice and 4:3 again. If there was no black to crop at all I'd resize to 1.367 (for example I'd use 656x480 instead of 640x480) but mostly after cropping just the crud I find I'm pretty close to 4:3 and I crop a few extra pixels of picture if need be so I can resize to exactly 4:3, but that's just me and the way I go about it.
See the question that arose while I was cropping DVDs was- some dvds have unsimilar black bars, like 2 pixels on the left side and 8 pixels on the right side- for example. So now if I crop out the black bars and have a VISIBLE image of 710x576- should the visibile image be seen as native 4:3 AR, like if I was going to resize the image to 640:480 pixels and keep the correct aspect ratio- should the black bars (2pixels+8pixels) be removed or should I keep them?
Yep, that's the joy of the picture not always being in the centre as I guess it would be in a perfect world.
If the difference is only a few pixels I'd crop the whole thing the same way so all the black is gone, crop a bit more if need be until I'm at 4:3 again, then resize to 4:3. You lose a few pixels of picture here and there you never would have seen with over-scanning enabled anyway and it's a lot less work than constantly adjusting the cropping.
If the amount of black differs substantially in different sections then I'd crop each section differently, but so each section was cropped to 4:3, then I'd resize to a common 4:3 resolution if need be.
That's the way I'd do it, but don't over-think it too much. One of the reasons I aim for an exact 4:3 most of the time is if I'm encoding a 4:3 DVD with several episodes on it, chances are each one will require slightly different cropping, and rather than have each episode end up a slightly different aspect ratio I crop them all to 4:3 and resize to the same 4:3 resolution. But that's just me.....
So I assume the SAR 16:15 I was using for PAL wasnt the optimal choice as well and I should have rather used 12:11?
I'd imagine 12/11 would be more likely to be correct but the difference isn't huge (2.5%) and I've encoded several DVDs where I'm sure the aspect ratio was a bit off whichever PAR I used, and definitely some where the opening credits for the first episode were generic but for episode two they were ITU (because the aspect ratios were slightly different). All sorts of horrors can be inflicted on video on it's way to DVD.
PS Everything I've said above is based on my experience with DVDs containing video/film. I virtually never encode animation, although I'd be surprised if it's any different.
Ghitulescu
28th May 2015, 15:13
I mean we need to allways think about the source, like lets say anime. Was it drawn in correct 4:3 aspect ratio? If it was, and the visible image on the DVD is, lets say 710x576, I dont think cropping the 6 visible pixels which carry real picture detail, in order to achieve the correct 704x576 resolution, should be considered the optimal solution.
The way I got it, animes are cartoons that were transposed on film, then TCed to tape where some generics were added. The tape got digitized back. Some were digitized back in the States sometimes using an US NTSC player not a JP one - but that's the least important problem.
They are not PAL, and a whole book may be written on how to recover the original frames (cartoons) from such a suite of conversions.
On overscan issue - many studios do observe it, and frame the subject that it will be fully in the 10% display safe area. In this case, overscan or underscan, the viewer does not loose anything important - unlike 16:9 or 2.40:1 formats from film. Sometimes one can see props in this area (in particular on TV shows, that were exclusively recorded and edited on tape).
Apparently there are TVs that can be set to ignore the overscan, I am not sure how spread are these, I personally have met none of them, so overscan is still important IMHO also today. The analogue standards require an overscan in particular if the video is also analogically transported (SCART, YUV etc.), whether this is observed or not is rather an implementation thing.
Anyway, the presence or absence of overscan may be tested with special charts, not a big deal. Ignoring it however may be annoying, if important info are present outside the safe zone and eg one changes the TV (eg at a friend or relative).
Cropping or leaving it alone plays almost no role (sometimes it's even better as it masks the head switching noise for some video sources). But cropping must take the encoder into account, generally the sizes must be DIV 8 if not even 16. Therefore cropping 12 pixels to arrive at 708 is not a good practice anyway (708 / 8 = 88.5). You may crop 8 pixels each side, or you can blank the 6 pixels each side.
If I would be you, I would simply rip the DVDs to an USB stick (or portable (maybe SSD) USB medium), clean them from eg trailers and warnings and enjoy all the features they have. I still have to find out the standalone that can read subtitles from the internals of a file (AVI, MKV, MP4 etc.) if needed, and not as a separate SRT file (with the additional problem of code pages and wrong characters). The normal combination of a normal TV and a normal DVD/BD/media-player would play them just perfect as they would do with the original DVDs, including multiple audio tracks and/or subtitles.
If one is English (or at least has English as his/her native tongue) and is not deaf and/or has no neighbours within the SPL of his loudspeakers, yes, these alternative containers and formats may have sense. :)
Sorry if it seems to be offtopic.
PS: So, someone considers that some advices in this thread are odd (!) but he does his own videos according to them. :)
hello_hello
28th May 2015, 15:38
PS: So, someone considers that some advices in this thread are odd (!) but he does his own videos according to them. :)
Yep, like your mod8 or mod16 cropping advice. It's not 1990 any more. Even itunes video is commonly mod4 or even mod2.
Apparently there are TVs that can be set to ignore the overscan, I am not sure how spread are these, I personally have met none of them, so overscan is still important IMHO also today.
I'd be surprised if most 1080p TVs didn't have an option to disable overscanning these days. Mine does. It's also automatically disabled under some circumstances, such as when the TV's in PC mode or in film mode or 3D mode.
Samsung call the no overscanning mode "screen fit", Pioneer call it "dot by dot", LG calls it "just scan" and for Panasonic I think it's called "16:9 overscan" and needs to be disabled.
If I would be you, I would simply rip the DVDs to an USB stick (or portable (maybe SSD) USB medium), clean them from eg trailers and warnings and enjoy all the features they have.
Not all TVs/Bluray players display anamorphic video correctly when it's played via USB. Even when it's the untouched DVD video. It'd pay to test.
What on earth have the neighbours got to do with aspect ratio and container formats?
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.