[MPlayer-dev-eng] -vm and aspect

A Mennucc1 debdev at Tonelli.sns.it
Tue Mar 25 15:24:57 CET 2003


hello

I see two bugs in the -vm implementatio

1)
I have ripped the DVD of Lord Of the rings
(that I own    :-)  )

(I used a script that computes automatically aspect and crop,
and does a 3 stage ripping , see attachment)


if I play it with  mplayer -vm,
though, the aspect is not respected

2) sometimes mplayer crashes after it changes videomode
and says 

....
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is undefined - no prescaling applied.
VO: [xv] 240x180 => 240x180 Planar YV12  [vm]
XF86VM: Selected video mode 640x480 for image size 240x180.
X11 error: BadMatch (invalid parameter attributes)

bye

a.


-- 
Andrea Mennucc
 "E' un mondo difficile. Che vita intensa!" (Tonino Carotone)
-------------- next part --------------
#!/bin/sh
set -e 

#######################  edit at taste but do not put spaces

VOP=''
#VOP='pp=lb'

DVD='-dvd 1 -alang it -dvd-device /dev/cdrom -cache 8192'

A='-oac mp3lame -lameopts preset=128'

LAVC='vhq:vqmin=2:vlelim=-4:vcelim=9:lumi_mask=0.05:dark_mask=0.01'

V='-ovc lavc -lavcopts vcodec=mpeg4'

SUB=''
#SUB=" -slang it -vobsubout $B -vobsuboutindex 0"

#this is the fallback if not autodetected
# it is also a max to the autodetected one
BITRATE=1100

#megabytes of the CD:  must be on ofe 650 700 or 800
MB=700

#percent used in the CD: to allow some space for subtitles
CDPC=97

#autodetect CROP
CROP=''
#CROP="crop=w:h:x:y"

#autodetect
ASPECT=''
#ASPECT='2.418'


#########################

[ "$B" ] || { echo provide file name, without .avi extension ; exit ; }

[ "$TIMING_DVD_EXTRACT" ] ||  { [ -x /usr/bin/time ] && \
 { TIMING_DVD_EXTRACT=yes /usr/bin/time  $0 "$@" ;  exit ; } ; }

B="$1"
shift



mkdir ${B}_tmp  || { echo -e \\a ============ REUSING DIR ; sleep 3 ; }
cd ${B}_tmp


if [ "$CROP" == "" -o "$ASPECT" = "" ] && [ ! -r cropping.log ] ; then
 echo ============= CHECKIN CROPPING AND/OR ASPECT
   mplayer -quiet -ss 800 -frames 800 -vo null -ao null \
          -vop cropdetect  $DVD  > cropping.log
fi

if [ "$CROP" == ""  ] ; then
 CROP=$( sed 's/.*-vop //;s/).*//' cropping.log | grep crop | tail -1 )
 echo ============= CROPPING to $CROP
fi

if [ "$ASPECT" = "" ] ; then
 ASPECT=$(grep 'Movie-Aspect is ' cropping.log | \
                 sed 's/Movie-Aspect is //;s/:.*//'  )
 echo ============ ASPECT $ASPECT
fi


if [ "$ASPECT" -a "$CROP"  ] ; then
  ASPECT=$( echo $CROP | cut -d= -f2 |\
        awk 'BEGIN{FS=":"};{print $1 / 720 / ( $2 / 576 ) * '"$ASPECT"'}' )
 echo ============ ASPECT $ASPECT after crop
fi

M="mencoder $DVD $@"


if [ -r frameno.avi ] ; then
 echo -e \\a ============= REUSING frameno ; sleep 3 
else
 echo ==================== AUDIO PASS
 trap 'rm frameno.avi' 0
 $M $SUB -ovc frameno $A -o frameno.avi | tee audioenc.log || rm frameno.avi
 trap '' 0
fi

b=$( grep 'Recommended video bitrate for '"$MB"'MB CD:' audioenc.log | cut -d: -f2 )
if [ "$b" ] ; then
 b=$( expr $b \* $CDPC / 100 ) 
 if [ $b -gt $BITRATE ] ; then
  echo ==============BITRATE FORCED FROM $b to $BITRATE
  b=$BITRATE
 else
  echo ==============BITRATE $b
 fi
else
 b=$BITRATE
 [ "$b" ] || echo -n 'BITRATE ? ' ; read b
fi

ASP=''
[ "$ASPECT"  ] && ASP='aspect='$ASPECT

if [ -r divx2pass.log ] ; then
 echo =============== REUSING divx2pass.log
else
 echo ==================== VIDEO PASS 1
 trap 'rm divx2pass.log' 0
 $M ${V}:$LAVC:$ASP:vpass=1:vbitrate=$b -vop $CROP:$VOP \
    -oac copy -o $B.avi | tee videoenc1.log || rm divx2pass.log
fi

echo ==================== VIDEO PASS 2
trap '' 0 
$M ${V}:$LAVC:$ASP:vpass=2:vbitrate=$b -vop $CROP:$VOP \
    -oac copy -o $B.avi | tee videoenc2.log

mv -v --backup=numbered  $B* ..



exit
#echo -n 'which bitrate? ' ; read b
########################
#rm  frameno.avi subtitles.idx subtitles.sub divx2pass.log test.avi || true
# -vop cropdetect
#[ -r frameno.avi ] || \
#  $M  -ovc frameno -oac mp3lame -lameopts vbr=3  -o frameno.avi
#$M -oac copy -ovc divx4 -divx4opts pass=1
#$M -oac copy -ovc divx4 -divx4opts pass=2 -vobsubout subtitles -vobsuboutindex 1 -sid 5
#-vobsubout subtitles -vobsuboutindex 0 -sid 2 -o frameno.avi -ovc frameno -oac mp3lame -lameopts vbr=3   -ovc lavc   -lavcopts vcodec=mpeg4:aspect=16.0/9.0


More information about the MPlayer-dev-eng mailing list