View Full Version : "Default" VLC player Aspect Ratio incorrect
edwinbradford
27th November 2007, 23:21
Hi,
I`m a newbie, just started using MeGUI to convert captured video game footage to MP4 using x264. The results are fantastic, I can't tell the difference between the original captured footage and the MP4 version thanks to all the help I've found here, especially using Sharktooth's profiles.
I have one problem to overcome before I batch process my files. When I open the MP4s generated by MeGUI in VLC, the video is always slightly too wide and I have to manually correct it by choosing 4:3 in VLC's Aspect Ratio menu at which point it displays perfectly. It's a bit annoying and I'd like to correct this if possible.
I've read the guides on Aspect Ratio, PARs, DARs and SARs, done searches here and tried setting ratios in MeGUI, x264 and Avisynth but can't seem to find a fix. The only thing I've found that fixed it was to set the output dimensions of video to always be 640x480 in VLC itself but that's not a very flexible solution.
My source footage is 720x480 and looks best on my monitor when displayed at a 4:3 ratio as it is in the proprietary capture software, effectively looking like it's 640x480 (though I understand it's not). I can preview the difference in Photoshop which has a pixel aspect ratio preview setting and a captured image looks correct at the NTSC (0.9) setting.
Selecting ITU 4:3 NTSC in MeGUI`s video preview window (or trying to set aspect ratios in x264 and Avisynth) generates an MP4 that plays in the correct 4:3 ratio in VLC but displays about 15% larger on screen than the source and looks significantly worse than if I manually correct a default aspect ratio encode to 4:3 in VLCs aspect ratio menu. If I view the "Stream and Media Info" in VLC the MP4 is still 720x480. Sorry to ask for what's probably a simple fix and I see that aspect ratios continually come up but I'm stuck on this.
Many thanks.
terminate
28th November 2007, 04:43
Well, I have to admit, that I never really understood the philosophy behind megui's aspect ratio settings, so I always use "clever anamorphic encoding" and an aspect ratio of 16:9 or 4:3 (if it looks more like 4:3 than 16:9 or 221:100) for every movie, however the resulting aspect-ratio for me is never the same as in the original movie.
Therefore after every encoding I use kurtnoise's YAMB 2 to mux and/or correct the aspect-ratio, (in fact its the par), of the final movie, but therefore I have to calculate the necessary pixel-aspect-ratio (par) manually, (actually I wrote an OpenOffice-Calc Macro to do this for me). After opening a mp4 file in Yamb for muxing/remuxing you can select the file and click on "Properties", then the properties-window will open and you can enter a custom par.
Calculating the correct par is done like this, (In this example 16:9 is my desired aspect-ratio and 720 x 576 is my real final movie size after cropping, encoding and everything):
par = (16 * 576) / (9 * 720)
which would result in, (reduced fraction with the lowest common denominator):
par = 64 / 45
Now I can put 64:45 in to Yambs properties-window and let the thing run.
Of course there may be better ways, but since this method works very reliably, (with OpenOffice calculating the par fraction for me), I never tried to find out how to use the megui aspect-ratio settings in a proper way, actually I don't care any longer about the ar-settings in megui.
terminate
28th November 2007, 05:16
After all, I forgot, in your case (final movie resolution: 720 x 480 and a desired aspect ratio of 4:3 the correct pixel-aspect-ratio would be:
par = (4 * 480) / (3 * 720)
par = 8 / 9
So you would have to type 8:9 in Yambs properties-window.
(B.t.w. its also possible to mp4box in the command shell to change the par of an mp4 file).
edwinbradford
28th November 2007, 22:11
Thanks for the feedback, that's great. I just got in from work, I'll see if I can get it working tonight but I'll post back with results once I have something working whatever the case. Cheers.
berrinam
28th November 2007, 22:37
Calculating the correct par is done like this, (In this example 16:9 is my desired aspect-ratio and 720 x 576 is my real final movie size after cropping, encoding and everything):
par = (16 * 576) / (9 * 720)
which would result in, (reduced fraction with the lowest common denominator):
par = 64 / 45
Nearly. The problem is that aspect ratio of anamorphic DVDs is not 16:9 (1.77777:1), but more like 1.823:1. See this sticky (http://forum.doom9.org/showthread.php?p=239924#post239924) for more reading.
@edwinbradford: I'm afraid there are too many steps in your process for me to know what the problem is, and it's not clear to me exactly how you did the encode. Saying specifically which MeGUI tools you used in which order would be useful. (Also, if it is a question concerning MeGUI, it would also be a good idea to include MeGUI somewhere in the title, otherwise we, the devs, are less likely to read it.)
You should also try playing the created files in a number of different players to see if VLC is simply ignoring the signalled aspect ratio and assuming square pixels.
SeeMoreDigital
28th November 2007, 22:56
I currently have VLC v0.8.6.c installed and have tried it with many different PAR values within MPEG-4 Part-2 and Part-10 streams placed within .AVI, .MP4 and .MKV...
All the encodes are displayed correctly as per the appropriate aspect ratio signalling value.
edwinbradford
29th November 2007, 00:18
OK, thanks everyone for the help. I appreciate it must be a pain to resolve aspect ratios as they come up so often. I tried it again tonight with no luck but I am getting a better understanding of the subject so I just think I'll read up more on it including your link berrinam and keep experimenting until I either can't get any further or I solve it.
If I can't solve it I'll be more specific with my feedback, to be honest I have a cold and haven't been as thorough as I should have been :rolleyes: . I`ll keep at it, I'm new to it all so it's quite a lot to take in at first.
Thanks again, great community here.
terminate
29th November 2007, 15:26
Nearly. The problem is that aspect ratio of anamorphic DVDs is not 16:9 (1.77777:1), but more like 1.823:1. See this sticky (http://forum.doom9.org/showthread.php?p=239924#post239924) for more reading.
Well, no problem, if your desired apsect-ratio is not 16:9 (1.77777:1) but 1.823:1 (as a fraction: 1823/1000) you have put these values into the formula:
par = (1823 * 576) / (1000 * 720)
par = 1823 / 1250
But because Yamb 2, (or mp4box), only uses 3 digits for par, we have to round up respectively round down the values, which will result in something like:
par = 182 / 125
(only valid for this arbitrary example of course)
I just wanted to show a general method how someone can change the display-aspect-ratio (via the pixel-aspect-ratio) of an already encoded mp4 file. I made no further assumptions about if edwinbradfords original video DAR is exactly 4:3 or only close to 4:3.
SeeMoreDigital
29th November 2007, 16:28
Will this post help: -
http://forum.doom9.org/showthread.php?p=1034465#post1034465
edwinbradford
30th November 2007, 00:29
Wow, really helpful thanks everyone, a lot more reading there. I've managed to get a couple of hours looking at it tonight. I have to be quick as I'm up early for work tomorrow but until I can write in more detail (be next week as I have an exam this weekend), it appears that the problem lies with VLC. I figured out how to open the encoded MP4s in FFplay and the scale is perfect, also I downloaded MP4Box and was able to get the encoded MP4 file information confirmed as:
AVC/H264 Video - Visual Size 720 x 480 -
Pixel Aspect Ratio 8:9 - Indicated track size 640 x 480
...also perfect. For a test I added --sar 9:8 to MeGUI`s Custom Commandline Options field in the Config section of x264 (I realize this SAR ratio is the wrong way around) and sure enough VLC kept the height of the video the same and stretched the width too wide, great. Then I re-entered it as --sar 8:9 and VLC should have kept the height the same and compressed the width but instead it kept the width the same as the source and expanded the depth to get the 4:3 ratio.
So if I have my facts right VLC decides it's better to stretch the height of a movie to retain the 4:3 ratio than to compress the width. I don't know the accepted rules on this but both my source and converted video certainly look better by compressing width as FFplay does. If you're interested in watching full screen MP4s none of this would bother you but I need to be able to view my captured footage at 640x480 pixel resolution.
Sorry I'm uploading this info in a bit of a hurry, it might also be useful to know that MeGUI reports my source material in the Preview Window as DAR 1.5, the source is 720x480, whenever I tested setting that as ITU 4:3 NTSC I got oversized output again. I`m guessing that means my captured footage is in square pixels. Incidentally I`m using a PV3 card to do the capture there's a thread here on Doom9 (http://forum.doom9.org/showthread.php?t=120785)on the card. Thanks everyone again for really comprehensive help and advice.
edwinbradford
15th December 2007, 19:35
It`s a couple of weeks later and I've got everything working so here's what I found in case it helps any other newbies.
The best lesson I've learnt across my conversion pipeline is when you hit a snag try it in a different player first. Generally I found MeGUI to be the most reliable part of the process. As mentioned above, MP4Box proves the display size and aspect ratio in the encoded MP4 are correctly set but not all players display it correctly. VLC, the player I've always used, gets it wrong as does SMPlayer (otherwise a great player I found), they both display it at the correct 4:3 aspect ratio but not at the specified 640x480 size, it's scaled up.
Reading the links below referred me to KMplayer which is an unbelievably great free player and sure enough the first time I opened my MP4 it displayed as nature intended with correct aspect ratio and pixel dimensions. KMPlayer has a myriad of options and the support looks good too but it just seems to work out of the box.
Two other slightly off topic points, first, if you're encoding video games as I am then there's a great settings guide at SpeedDemosArchive.com (http://speeddemosarchive.com/kb/index.php/MeGUI) . Second, to illustrate testing your MP4 in another player, I also hit a snag with the volume being increased at quiet points adding background hiss not in the source material. I eventually narrowed this down to being the fact that my Player (KMPlayer) had a "Normalizer" audio function that increased volume at quiet points, switching this off fixed the problem but of course it took me a few hours to work out that MeGUI wasn't the cause.
Thanks everyone for your help, it was great advice.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.