[MPlayer-users] mplayer, scaling, croping, the REAL story? (long)

D Richard Felker III dalias at aerifal.cx
Tue Mar 2 21:52:00 CET 2004


On Tue, Mar 02, 2004 at 12:00:30PM -0600, Wayde Milas wrote:
> Ok, in my quest to understand DVD encoding, and how mplayer actually
> works, I've come across this issue. I'm trying to completely understand
> the scaling, aspect ratios, and how everything relates to everything
> else. While I'm competent enough to encode movies that look good, I
> still don't understand some of the fundamentals that have to do with
> croping and scaling "correctly" and how this affects Aspect Ratios. BTW,
> if this thread takes off and alot of my questions are answered, this
> might not be a bad thing to add to the mplayer FAQ/documentation as I
> feel alot of people are confused by this and there is no good source (at
> least that I could find) to the following questions.
> 
> In all my following examples, I'm going to use the DVD AI (Artficial
> Intellegance - Haley Osmond - Kubrik) chapter 5. To start, let me first
> note some facts (and correct me if I get them wrong) and then pose some
> questions.
> 
> 1) All standard DVD's are encoded at 720x576. I've heard that there are
> some that are not encoded at this, but I havent seen any.
> 
> So, My first question:
> 
> 1A) How do you detect if a DVD is encoded at something different that
> 720x576? Using AI/chapter 5, mplayer shows on startup that:
> MPEG-PS file format detected.
> VIDEO:  MPEG2  720x480  (aspect 3)  29.970 fps  9801.6 kbps (1225.2
> kbyte/s)
> So I'm assuming that even though the DVD is encoded at 720x576, mplayer

No, the movie is 720x480. 720x576 is for PAL discs. 720x480 for NTSC.

> is scaling it to 720x480 for play on the computer. Why? I can see it
> being scaled for TV play, why for computer play?

Because your monitor (or rather video mode) has square pixels and the
encoded movie doesn't. Thus you'll have to scale.

> 2a) What I don't understand is why mplayer spits out:
> Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
> VO: [null] 720x480 => 854x480 Mpeg PES
> How was this number obtained?

By upscaling 720x480 to obtain dimensions with 1.78:1 aspect ratio.
480 * 1.78 = 854.

> 3a) It has been noted that one must apply constraints to the crop size
> because mpeg4 encoding uses block sizes of 16 aligned on even boundries.
> Ok.  I've heard that the width and height must be divisible by 16, and
> that the vertical and horizontal offsets must be even. I have also heard
> that vertical ofset should only be a multiple of 4? What exactly are the
> constraints for optimal encoding?

All of this is correct. multiple-of-4 only applies for interlaced or
telecined video.

> 3b) If I dont crop on the constraints listed above (and just use the raw
> output from cropdetect), I've noted that mplayer plays the movie back
> just fine, and that the size of the encoded file, compared to once
> encoded with no crop at all, is smaller. Will there be an even greater
> compression savings if the constraints are used?

Size is smaller? Under what encoding constraints?

> 3c) If I do not use the cronstraints, is this permissable by the mpeg4
> standard, or is it just "wierd" that mplayer supports this?

AFAIK it's permissible, but some players don't like it. It might not
be permissible in some of the more basic profiles.

> 4b) The first line is silly since I would be scaling up, the second is
> what I want, scaling down to the next 16 boundry in width. But why do
> all these lines scale height by so much? I could see it perhaps being
> 480 or even 464. But 336? That completely distorts the aspect ratio plus
> throws out a ton of the info I need to do an accurate encoding?

Because the final aspect needs to give square pixels if you're making
an avi file that you want other players to be able to play. MPEG4
codec has an aspect tag to support arbitrary aspect, but stupid
windows avi player apps don't honor it.

Rich




More information about the MPlayer-users mailing list