[MPlayer-dev-eng] Recommend error for bad dimensions

Adam Rice adamrice at ntlworld.com
Wed Mar 3 00:41:20 CET 2004

Quoting D Richard Felker III (dalias at aerifal.cx):
> No, this is completely idiotic. Normally you should SCALE after crop,
> in which case any even dimensions are valid for crop. On the other
> hand, it should also be an error if you _scale_ to invalid dimensions.

But if you round the dimensions you scale to to multiples of 16, you're liable
to screw up the aspect ratio. Maybe you don't care about aspect ratio, but
I've seen quite enough Paula Abdul videos for one lifetime.

So then we're left instructing the user to 

1) crop, to remove black borders which waste bits
2) scale, to keep Rich happy
3) crop again to hit a multiple of 16 pixels in both directions

Having done all this, is there any guarantee that the resulting file will be
playable in anything other than mplayer anyway? I keep seeing postings from
people who are jumping through all kinds of hoops to get mencoder to spit out
something that other people can actually play.

> So the logic belongs in ve_lavc, not filters. Especially since the
> filters might not even be used for encoding but just for playing!!

Hands up everyone who uses cropdetect while playing? Come on, there must be
someone out there who's adopted this novel way to slow their computer down!

Are you proposing that ve_lavc should crop the video to multiples of 16
itself? If not, all you're doing is creating yet another hoop for users to
jump through. Do you really hate them so much?

I am not interested in punishing people who do stupid things, I'd rather try
to make it easier for them to do the right thing. Up until Rich started
ranting out of the blue this week, I had no idea that video dimensions ought
to be multiples of 16 pixels. I though I had read the documentation thoroughly
(several times actually), but clearly I was mistaken.

The other factor is that you're expecting users to work out the correct
dimensions in their head. Shocking though it may be, there are people out
there who have the temerity to use mencoder despite not having expert
knowledge of video codecs. I know, it's a horrible thought, but bear with me.
What I'm getting to is that even if they knew they needed to do rounding on
the dimensions of the video and were only too happy to do so, they might not
be able to do that rounding correctly anyway.

Revisiting my above list, it's step 3) that's the sticking point. How about a
filter called "smartcrop" which shaves a few pixels to get the dimensions to
be a multiple of 16? Then the ve_lavc error message can read something like

"X dimension (609 pixels) is not a multiple of 16 pixels. Use -vf smartcrop."

Newbies will be enlightened, and Rich can go back to coding G2.


Adam Rice -- adamrice at ntlworld.com -- Blackburn, Lancashire, England

More information about the MPlayer-dev-eng mailing list