[MPlayer-users] AutoDetect aspect ratio

Dave mplayer01 at dgmm.net
Sat Nov 29 19:47:30 CET 2014


On Tuesday 25 November 2014 11:10:57 David Thatcher wrote:
> Greetings,
> 
> I created an Xubuntu image that launches MPlayer to play a video on
> startup. I went to deploy it and the screen resolution was 4:3, so the wide
> aspect video displayed with black bars at the top and bottom. I was able to
> solve this by setting -aspect 4:3 in the mplayer options. The question is,
> I am going to be deploying to a variety of different screens and I want
> MPlayer to force whatever aspect ratio is represented by whatever screen
> resolution is currently set. If I leave -aspect 4:3 on a wide screen, I get
> black bars on the side. I am very much trying to avoid editing the launch
> script on each machine.
> Or... given that what I am going after is for MPlayer to run the video in
> such a way as to not leave the black bars regardless of screen resolution,
> is there a better command line option to use?
> Thanks in advance,

You could write a script to get the screen resolution and make a best guess at 
the most likely screen aspect ratio.  Ditto for the file about to be played.

Then, as other have mentioned, you can over-ride the displayed aspect ratio 
with whatever you choose, short fat people or tall skinny people.

To get screen resolution...
xrandr | grep \*\+
(Obviously you only need to get this once and store the result for each system 
you run on)

To get video resolution, pixel and display aspect ratios
ffprobe video.avi 2>&1 | grep Video

You'll need to do a bit more to get the numbers you want from those outputs 
and maybe some maths to calculate the whether you want 16:9 or 4:3.  (or 16:10 
or...or...or etc)


More information about the MPlayer-users mailing list