Steve Randall wrote:

Could we have an option called ASPECTRATIO or WIDESCREEN. I currently have to hack the mplayer and Xine command-lines to get the aspect ratio correct for my 16:9 tv, but all photo's are still displayed at the wrong aspect-ratio... is there any way we could add a master option for this (and also have it selectable from the GUI).

Sorry if this has already been implemented, if so - how do I use the option?

SR




Proper handling of widescreen TV is a bit of a palaver, I'm afraid. I don't use the image plugin so I can't help you there, but for movies I can give you a few tips:

- If you stick -monitoraspect 16:9 into local_conf.py > MPLAYER_ARGS_DEF, files that contain a recognizable aspect will play back properly, however:
- AVI files often aren't recognized due to the lack of any metadata field identifying its aspect. For that reason, you may need to tack on an additional -aspect 2.35 or whatever on a per-file basis.
- Many mpeg2/vcd files (actually most!) are encoded as 4:3 fullframe movies even if the actual content is cinemascope. In order to play these files back properly, not only do you need to stretch them out lengthwise, you must also crop off 1/3rd of the vertical image. This must also be done on a per-file basis. NB: If you crop the file, you *must not* specify an aspect for the movie ; mplayer won't stretch the film to fill the screen if you do! (don't know why..). For cinemascope (eg 2.35) there should still be a letterboxing but it should be limited to about 1/6th on top and bottom.


I've found that the only really good way to do the above is by creating an fxd for the file or fileset, and stick an mplayer-options into the file tag. Use the imdb plugin to make the fxd file, and then add the relevant options like this:

For avi files with unrecognizable aspect:
   <video>
     <file id="f0" mplayer-options="-mc 0 -aspect 2.40">cd1.avi</file>
     <file id="f1" mplayer-options="-mc 0 -aspect 2.40">cd2.avi</file>
   </video>

For an svcd/mpeg2 with letterboxing:

<video>
<file id="f0" mplayer-options="-vf crop=480:384,scale=480:576">cd1.bin</file>
<file id="f1" mplayer-options="-vf crop=480:384,scale=480:576">cd2.bin</file>
</video>


The above values were derived by taking the original height and dividing by 1.5 - then scaling back to original height.

What I do personally is I stick an imdb.id containing the imdb id (duh!) into each folder, and then iterate over them using a shell script which invokes freevo imdb folder.fxd file blah blah. This creates a folder.fxd for each movie. I then run another script which inspects the directories, and depending on file type either calculates the correct aspect ratio (avi files) or the proper crop size (for letterboxed svcds). In addition, if the file 'aspect' exits, the contents of this file is assumed to be the correct aspect (ie for non-letterboxed files).

Since this may be rather cryptic, I'll tack on some scripts to this mail - hopefully they may be of help to someone, but don't expect miracles, they are just work in progress.

I think the Proper Way to do this would be to add an IMDB search option to the directory context (so you can create a folder.fxd file from the remote), and also a play-item plugin which asks you for desired aspect and writes this into the fxd structure. Any takers ? :)

--
Ole Andre
#!/bin/sh
mplayer -vo null -ao null -frames 0 -identify "$@" 2>/dev/null |
        grep "^ID" |
        sed -e 's/[`\\!$"]/\\&/g' |
        sed -e '/^ID_FILENAME/ { s/^ID_FILENAME=\(.*\)/ID_FILENAME="\1"/g; }'

#!/bin/sh

MOVIES=/tmp/external/Movies # list all your movie folders here
FREEVO=/usr/bin/freevo
MIDENT=/usr/local/bin/midentify

for i in `ls $MOVIES`; do 
        DIR=$MOVIES/$i
    if [ -f $DIR/$i.fxd ]; then
        $DEBUG && echo Processing $DIR
        cd $DIR
        if [ ! -f aspect.ok ]; then
                FILE=`ls |grep -e .bin -e .avi -e .mpg|head -n 1` #First file found is 
assumed to be a part of the set
                FTYPE=`echo $FILE|sed -e 's/.*\.\(.*\)/\1/'`
                [ $DEBUG ] && echo $FILE is an $FTYPE file
                $MIDENT $FILE > __mident.out
                X=`grep VIDEO_WIDTH __mident.out|cut -f2 -d"="`
                Y=`grep VIDEO_HEIGHT __mident.out|cut -f2 -d"="`
                echo File is $X by $Y pixels
                
                case $FTYPE in
                        avi)
                           [ -f aspect ] && ASPECT=`/bin/cat aspect` || ASPECT=`echo 
"scale=2;$X/$Y"|bc -l`
                           [ -f crop ] && ASPECT="" && CROP=`echo "scale=0; $Y/1.5"|bc 
-l` && CROPCMD="-mc 0 -vf crop=$X:$CROP,scale=$X:$Y" || CROPCMD="-mc 0"
                        ;;
                        *)
                        # mpg and bin files
                         [ -f aspect ] && ASPECT=`cat aspect` ] ||  ASPECT=""
                         CROP=`echo "scale=0; $Y/1.5"|bc -l`
                         [ "$ASPECT" = "" ] && CROPCMD="-vf crop=$X:$CROP,scale=$X:$Y" 
|| CROPCMD=""
                        ;;
                esac     

                MPOPT="$CROPCMD" 
                [ ! "$ASPECT" = "" ] && MPOPT="$MPOPT -aspect $ASPECT"
                FXD=`ls |grep -E .*\.fxd$`
                mv $FXD $FXD.old
                cat $FXD.old |sed -e "s/\(id=\"f.\"\).*>\(.*<.*>\)/\1 
mplayer-options=\"$MPOPT\">\2>/" > $FXD
                echo $ASPECT > aspect.ok
        else
                        [ $DEBUG ] && echo $DIR: aspect fixed
        fi
    else
        echo $DIR: No fxd file here
    fi
done
#!/bin/sh

MOVIES=/media/Movies
FREEVO=/usr/bin/freevo
IMDB="$FREEVO imdb"

for i in `ls $MOVIES`; do 
        DIR=$MOVIES/$i
        if [ -f $DIR/imdb.id ]; then
                cd $DIR
                if [ ! -f $i.jpg ]; then
                        files=`ls |grep -e .bin -e .avi`
                        echo "Indexing $DIR..."
                        $IMDB `cat $DIR/imdb.id` $i.pl $files 
                else
                        [ $DEBUG ] && echo skipping $DIR/$i.jpg: cover already 
downloaded
                fi
        else
                echo $DIR: No imdb.id found
        fi
done

Reply via email to