View Full Version : aspect ratio displayed incorrectly in avinaptic?
saint-francis
22nd August 2007, 18:46
So I am looking at the avinaptic report for a movie I recently backed up sing MeGUI and I noticed that it said that the resolution is 720 x 464 and the PAR is 1:1 = 1. I cropped the black boarders with the avisynth script creator in MeGUI so shouldn't these be displayed differently?
Here's the avinaptic report:
Codec: avc1
Resolution: 720 x 464
Frame aspect ratio: 45:29 = 1.551724
Pixel aspect ratio: 1:1 = 1
Display aspect ratio: 45:29 = 1.551724
Framerate: 23.976023 fps
Number of frames: 138031
Bitrate: 2034.201772 kbps
Here's the AVS:
setMTmode (2,0)
# Set DAR in encoder to 37 : 20. The following line is for automatic signalling
global MeGUI_darx = 37
global MeGUI_dary = 20
DGDecode_mpeg2source("I:\Smokey And The Bandit\VTS_01_1.d2v",info=3)
ColorMatrix(hints=true,interlaced=true)
#Not doing anything because the source is progressive
crop( 0, 6, -2, -14)
BicubicResize(720,464,0,0.5) # Bicubic (Neutral)
Undot() # Minimal Noise
SeeMoreDigital
22nd August 2007, 19:40
According to Amazon your "movies aspect ratio" is 1.85:1. So when combined with a "pixel frame size" of 720x464, the level of "aspect ratio signalling" you require is: 31:26
However, you could also try 32:27 ;)
Cheers
saint-francis
22nd August 2007, 21:17
According to Amazon your "movies aspect ratio" is 1.85:1. So when combined with a "pixel frame size" of 720x464, the level of "aspect ratio signalling" you require is: 31:26
However, you could also try 32:27 ;)
Cheers
OK. First of all, Amazon? Do you mean the online retailer? And if so, how did you know what movie I am talking about? :confused:
Second, I didn't really follow what you just explained. Please have patience with me as I'm learning. Could you please elaborate on "pixel frame size" and "aspect ratio signaling" in this context? I think that what you mean by pixel frame size is the resolution of the frame measured in pixels, right? How do I require a ratio of 31:26? Where do I require it?
Thanks
SeeMoreDigital
23rd August 2007, 08:48
OK. First of all, Amazon? Do you mean the online retailer? And if so, how did you know what movie I am talking about? :confused:The title of your movie is in your AVS script
Second, I didn't really follow what you just explained. Please have patience with me as I'm learning. Could you please elaborate on "pixel frame size "and aspect ratio signalling" in this context? I think that what you mean by pixel frame size is the resolution of the frame measured in pixels, right? Yes that's correct. And "aspect ratio signalling" refers to the PAR
How do I require a ratio of 31:26? Where do I require it? Well, I use an application I conceived (thanks to Moitah) called the "ARS Calculator" (http://www.seemoredigital.net/05_How_to..._Files/ARS_Calculator/ARS_Calculator.zip). It looks like this: -
http://img168.imageshack.us/img168/8204/arscalchz2.png
And in your case. After you enter your relevant information, you get a PAR of 31:26. Like this: -
http://img182.imageshack.us/img182/6394/snap1rm6.png
Cheers
saint-francis
23rd August 2007, 20:37
OK. I understand what you are demonstrating in the above post. But why doesn't that happen automatically? I have watched the movie and I know that the picture isn't greatly distorted. Where did I go wrong? Am I missing a step when I make the AVS script? Or did I do everything correctly and it's avinaptic that's not giving me the correct figures?
saint-francis
5th September 2007, 20:49
I'm sorry to bump this but I just don't understand how to apply what SMD has demonstrated for me above. Could some one please help me learn to apply this knowledge? Or should I repost this in the newbie section? Should a Mod move it? Or is this just a plain stupid question? If so could someone please explain to me why?
jmnk
6th September 2007, 04:01
I --think-- that it is more of an avinaptic issue. There are at least two, and possibly three ways of providing aspect ratio info for the x264 encoded movie in mp4 container. It seems that MeGUI passes aspect ratio such that it is being stored in mp4 container and not in video stream. If your movie looks fine (not distorted) than it all worked. Avinaptic probably looks at the aspect ratio in video stream - and does not find any so it displays 1:1.
Or it is the other way around - aspect ratio is stored in the stream but avinaptic looks at the container info.
As far as the concern that your movie looks still sligthly distorted - that --could-- be because you resized the video, and that may skew the aspect ratio ever so sligthly.
BTW, as it was stated on these forums many times - for movies on DVDs there are only 2 aspect ratios (well, plus 2 for PAL); one for 4:3 and the other for 16:9. So contrary to you I do not exactly get what the ARS calculator is supposed to do, unless it is helping calculate the ratio that needs to be adjusted due to resizing.
check
9th September 2007, 13:56
Well, assuming the pixels are displayed as square, the aspect ratio of the file you have will be shows as 720/464 = 1.55. That's not too far off 1.85.
The next question is: does the shape of the video in your media player have an aspect of 1.55 or 1.81? (hint: use a ruler).
vlada
9th September 2007, 17:10
saint-francis
Your source was a DVD-Video. It has almost always resolution of 720x576 (which is 5:4), but it is played as 16:9 or 4:3. It means, that the video on DVD is always deformed. If you want to use square pixels (what I would suggest), you have to calculate real aspect ratio and the correct resolution for your movie.
Let's see an example: You have movie which is 720x576 and it is 16:9. Then if you look at the movie, you'll find out, that there are 70px wide black borders on the to and bottom. O.K., cut them away, but you're not done yet. You have no more black borders, but still a deformed video. Now you have to calculate the AR of active picture (the real picture without black borders). Because it is 16:9 DVD, it will play as 1024x576. Without black borders it will be 1024x436. So the real AR is 2.35:1 (quite a common situation).
So back to the processing. You have a movie which is now cropped to 720x436. If you want to fix it's proportions, you have to vertically shrink the picture to the correct AR. What will be the new size? It is very easy to calculate: 720/2.35 = 306. Make it rather dividable by 8, so your final movie resolution will be 720x306. How did you get to the 720x464 resolution? It should have been probably 720x392 (if the movie really is 1.85:1).
I know this is quite difficult to explain. Working with non-square pixels is not easy. Also my English is not good enough to explain it with the right words. So if you don't understand something, just ask me and I'll try to explain it better.
saint-francis
14th September 2007, 21:42
Well, assuming the pixels are displayed as square, the aspect ratio of the file you have will be shows as 720/464 = 1.55. That's not too far off 1.85.
The next question is: does the shape of the video in your media player have an aspect of 1.55 or 1.81? (hint: use a ruler).
Well I measured the video with a ruler and the ratio is 1.65:1. I haven't see that number put forward yet. What does this mean? :confused:
check
15th September 2007, 10:46
who knows ;). Just work out what the AR should be and remux to MKV with this AR specified as the DAR. Then everything is happy & flowers.
SeeMoreDigital
15th September 2007, 12:59
Well I measured the video with a ruler and the ratio is 1.65:1. I haven't see that number put forward yet. What does this mean? :confused:Before proceeding any further with the "aspect ratio signalling" side of discussion, I think it would be a good idea if you played your DVD source in VLC player, took
a "SnapShot" (from a nice light section of the movie) and uploaded it to the forum.
Cheers
saint-francis
26th September 2007, 21:30
Sorry it has taken me so long to respond to the last post. Lots of crazy things have been happening in my life and many of my projects have been put on hold. I captured a frame from the original DVD (not a rip) in PowerDVD and attached it.
Edit:
Well for some reason I can't attach the .png to the board so here is a direct download link.
http://rapidshare.com/files/58465990/Smokey_And_The_Bandit.PNG.html
SeeMoreDigital
26th September 2007, 22:41
Thanks for your snap-shop....
As I thought, the movie aspect ratio of your DVD source is approx 1.85:1 after cropping.
By-the-way... AVInaptic is displaying the correct information from what I can see ;)
saint-francis
26th September 2007, 22:51
As I thought, the movie aspect ratio of your DVD source is approx 1.85:1 after cropping.
By-the-way... AVInaptic is displaying the correct information from what I can see ;)
Yeah it says 1.85:1 right on the disk.
So my question now is, am I doing everything correctly when I encode and mux?
Does Pixel aspect ratio: 1:1 = 1 mean that the pixels are square?
Display aspect ratio: 45:29 = 1.551724
I can't help but notice that this isn't:
the level of "aspect ratio signalling" you require is: 31:26
However, you could also try 32:27 ;)
Thanks for the help :)
vlada
26th September 2007, 23:48
saint-francis
Sorry to say it, but your screenshot is completely wrong. From it you made all your wrong conclusions. On a DVD-Video you can never have a 1:1 PAR. Only 4:3 and 16:9 DAR is allowed.
http://img167.imageshack.us/img167/8168/smokeyrc0.jpg
If you look at your picture, it's obviously horizontally shrinked. If you open the video in DGMPGDec, Avidemux or VirtualDub MPEG-2, you'll see the same picture, which is incorrect. The movie obviously has DAR 16:9 and should look like this:
http://img220.imageshack.us/img220/4822/smokey2pa5.jpg
After cropping the black borders it is 853:462 = 1.85. Do you understand how I got these numbers? 853 is calculated as 16/9*480. Because you have to stretch the video to 16:9 DAR. Try playing it in MPC then capture your screen (for example with XnView) and check the size of MPC's window. It will be 853x480. I think you used internal frame capture in PowerDVD, which saved the picture in original resolution.
Is everything clear now?
P.S. To upload images use Imageshack or similar services, like I did.
saint-francis
6th October 2007, 22:21
Well I have read and re read everything I could find on anamorphic encoding, PAR, etc. and I think that the conclusion I have come to (correct me if I'm wrong) is that I should just tell mkvmerge to have an aspect ratio of 1.85 and all will be sorted out upon playback. This is safe because I didn't use the MeGUI "overcrop to acheive mod 16" function but the "resize to mod 16" function so I should have lost little (if any) of the original picture. Or should I specify the actual number of pixels the movie should be resized to upon playback by referencing the ratio SMD's tool produced?
So does this all mean the the MeGUI clever anamorphic encoding isn't really all that clever?
@ Vlada:
I'm in NTSC land so aspect ratios are different for me. And I didn't want to display the image in the post so SMD could have an unadulterated .png to work with.
vlada
7th October 2007, 14:16
saint-francis
From the picture's resolution it is obvious to me that it is an NTSC DVD, so I new it and I was calculating with NTSC numbers. But the logic is the same, just different numbers (576 vs. 480). On a DVD you can only have to DAR, 4:3 and 16:9. It is the same for both PAL and NTSC. There's no difference.
What to do with the video is basically up to you and your preferences. Basically you should always crop black borders. I prefer square pixels, so I would then resize the movie to 720x384. It should be in fact 720x389, but I rounded the 389 to make it dividable by 16. The difference between 389 and 384 shouldn't be visible.
But you can also just crop the borders and leave the movie at 720x464 and set aspect ratio to 1.85 in MKVMerge.
I don't know what logics MeGUI uses, I use my brain. :-)
P.S. You can upload a PNG to Imageshack.us too. But there is no advantage in having a 10x bigger PNG over a JPEG in this case.
SeeMoreDigital
7th October 2007, 14:46
I'm in NTSC land so aspect ratios are different for me. And I didn't want to display the image in the post so SMD could have an unadulterated .png to work with.Actually it makes no difference what your countries "colour standard" is. For more information... please refer to the following post: -
http://forum.doom9.org/showthread.php?p=1034465#post1034465
saint-francis
7th October 2007, 15:57
What to do with the video is basically up to you and your preferences. Basically you should always crop black borders. I prefer square pixels, so I would then resize the movie to 720x384. It should be in fact 720x389, but I rounded the 389 to make it dividable by 16. The difference between 389 and 384 shouldn't be visible.
I think I'm really beginning to understand your logic here.
I know my movie is 1.85 and I know that it's 720 pixels wide so if I divide 720 by 1.85 I get 389; which theoretically should be my vertical resolution after cropping. So my AVS script should have looked like this:
setMTmode (2,0)
DGDecode_mpeg2source("I:\Smokey And The Bandit\VTS_01_1.d2v",info=3)
ColorMatrix(hints=true,interlaced=true)
crop( 0, 6, -2, -14)
BicubicResize(720,384,0,0.5) # Bicubic (Neutral)
Undot() # Minimal Noise
I think I have my head wrapped around this enough to apply it in the future.
Now my question is, would not resizing during the encoding and having the container resize produce better quality than resizing during encoding? Theoretically it should since there would be more bit/pixel. Does it matter?
Oh yeah. @ MeGUI folk.
What's this? How and why did MeGUI get this and what exactly does it do? This tells x264 to place AR flags in the stream?
# Set DAR in encoder to 37 : 20. The following line is for automatic signalling
global MeGUI_darx = 37
global MeGUI_dary = 20
vlada
7th October 2007, 20:40
saint-francis
Yes, your script is now almost correct. But you're cropping 2 pixels from right side. I don't understand why. Then you're resizing horizontal resolution from 718 to 720 which isn't a good idea. Basically you should avoid resizing as much as possible.
So if you don't use resize during encoding at all, you'll get a better quality. But then you end up with non-square pixels and you have to set correct DAR. The drawback is, that it is not always working correctly. For example there was a bug in ffdshow which caused that DAR was not reported to video player.
There are 2 reasons to use resize:
1) Non-square pixels are causing troubles and it is principally wrong. Nobody uses non-square pictures in photographs, so why should video be different. It was a workaround for DV and DVD recorders/players to have same horizontal resolution for both NTSC and PAL (720px).
2) Usually you need to resize your video anyway to fit on 1 or 2 CDs. You need to get above 0,2 bpp (bits per pixel). So if you want to have 90 minutes on one CD with resolution 720x460 (just cropped video), you would end up with this: 90 minutes of stereo MP3 sound will take approximately 100MB. Your video size in bits is then 600*1024*1024*8. Divide this with the number of pixels your video has: 720*460*24*90*60 (24 = fps, 90 minutes, each minute 60s). You'll get only 0.117bpp. So your resolution is too high. But if you go for 2 CDs, you're O.K.
As I said it is all up to you and your preferences. But if you look at any pirate DVD-rips, they all have square pixels.
The values from MeGUI seem to be correct: 37/20=1.85.
And the last thing: don't forget about inverse telecine. Use Decomb (http://neuron2.net/decomb/decombnew.html) filter to do it.
saint-francis
7th October 2007, 21:08
saint-francis
But you're cropping 2 pixels from right side. I don't understand why. Then you're resizing horizontal resolution from 718 to 720 which isn't a good idea.
Yeah MeGUI did that. There must have bee some black boarders on the side as well, even if they were really small. Or did MeGUI just crop them for some other reason as yet unknown?
So if you don't use resize during encoding at all, you'll get a better quality. But then you end up with non-square pixels and you have to set correct DAR. The drawback is, that it is not always working correctly. For example there was a bug in ffdshow which caused that DAR was not reported to video player.
Got it. Thanks.
The values from MeGUI seem to be correct: 37/20=1.85.
So MeGUI is telling x264 to resize the image? Then clever anamorphic encoding does work. But then the pixels are not necessarily going to be square. Right?
vlada
7th October 2007, 22:40
Yeah MeGUI did that. There must have bee some black boarders on the side as well, even if they were really small. Or did MeGUI just crop them for some other reason as yet unknown?
I think it was probably incorrectly analyzed by Autocrop filter for Avisynth (I believe this is what MeGUI uses to determine cropping). It is always better to adjust it manually IMHO. Automatic processing is comfortable, but doesn't always give the best results.
So MeGUI is telling x264 to resize the image? Then clever anamorphic encoding does work. But then the pixels are not necessarily going to be square. Right?
No, x264 never resizes anything. MeGUI is probably telling x264 to set DAR flag. The DAR flag can be in both video stream and in container. If these two numbers are different, the result is uncertain. The DAR flag is during playback forwarded to player which then instructs renderer (overlay, VMR etc.) to resize the video. So if you have for example a 1280x960 monitor your 1.85:1 video will be resized to 1280x692 (when in fullscreen).
The last time I tried MeGUI+x264, the DAR flag was not set. I didn't check if it was fault of MeGUI or x264, I just used square pixels (resized the video in Avisynth). You can use MediaInfo to check, if the DAR flag is set correctly. Also playing the video in VLC or MPlayer usually shows if the flag is set correctly. It is usually more important to set the DAR in container. I'm not sure if MKVMerge will modify the video stream to set the same DAR for container and video stream. I haven't investigated this. I'm usually trying to avoid using non-square pixels.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.