View Full Version : MeGUI DVD to AVC & AR
drob
13th July 2011, 11:11
I am having some trouble encoding an animated PAL DVD into AVC.
My source is 4:3 fullscreen animation, using autocrop i cropped 2 px of top and bottom of the video. if i keep the anamorphic encoding using resize to mod16 option, i get some small black border top and bottom (image1) when i downsize vertically to 720x528 (suggested mod16) and crop 2 top 2 bottom, i get smaller black borders but still there (image2). finally if i take any of the encoding into VLC and select adjust aspect ratio to 4:3, i get a nice full screen image (image3). so i am guessing the problem is with some flags somewhere. any ideas?
http://img708.imageshack.us/img708/9632/32800442.th.jpg (http://img708.imageshack.us/i/32800442.jpg/)
http://img27.imageshack.us/img27/2003/19922206.th.jpg (http://img27.imageshack.us/i/19922206.jpg/)
http://img823.imageshack.us/img823/5725/25542178.th.jpg (http://img823.imageshack.us/i/25542178.jpg/)
hello_hello
14th July 2011, 05:04
What's the aspect ratio of your final encodes? (Does VLC display the media properties as do some other players?)
Comparing the three images, the VLC screenshot looks stretched, as though VLC is taking liberties with the aspect ratio to remove the black bars (push them off screen). If that's the case I don't know if it's normal as I don't use VLC.
What happens if you play the same video with Media Player Classic Home Cinema or some other media player which isn't VLC?
When it comes to the black bars themselves, are the first two images taken from MeGUI's preview window? It seems to me you probably just need to crop a little more manually (beyond what auto crop is cropping) to remove the black bars completely. Auto crop doesn't always get it right. I don't think I ever encode a video without manually tweaking the cropping.
drob
14th July 2011, 09:26
My final AR is is 720x528 4:3 (as sugested by MeGUI). using MPC the results seems very similar black bars wise, i tried cropping more (from 2 to 8 px) but that only increased the black borders. In the preview windows of MeGUI all looks fine using the 2 px crop.
http://img593.imageshack.us/img593/1653/55169310.th.jpg (http://img593.imageshack.us/i/55169310.jpg/)
http://img827.imageshack.us/img827/1331/23076795.th.jpg (http://img827.imageshack.us/i/23076795.jpg/)
http://img228.imageshack.us/img228/4558/19402659.th.jpg (http://img228.imageshack.us/i/19402659.jpg/)
http://img641.imageshack.us/img641/5116/80505452.th.jpg (http://img641.imageshack.us/i/80505452.jpg/)
hello_hello
14th July 2011, 11:26
Sorry but I'm at a loss as to what's going on there.
Maybe if someone more clever doesn't come along you could post a sample of the video you're converting for someone else (me) to try.
Thinking about it, are you using the AVCHD target device preset? If you are the aspect ratio won't be exactly 4:3. It'll be the aspect ratio supported by Blu-ray players which isn't quite 4:3 (similar to DVDs). There might be something in the log file along the lines of:
"[AVCHD]: assume --sar 16:11 as only 16:11 or 12:11 are supported with a resolution of 720x576".
If that's the case then when running the video full screen on a 4:3 monitor there will be small black bars, or at least black space, at the top and bottom of the video, but there shouldn't be any black bars when viewing the video at it's original size in a media player.
Reading your original post again I think I you may have been referring to having black bars while running the image full screen and I didn't understand you properly. If it's only a full screen problem on a 4:3 monitor, the AVCHD preset is probably the culprit.
The same would probably apply when resizing down to 720x528 as it's not 4:3 either. 704x528 would give you exactly 4:3 but which size would distort the actual picture the most really depends on how it's cropped.
Am I on the right track with any of that?
drob
14th July 2011, 14:09
With one notation you fixed it, it wasn't an AVCHD issue, i was using the x264 Blu-Ray 576p25, log showed sar 1:1, and never the less it was only an issue only in full screen media player mode, not original size media player window. BUT it was the resizing issue after all, as you suggested i resized it to 704x528 manually, not using the suggested resolution by MeGUI, and now i get a nice full screen no black borders image.
Thank you very much, next time ill go with the simple math.
http://img41.imageshack.us/img41/1108/59699010.th.jpg (http://imageshack.us/photo/my-images/41/59699010.jpg/)
hello_hello
14th July 2011, 16:29
I'm glad I could help.
With one notation you fixed it, it wasn't an AVCHD issue, i was using the x264 Blu-Ray 576p25
I think that preset adds "--bluray-compat" to the x264 command line which might be what's enforcing the Blu-ray aspect ratios, but I can't check because those presets are old and I've deleted them. These days I think if you use the x264 defaults and select Blu-ray as the Target Playback Device it does basically the same thing and you don't have to worry about different presets for PAL/NTSC etc, plus I think those presets were wrong in that they added High Definition colorimetry info to PAL and NTSC encodes (bt709) which isn't correct.
A few more thoughts... If you want to resize down to square pixels (which really doesn't loose you much definition when encoding 4:3 video) and also want to minimise the picture aspect ratio distortion (cause the picture has to be stretched or squashed a little to fit into mod16 dimensions) this resize calculator is a handy thing. http://www.mediafire.com/?airxmp5qrtcbw2j
It'll calculate the aspect ratio distortion while you adjust your cropping and it'll let you choose between using the ITU and non-ITU resize methods. It's a pity MeGUI doesn't have a similar thing built in.
If you want to stick with anamorphic encoding, which I normally do, I'm pretty sure these x264 settings in MeGUI will give you the same Blu-ray compatibility the Blu-ray target device option does, minus the enforcement of 720x576 and 720x480 aspect ratios. And unlike the old x264 presets, the colorimetry info is correct. I use these for encoding MKVs.
For PAL:
--level 4.1 --keyint 25 --open-gop --b-pyramid strict --weightp 1 --slices 4 --vbv-bufsize 30000 --vbv-maxrate 40000 --aud --nal-hrd vbr --colorprim bt470bg --transfer bt470bg --colormatrix bt470bg
For NTSC:
--level 4.1 --keyint 24 --open-gop --b-pyramid strict --weightp 1 --slices 4 --vbv-bufsize 30000 --vbv-maxrate 40000 --aud --nal-hrd vbr --colorprim smpte170m --transfer smpte170m --colormatrix smpte170m
For HD:
--level 4.1 --keyint 24 --open-gop --b-pyramid strict --weightp 1 --slices 4 --vbv-bufsize 30000 --vbv-maxrate 40000 --aud --nal-hrd vbr --colorprim bt709 --transfer bt709 --colormatrix bt709
Using the last one, you just need to change --keyint to either 24 or 25 according to the frame rate.
drob
14th July 2011, 19:06
That calculator is really great help - thank you for that, it helped me understand much more about all the deferent "ratios". Am i right in understanding now that the issues i had with the image not completely stretching on the PC screen is a matter of square pixels of the PC screen, rather then one of a proper aspect ratio, that is it might not fill the PC screen but it would be fine on the TV?
AS for bluray_compat=1 its there so your right again.
So bottom line if my target is LCD TV display am i better off going with MeGUI suggested resolution, or square pixels?
hello_hello
15th July 2011, 07:31
So bottom line if my target is LCD TV display am i better off going with MeGUI suggested resolution, or square pixels?
The MeGUI "suggested resolution" does use square pixels. It's the anamorphic encoding which uses non-square pixels.
TVs use square pixels the same as a PC monitor, but when video is displayed on a TV there's usually over-scanning so some of the picture will be off the screen and it'll fill it even if the aspect ratio isn't exactly 4:3 (in fact the "official" way to resize a 4:3 DVD doesn't actually give you an exact 4:3 aspect ratio). There's no over-scanning when using a PC monitor. The black bars you're cropping when encoding would actually be off the screen when the video is displayed on a 4:3 TV so you wouldn't see them.
When you resize down (704x528) you're resizing the image, which is comprised of non-square DVD pixels, down to square pixel dimensions. Without going into the details as to why, generally the width and height should be divisible by 16 (mod16). So with MeGUI you pick the desired width, crop, and then MeGUI will suggest the closest Mod16 height for minimum picture distortion. If you disable the "suggest" function, it just means you have to pick the appropriate/closest height yourself.
That's where the calculator comes in. The width and height are the display aspect ratio. The shape of objects within the video could be thought of as the picture aspect ratio. The idea of the calculator is to adjust the cropping (often you need to crop a little picture) so the video has a mod16 display aspect ratio with the minimum picture aspect ratio distortion. It's all resizing down to square pixels though.
The calculator will let you choose non-mod16 dimensions (mod4 mod2 etc). MeGUI doesn't. It's probably easiest to crop the black bars, let MeGUI "suggest" the height, then use that cropping and display aspect ratio as your starting point when using the calculator to refine your cropping. Make sure both MeGUI and the calculator are using the same resizing method. Both the calculator and MeGUI let you choose between the "official" ITU resize method and the straight 4:3 or 16:9 resize methods. Use the latter. Most DVDs do. Most software players (MPC, VLC etc) all display DVDs using the non-ITU resizing method.
Anamorphic encoding is a whole other story. The idea being not to resize the picture so as to retain maximum detail. For 4:3 video there's not much resizing when using square pixels so the quality difference is negligible, for 16:9 video anamorphic encoding is much better.
When using anamorphic encoding you can check the display aspect ratio in the Script tab and adjust the cropping to obtain exactly 4:3 or 16:9. You don't need the calculator.
MeGUI also has an option for "acceptable (picture) aspect ratio distortion" which is 2% by default. It applies to anamorphic encoding and makes is easier to achieve nice 4:3 and 16:9 etc aspect ratios. I usually set it to zero or one percent. The lower the percentage the more exact your cropping has to be in order to end up with an exact 4:3, 16:9 aspect ratio.
I'm pretty sure the --bluray-compat setting enforces the official 4:3 & 16:9 Blu-ray aspect ratios for resolutions of 720x576 and 720x480. Like the "official" DVD aspect ratios, they're not exactly 4:3 or 16:9, which is why I don't use it.
Hopefully all of that makes sense.....
drob
16th July 2011, 10:18
This explanation is really helping, i have been doing allot of reading about AR and the whole ITU none ITU debacle, it is my understanding most DVD's authored after 2006 are indeed none ITU.
As for the --bluray-compat switch i believe your right, according to this following table it enforces the ITU ratios for SD content .
http://forum.doom9.org/showthread.php?t=154533
I am thinking just for future BluRay compatabilty sake i will stick with ITU when encoding.
Thank you again for your help.
hello_hello
16th July 2011, 11:46
I've compared a lot of DVD encodes with their Blu-ray counterparts and the aspect ratio is invariably the same. I've never used ITU resizing.
What format are you encoding for? If the idea is to make a Blu-ray compliant video disc then yes you have to stick to 720x576 and the correct aspect ratio, but if you're encoding MKV or MP4 files for use in an MKV/MP4 compatible player then you should be able to use whichever resolution and aspect ratio you want to.
Keep in mind a lot of DVD content (especially 16:9) is actually of a different aspect ratio such as 2.35 etc and includes black bars top and bottom. When encoding it's usual to crop the black bars but while you can still encode anamorphically you'll end up with a completely different aspect ratio. If you want to be Blu-ray compliant then you'd probably encode the whole thing, black bars included, so you can stick to 720x576 as a resolution without resizing.
Also, I'm sure the Blu-ray "target device" option in MeGUI is broken at the moment. It's fine for 4:3 video, but when you encode 720x576 16:9 video, it still gives you a 4:3 aspect ratio. Whether the same thing happens when using the old presets you're using, I'm not sure. I posted a couple of bug reports here http://forum.doom9.org/showthread.php?t=151159&page=107
drob
16th July 2011, 16:33
OK im sold ill stick with straight 4:3. The reason i am getting into all this confusion is that i almost never encoded fullscreen DVD material, it was always widescreen of HD content, where for me at least things seemed much more straightforward- keep anamorphic, or keep to MeGUI suggested resolutions and encode, never had AR problems, but DVD 4:3 puzzled me.
My source is a loved old cartoonish TV series which i got the DVD for and want to back up for posterity. Its really badly mastered really noisy VHS to DVD with some overscan covered with padding left over and under. Specifically i am targeting a WDTV like player, but thought about being BluRay compliant for future devices, which seems redundant now.
One more question if i may, the preview windows of MeGUI is accurate, i mean what i see there is what i get black borders/AR and so on, or does it have the same characteristics of other software players, that is size the play area to fit and so on?
hello_hello
16th July 2011, 18:52
There's nothing wrong with using anamorphic encoding for 4:3, I do most of the time, and it's really no different to 16:9 widesrceen encoding, except for when the output resolution is 720x576 and the Blu-ray option is enabled. Oh, and if you use the ITU resize method and it's not actually 4:3. :)
I look at it this way.... as soon as you crop, even if you resize back to 720x576, the display aspect ratio has to change so as not to distort the picture. If you open a 4:3 PAL DVD and use ITU resizing, before cropping the aspect ratio in MeGUI's Script tab will say 93:68. If you crop 4 pixels from the top and bottom, then you'll need to crop a total of ten pixels from the sides to take you back to 93:68 again. That way you can make a Blu-ray compliant 720x576 4:3 encode without distorting the picture.
As I don't care about Blu-ray compliance as such, I dump the ---bluray-compat option, use non-ITU resizing and aim for a 4:3 aspect ratio, but it's the same principle.
When you first index the video, the preview window which opens with the script creator should display the cropping properly but doesn't display the correct aspect ratio. After you save the script, the second preview window will display the correct aspect ratio if you tick the Preview DAR box.
I just gave it a quick try and it appears to resize differently to MPC. Where MPC stretches the width to display the correct aspect ratio, the preview window seems to reduce the height instead so even though the aspect ratio is the same the preview window displays a smaller picture. At least that's what I assume is happening....
From memory if the previewed picture is larger than your monitor resolution, the preview window will have scroll bars.
drob
17th July 2011, 17:49
I just have two more questions, if i do go with BD compliance i have to pad my 704x528 file with black to get back to the 720x576 resolution, did i understand it correctly?
In 4:3 PAL the deferences between ITU and straight resolutions seems very small, in that case should i go with ITU or still keep to straight 4:3?
On side noter i found a newer version of Yoda's calc v0.3.5.11
http://www.mediafire.com/?09v9bldu9a6hm00
hello_hello
18th July 2011, 04:15
I jujst have two more questions, if i do go with BD compliance i have to pad my 704x528 file with black to get back to the 720x576 resolution, did i understand it correctly?
Not necessarily. If you're only cropping a small amount you can use the "resize to mod16" anamorphic option and make sure you resize up to 720x576. However if you crop from the top and bottom for example, then you'd want to crop an appropriate amount from the sides so the display aspect ratio doesn't change when the Blu-ray aspect ratio is enforced. You can't always get it exact, but usually pretty close.
It only applies to small amounts of cropping as once you crop beyond a certain point MeGUI won't let you resize up to 720x576 any more so you'd have to leave black bars as padding.
If you crop a large amount and want 720x576 as well, the only way around it would be to open the script MeGUI saves for encoding and manually change the resizing to 720x576 before you encode. Doing so won't mess with the final display aspect ratio.... at least I'm pretty sure it won't.
Thinking about it, and sorry if this confuses the issue but it's just a thought which popped into my head.....
What if you had a 4:3 DVD and wanted non-ITU resizing when decoding it but ITU resizing (for Bluray compatibility) when encoding it? In other words, you have a DVD which doesn't use ITU resizing but you still want Bluray compatibility.... which would probably the case most of the time.
Now, the ITU aspect ratio is 93:68 so if you select the ITU option in MeGUI and your aspect ratio is still 93:68 after cropping then you're "ITU" from start to finish. Alternatively you'd select the non-ITU resize method in MeGUI which means a 4:3 aspect ratio, and if after cropping your aspect ratio is still 4:3 you're non-ITU from start to finish, but that's not Bluray complaint.
If you chose the non-ITU resize method in MeGUI (which would give you a 4:3 aspect ratio before cropping), then you cropped until the aspect ratio is 93:68, when you encode using the Bluray compatibility option (720x576) it won't mess with the aspect ratio because you're already 93:68. I can't think of a reason why that wouldn't work. I wonder why it'd never occurred to me before?
In 4:3 PAL the deferences between ITU and straight resolutions seems very small, in that case should i go with ITU or still keep to straight 4:3?
For 4:3 stuff it doesn't seem to make much difference, especially if the quality isn't all that flash to begin with, so you'd probably encode according to your target device. The difference is only about 30 pixels in height or 50 in width, depending on how you calculate it.
I recently encoded the box set of an old PAL 4:3 comedy series. I encoded it all twice, once using anamorphic x264 encoding and the other using XviD AVI. The first I encoded at 688x544 (they needed a lot of cropping) and the second at 640x480.
Side by side on my pair of 22" Trinitron CRT monitors if I can see a difference it's only marginal and mainly only when I pause them on the same frames to have a close look. I suspect any difference is really more x264 v Xvid rather than the resizing.
On side noter i found a newer version of Yoda's calc v0.3.5.11
http://www.mediafire.com/?09v9bldu9a6hm00
Thanks for that.
drob
22nd July 2011, 13:55
As to my understanding of AR (limited as it is) i guess once you have BD appropriate ration your OK regardless of where you stared with, so i am with you on that theory.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.