View Full Version : Anamorphic encoding - cropping and no resizing
loni_blues
15th March 2004, 11:58
Hi,
I am using Gknot and matroska in trying to make an anamorphic encoding cropping the black bars and doing no resizing afterwards in the avs. I afterwards use mkvmerge to set the 16/9 aspect ratio.
I followed hakko´s advice:On resolution tab, set Display AR to 1.5 (NTSC, 1.25 for PAL) and w-modul to 16. Then use cropping to get rid of the black bars, and comment out the resize in the final .avs The question is: Shouldn´t I do a smart crop after cropping the black bars to get the right aspect ratio? Or does smart crop only work resizing in the avs script?
Thanks,
loni_blues
manono
15th March 2004, 12:28
Hi-
Yes, most times you'll have to crop a bit into the video to get the Aspect Error down close to zero. So, use one of the Smart Crops, or use Pixel Crop to do it manually, up to you.
loni_blues
16th March 2004, 11:58
Thanks, manono.
I have a couple of further questions. I heard somewhere that in order to make a good encoding you need a 16x16 resolution. Is this true? Sometimes, when I open the avs with cropping and no resizing in Virtualdubmod I see the picture in black and white with patches of colour here and there - this is the closest I can get to describing the phenomenon-. Though the encoding seems to turn out fine, is this related to not having a 16x16 resolution?
Thanks in advance,
loni_blues.
piscator
16th March 2004, 16:43
Actually, for safe encoding and maximum playback compatibility, I think you're supposed to use a multiple of a 32x16 resolution.
The reason for this is how MPEG4 (and also MPEG2 I think) encoding/decoding works. Your picture is divided in macroblocks of 16x16 (I think, to be sure lookup the details yourself). If your resolution is not an exact multiple of the size of a macroblock:
+ the encoding is not optimal.
+ the encoder can choke.
+ the decoder can choke (especially decoders of stand-alone devices).
Furthermore, many of the yuv2 filters in VDub/AviSynth require specific resolutions. If these are not met, the filter is ignored or scrambles up your image as you describe.
But why are you so worried about exact aspect ratio? It's not like you're going to see the difference of a few percent. Even if you use your DVD player to playback standard DVD's, the aspect ratio is a bit off.
So I recommend you to use a multiple of a 32x16 resolution, or you can run in no end of problems.
loni_blues
16th March 2004, 21:06
Thanks, piscator.
I think you are right about the macroblocks. May be I am worrying too much about a perfect aspect ratio. Since I use no DVD player, I am going to stick to a 16x16 resolution.
loni_blues
manono
16th March 2004, 22:25
Yes, 16x16 is usually pretty safe, and 32x16 can be better sometimes, for the reasons that piscator outlined.
As for sometimes getting garbled video, the cropping numbers used, as well as the resolution used, can be important. There's some information here:
http://www.avisynth.org/index.php?page=Crop
And more information here:
http://forum.doom9.org/showthread.php?s=&threadid=42708
And remember, for GKnot users, in almost all cases, the information you want is that for the YV12 colorspace. But again, as piscator said, if you're using some YUV2 filters, the rules can change a bit.
I do disagree a little bit with piscator about Aspect Error of a few percent not being important. But I had a discussion with a friend just yesterday about that same thing, and he also took piscator's position. He said to crop to remove all the black and resize to 512x384 without cropping any further into the video to lower the Aspect Error. This would have given an Aspect Error of about 2%. My position was that the Aspect Error should be as low as possible, meaning either cropping further to get 512x384 with low Aspect Error, or to use 528x384 (which is what I wound up doing). But as piscator also said, the players, whether hardware or software, aren't always accurate about these things. But I prefer doing what I can to make it as accurate as possible. Personal preference, I guess.
piscator
17th March 2004, 15:36
Originally posted by manono
I do disagree a little bit with piscator about Aspect Error of a few percent not being important. But I had a discussion with a friend just yesterday about that same thing, and he also took piscator's position.
:) And I didn't even start the discussion about the more controversial issue of NOT resizing during encode but during playback (matroska AR flag). I wonder why people don't want to resize, because
1) The case you're not maxing out on quality. You're wasting bitrate and hence quality on the bigger non-resized resolution. The available bitrate could better have been used on the resized resolution.
2) The case you're maxing out on quality (and better use 1-pass Q2). You're wasting on precious filesize (on which I try to be a bit stingy).
3) You're resizing anyway during playback. And that resize probably isn't as good as the Lanczos resizer that can be used during encode.
And another minor issue. It would probably be better if the Autocrop function of GKnot would yield a resolution multiple of 4x2 (instead of 2x2). If you use, for example, the deinterlace filter "TomsMoComp", it won't work if your width is not dividable by 4. But as I said, it's minor and you can do it manually.
greetz,
Piscator
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.