[MPlayer-users] Calculating ideal resolution

Nikolaus Rath Nikolaus at rath.org
Fri Jul 11 16:40:17 CEST 2003


Hello,

I have created a script to calculate the ideal resolution and bpp for
a video. It is based on the script described in
DOCS/tech/encoding-tips.txt but does a little bit more magic.

Instead of calculating the size based on a fixed bitrate and bpp value
(or calculating the bpp value based on a fixed size and bitrate), it
calculates both bpp and size, assuring that they are in the best
possible proportion.

Because your opinion on "perfect proportion" may vary, you have to
configure the script by telling it a preferred and a minimum resolution
and bpp.

I've used the following values:

# CONFIGURE THIS:
# The preferred resolution, achieved with quality=1
res_max = 640 * 480
# The preferred bpp, achieved with quality=1
bpp_max = 0.26
# The minimum resolution
res_min = 528 * 240
# The minimum bpp
bpp_min = 0.18
# END CONFIGURABLE SECTION


Now let's assume that I have a PAL video that I want to encode at 1200
kbps. I could keep the resolution as it is (768x576) and just specify
the desired bitrate. But the resulting file would look bad, because it
would have a bpp value of 0.108. Now I can try to resize the video,
for example to 512x384. But this results in a bpp of 0.3. Instead of
endless fiddling around, I use the script now: 

nikratio:~$ bc videocalc.bc 
Enter actual width in pixels: 768
Enter actual height in pixels: 576
Enter desired quality (0 - 1) or bitrate (>1): 1200
Quality: .6009615384
BPP: .2280769230
Size: 544x416
Bitrate: 1290

Perfect result, IMO.

Maybe this script is useful for others. 

   --Nikolaus
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: videocalc.bc
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-users/attachments/20030711/1c2ecf24/attachment.txt>


More information about the MPlayer-users mailing list