Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[vdr] Re: mplayer and mpeg4 ?!
Am Freitag, 30. August 2002 18:28 schrieben Sie:
> Otto Brandstätter wrote:
> > Good afternoon list !
> >
> > I have the following problem:
> > when using mplayer with vdr everything is fine, except when I try to play
> > mpeg4 files I created from vdr-files using mencoder.
> > I hear the sound, but my tv screen stays black.
> > It _seems_ as I could also seek within the files, but there is no
> > picture. I do not get error messages in console nor in /var/log/messages
> > I am using mplayer 0.90pre6-2.96, but I also tried the cvs version.
> > Also installed divx4linux501.
> >
> > Did anyone have similar problems ? Any hints ?
> >
> > Thanks a lot !
> >
> > Otto
>
> What does your mplayer.sh look like ?
My mplayer.sh is: (this is a script i found somewhere in the internet...)
i suppose, this is not the problem...
thanks for your help !
Otto
#!/bin/bash
declare VERSION="0.0.4"
# History (as always in the source code :-)
#
# 0.0.3 Seems to work fine - still lacks support for X x 432 Files
# What about MPEG Files ?
# 0.0.4 Improved getvidxy - No Temp Files needed anymore !
#
#
#
function readcfg () {
# Aufruf:
# readcfg CFGPARM
# Searches the config file for CFGPARM and the output is the configured value
!
# If not found the output is empty (test -z to determine)
if test -z $1; then echolog "*** Internal Error - Called readcfg without
Option Name"; return; fi
declare -a y[0] # Anzahl der Zeilen (idealerweise = 1 !!!)
declare -i anzahl=`grep -v -e "#" $CFGFIL | grep -i -e $1 | wc -l`
if test "$anzahl" -eq 1;
then y=(`grep -v -e "#" $CFGFIL | grep -i -e $1`)
anzahl=${#y[*]} # Diesmal ANZAHL der Parameter pro Zeile !
declare -i x=0
while x=$x+1; test $x -lt $anzahl;
do if ! test $x -eq $(($anzahl-1)) # Noch nicht letzter Wert der Zeile ?
then echo -n ${y[$x]}" "; # Diese Ausgabe wird weitergegeben !
else echo ${y[$x]}; # Letztes Argument !
fi
done;
else logger "readcfg.sh error: Option $1 found $anzahl times in $CFGFIL";
fi
return;
}
function getvidxy () {
# Aufruf: getvidxy
# Ermittelt x und y Ausloesung des FILEs !
# Ausgabe: in Variable ORIG_X und ORIG_Y (global)
# Variablen Definitionen
local TEMP1 TEMP3
local -a TEMP2[0] XY[0]
local -i ANZAHL i
ORIG_X=0; ORIG_Y=0
TEMP1=`$MPLAYER "$FILE" -frames 0 2>&1 | grep -i -e "VIDEO:"`
TEMP2=($TEMP1)
debugmsg "OutputFromMPLAYER:" "$TEMP1"
debugmsg "ParsedOutput:" "${TEMP2[*]}"
ANZAHL=${#TEMP2[*]}
if test $ANZAHL -le 4; then debugmsg "NumberOfValues:" $ANZAHL; echolog "***
FATAL: Could not determine Source Video Resolution ..."; exit; fi
TEMP3=${TEMP2[2]}
debugvar "TEMP3(...x...)" $TEMP3
IFS="x"
XY=($TEMP3)
unset IFS
ANZAHL=${#XY[*]}
if ! test $ANZAHL -eq 2; then echolog "*** ERROR: Could not determine
Resolution..."; debugmsg "XY splitted into" "$ANZAHL" exit; fi
ORIG_X=${XY[0]}
ORIG_Y=${XY[1]}
return;
}
function calcnewxy () {
local -i TEMP1 MAX_X FACT ANZAHL
# 768
MAX_X=$((4*576/3)) ; debugvar MAX_X $MAX_X
NEW_Y=$(($MAX_X*ORIG_Y/$ORIG_X)); debugvar NEW_Y $NEW_Y
# NEW_X=$ORIG_X # Hardware Skaling
if test $NEW_Y -gt 576;
then NEW_Y=576 # Force FullScreen / Verzichtet auf Aspect Ratio !
# NEW_X=$(($NEW_Y*$ORIG_X/$ORIG_Y));
fi
echolog "*** INFO: For Sqare Pixels we would scale to $MAX_X x $NEW_Y ..."
#NEW_X=MAX_X; debugvar NEW_X $NEW_X
return;
}
function choosebestx () {
local -i MAX_X INDEX
ANZAHL=${DVBsXRes#}
debugvar AnzahlVonDVBsXRes $ANZAHL
INDEX=-1
declare repeat=true
until ! $repeat;
do INDEX=$(($INDEX+1))
if test ${DVBsXRes[$INDEX]} -ge $ORIG_X; then repeat=false;
NEW_X=${DVBsXRes[$INDEX]}; fi
if test $INDEX -ge $ANZAHL; then repeat=false; NEW_X=${DVBsXRES[$ANZAHL]};
fi
done
debugvar NEW_X $NEW_X
return;
}
# UNUSED
function aspectratio () {
# Direkt aus 2divx uebernommen - noch anpassen :-)
# Aufruf: aspectratio /video0/..../001.vdr
# Ausgabe: in Variable $ASPECT (global)
# Variablen Definitionen
local TEMP1
local -a TEMP2[0]
local -i ANZAHL i
ASPECT=2 # Default Value (4:3) falls nicht bestimmt werden kann !
$ENCEXE "$1" -frames 0 -o temp_weg.avi 2>$WRKTMP/temp_weg.txt
>$WRKTMP/temp_weg2.txt
TEMP1=`cat $WRKTMP/temp_weg.txt $WRKTMP/temp_weg2.txt | grep -i -e "aspect"`
# Old: # TEMP1=`$ENCEXE $1 -frames 0 -o temp_weg.avi | grep -i -e "aspect"`
TEMP2=($TEMP1)
ANZAHL=${#TEMP2[*]}
i=-1
while i=i+1 ; test $i -le $((ANZAHL-1)); do
# Achtung geht davon aus, dass die Ausgabe von Mencoder lautet .. ( aspect x )
..
if test ${TEMP2[$i]#(} == "aspect" ; then ASPECT=${TEMP2[$((i+1))]%)}; fi
done
# ggf erzeugtes temp_weg.avi wieder entfernen !!!
if test -f $WRKTMP/temp_weg.txt; then rm $WRKTMP/temp_weg.txt; fi
if test -f $WRKTMP/temp_weg2.txt; then rm $WRKTMP/temp_weg2.txt; fi
if test -f $WRKTMP/temp_weg.avi; then rm $WRKTMP/temp_weg.avi; fi
return;
}
# UNUSED
function checkforac3 () {
# Direkt aus 2divx uebernommen - noch anpassen :-)
# Aufruf: checkforac3 /video0/.../001.vdr
# Ergebnis in $SRCAC3 (true/false)
local -i TEMP2
$ENCEXE "$1" -frames 0 -o temp_weg.avi -aid 128 2>$WRKTMP/temp_weg.txt
>$WRKTMP/temp_weg2.txt
TEMP2=`cat $WRKTMP/temp_weg.txt $WRKTMP/temp_weg2.txt | grep -i -e "ac3:" | wc
-l`
# Temp File löschen
if test -f $WRKTMP/temp_weg.txt; then rm $WRKTMP/temp_weg.txt; fi
if test -f $WRKTMP/temp_weg2.txt; then rm $WRKTMP/temp_weg2.txt; fi
if test -f $WRKTMP/temp_weg.avi; then rm $WRKTMP/temp_weg.avi; fi
if test $TEMP2 -gt 0; then SRCAC3=true; else SRCAC3=false; fi
return;
}
function echolog () {
# prints the String on stdout and into /var/log/messages using logger !
echo "$1"
logger "$1"
return;
}
function errorcfg () {
echolog "*** FATAL: Config Option $1 not found in Config File ... Exiting."
exit
return;
}
function debugvar () {
if $DEBUG; then echolog "*** DEBUG: Variable $1 has value \"$2\""; fi
return;
}
function debugmsg () {
if $DEBUG; then echolog "*** DEBUG: $1 \"$2\""; fi
return;
}
# Begin Main !
#
#
# ---------------------------------------------------------------------------
#
#
declare -i ORIG_X ORIG_Y
declare -i NEW_X NEW_Y
declare CMDLINE
declare FILE=$1
echolog "*** Starting mplayer.sh Version $VERSION"
if test -z "$FILE"; then echolog "*** USAGE: mplayer.sh <File_to_be_played>";
exit; fi
if ! test -f "$FILE"; then echolog "*** ERROR: Make sure $FILE exists -
otherwise it cannot be played ;-)"; exit; fi
# Check if Config File exists !
#declare CFGFIL="./mplayer.sh.conf"
declare CFGFIL="${0%mplayer.sh}mplayer.sh.conf"
debugvar CFGFIL $CFGFIL
if ! test -f $CFGFIL; then echolog "*** FATAL: mplayer.sh.conf not found !!!
Exiting." ; exit; fi
# Debug Mode ?
declare DEBUG=`readcfg debug`
if test -z "$DEBUG"; then DEBUG=false; fi
# read MPLAYER Config
declare MPLAYER=`readcfg mplayer`
if test -z "$MPLAYER"; then errorcfg MPLAYER; exit; else debugvar MPLAYER
"$MPLAYER"; fi
declare VOP=`readcfg vop`
if test -z "$VOP"; then errorcfg VOP; exit; else debugvar VOP "$VOP"; fi
declare CACHESTR=" " # kein cache
declare CACHE=`readcfg cache`
if ! test -z $CACHE; then CACHESTR="-cache $CACHE"; debugvar CACHE "$CACHE";
debugvar CACHESTR "$CACHESTR";
else echolog "*** Option CACHE not set in Config File - calling mplayer
without Cache !";
fi
declare FRAMEDROP=`readcfg framedrop`
if test -z "$FRAMEDROP"; then FRAMEDROP=false; fi
debugvar FRAMEDROP "$FRAMEDROP"
declare FDSTR=" "
if $FRAMEDROP; then FDSTR="-framedrop"; fi
debugvar FDSTR "$FDSTR"
declare LIRCSTR=" " # kein Extra Lirc Option !
declare LIRCRC=`readcfg lircrc`
if ! test -z "$LIRCRC"; then LIRCSTR="-lircconf $LIRCRC"; fi
debugvar LIRCRC "$LIRCRC"; debugvar LIRCSTR "$LIRCSTR"
declare -a USERDEF[0]
declare USERDEF=(`readcfg userdef`)
if ! test -z "$USERDEF"; then echolog "*** Use Option USERDEF at your own risk
!"; fi
debugvar USERDEF "${USERDEF[*]}"
declare -a DVBsXRes[0]
declare DVBsXRes=(`readcfg DVBsXRes`)
if test -z $DVBsXRes; then errorcfg DVBsXRes; exit; else debugvar DVBsXRes
"$DVBsXRes"; fi
# Try to determine the video attributes
if $DEBUG; then echolog "*** DEBUG: Calling getvidxy function to analyze
source video stream ..."; fi
getvidxy
echolog "*** INFO: Source Video has Resolution of $ORIG_X x $ORIG_Y ..."
if test $ORIG_X -eq 0 || test $ORIG_Y -eq 0; then echolog "*** FATAL: Illegal
Resolution ..."; exit; fi
if test $ORIG_Y -eq 576;
then echolog "*** FIXME: Add check in DVBsXRes - if not contained, apply
skaling" #FIXME
CMDLINE="$MPLAYER -vo mpegpes -ao mpegpes -afm 9 -vop $VOP $FDSTR
$CACHESTR $LIRCSTR $USERDEF"
debugvar CMDLINE "$CMDLINE"
exec $CMDLINE "$FILE" -
echo "*** Done.";
else
calcnewxy
choosebestx
echolog "*** Scaling to $NEW_X x $NEW_Y for DVBs Output..."
CMDLINE="$MPLAYER -vo mpegpes -ao mpegpes -afm 9 -vop
$VOP,expand=$NEW_X:576,scale=$NEW_X:$NEW_Y $FDSTR $CACHESTR $LIRCSTR
$USERDEF"
# CMDLINE="$MPLAYER -vo mpegpes -ao mpegpes -afm 9 -vop
$VOP,scale=$NEW_X:$NEW_Y,expand=$NEW_X:576 $FDSTR $CACHESTR $LIRCSTR
$USERDEF"
debugvar CMDLINE "$CMDLINE"
exec $CMDLINE "$FILE" -
echo "*** Done.";
fi
exit
# Simple way :-)
# exec /usr/local/bin/mplayer -vo mpegpes -ao mpegpes $1 -framedrop -lircconf
/video0/.lircrc < /dev/zero
# ??? declare MPLAYER="exec /usr/local/bin/mplayer"
declare OPTS="-vo mpegpes -ao mpegpes -vop lavc,scale=704:576 -afm 9 -cache
4096 -framedrop -lircconf /opt/.lircrc"
declare OPTS="-vo mpegpes -ao mpegpes -vop lavc -afm 9 -cache 4096 -framedrop
-lircconf /video/.lircrc"
declare FILE=$1
declare type=`file "$FILE"`
case "$type" in
*AVI*)
#orig declare VC="-vc odivx"
declare VC="-vc ffodivx"
;;
*MPEG*)
declare VC="-vc mpegpes"
;;
*)
declare VC="-vc mpegpes"
echo "Assuming MPEGPES Format !!!!"
echo "Edit /usr/sbin/mplayer.sh to support this format !"
;;
esac
echo Executing "$MPLAYER $OPTS $VC "$FILE" -"
# orig $MPLAYER $OPTS $VC "$FILE" -
$MPLAYER $OPTS "$FILE" -
#$MPLAYER $OPTS "$FILE" -
Home |
Main Index |
Thread Index