[mythtv-users] Setting specific xrandr mode based on the file's refresh rate
Jean-Yves Avenard
jyavenard at gmail.com
Thu Feb 12 06:04:20 UTC 2009
Hi
Is there any way to set a specific refresh rate for the screen based
on the video you play?
Right now I'm using an external script to check the refresh rate used
by the video file, then set the appropriate xrandr mode before I run
mythtv on the file.
The downside with this is that I don't get any display on the LCD of my case...
Currently mythtv let you specify a xrandr mode based on the size of
the video you are playing. But can you do that same based on the
refresh rate without having to use an external script?
Here is the script I'm using BTW:
---
#! /bin/bash
BIN=/usr/bin/mplayer
MYTHBIN=/usr/bin/mythtv
XRANDR=/usr/bin/xrandr
if [ ! -n "$1" ]; then
echo "Usage: `basename $0` file."
exit 1
fi
RETURN=`$BIN -v "$1" -nosound -frames 0 | grep VIDEO:`
#Test if it's a video file
if [ "$RETURN" != "" ]; then
FPS=`echo $RETURN | grep fps | sed -e 's/^.* \(.*\) fps .*$/\1/g'`
WRES=`echo $RETURN | sed -e 's/^.* \([0-9]*\)x\([0-9]*\) .*$/\1/g'`
HRES=`echo $RETURN | sed -e 's/^.* \([0-9]*\)x\([0-9]*\) .*$/\2/g'`
CODEC=`echo $RETURN | sed -e 's/^.* \[\(.*\)\] .*$/\1/g'`
FPS2=`echo "tmp=$FPS; tmp /= 1; tmp" | bc`;
if [ "$FPS" != "" ]; then
#50 - "1920x1080 at 50"
#51 - "1920x1080 at 60"
#52 - "1920x1080 at 24"
#53 - "1920x1080 at 23.976"
#54 - "1920x1080 at 50i"
#55 - "1920x1080 at 60i"
#56 - "1920x1080 at 59.94"
#57 - "1920x1080 at 59.94i"
#"1920x1080 at 25" "1920x1080 at 29.97" "1920x1080 at 30.00"
RATE=51
if [ $FPS == 23.976 ]; then
RATE=53
elif [ $FPS == 59.940 ]; then
RATE=56
elif [ $FPS == 29.970 ]; then
RATE=56
elif [ $FPS2 == 24 ]; then
RATE=52
elif [ $FPS2 == 25 ]; then
RATE=50
elif [ $FPS2 == 50 ]; then
RATE=50
elif [ $FPS2 == 30 ]; then
RATE=51
elif [ $FPS2 == 60 ]; then
RATE=51
fi
#Use opengl for DX50 codec, XV for everything else
ext=`echo $1 | sed -e 's/^.*\.\(.*\)$/\1/g'`
echo 'Movie rate is' $FPS 'fps, setting screen to' $RATE',
H='$HRES 'W='$WRES', extension:' $ext', codec:'$CODEC
$XRANDR -r $RATE
$MYTHBIN "$1"
$XRANDR -r 50
fi
else
echo "Usage: `basename $0` video_file."
exit 1
fi
----
Cheers
Jean-Yves
More information about the mythtv-users
mailing list