[MPlayer-users] Re: [-] Re: [-] TV-recording with mencoder, "video-buffer full"

Rainer Hantsch office at hantsch.co.at
Mon Mar 7 16:54:59 CET 2005


On Thu, 3 Mar 2005, Matthias Wieser wrote:

| Hi,
| Am Donnerstag, 3. März 2005 09:16 schrieb Rainer Hantsch:
|
| > The script is actually started from 'at' with all of its options.
| > Another script (not attached) allows "programing" my "video-recorder".
| > It asks for the station name, date, start/endtime, checks validy, and
| > finally makes an at-job. If someone is interested, I can supply it,
| > too.
|
| That would be nice.

Ok, I attached it. Have a lot of fun.


| > Please, if someone can give me some infos what I should change, do so.
| > I have an Athlon 2000XP as recorder. This CPU is loaded ~60% so I can
| > record with below settings without loosing one frame.
|
| You could even record without framedrops if the CPU load temporarily hits
| 100%. In this case mencoder only captures into a buffer and encodes when
| the CPU load goes below 100%. You only have to take care that this buffer
| does not get to large.

I prefer to be on the safe side (to be able to download a ready recorded file
while recording a new one...).


| > What I could not get fixed is:
| > .) maybe a better image quality (getting away this noise).
|
| Let's see...
|
|
| > # Bildformat auswählen / berechnen von Clipping
| > # PAL     = 720 breit  Es geht aber nur max. 688 px (muß durch 16
| > teilbar sein)
| > palw=688
| > palh=`expr $palw "*" 3 "/" 4`
| > width=$palw
| > height=`expr $palh - 8`
| > [...]
| > # Aufnehmen...
| > mencoder -tv on:input=$vinput:driver=v4l:device=/dev/video0:\
| > width=$palw:height=$palh:fps=25:forceaudio=1:audiorate=48000:\
|
| You are capturing at 688x516. Pal is 720x576 (or 768x576 with square
| pixels).
| When you capture at 516 lines, deinterlacing will not work properly
| anymore.

I tried 720x576, but this caused too high load and frame drops at recording.
So I reduced a little bit and this works.


| > amode=0:forcechan=1:adevice=/dev/dsp \
| > -oac mp3lame -lameopts cbr:br=128 \
|
| abr should be better than cbr.

No. Causes problems with cutting with avidemux.


| > -ovc lavc -lavcopts vcodec=mpeg4:vqscale=3:vbitrate=1400:keyint=25 \
|
| vbitrate <=> vqscale

Don't understand what you mean.


| > -vop crop=$width:$height,denoise3d=8:6:6,pp=md \
|
| pp=md produces ugly looking 1x2 pixel blocks.

Does it cause higher CPU load?



| That's what I am using:
| --------------
| mencoder tv:// -tv
| driver=v4l2:width=720:height=576:brightness=0:contrast=0:saturation=5:volume=35\
| -ovc lavc -lavcopts
| vcodec=mpeg4:vbitrate=2200:vratetol=32000:mbd=2:psnr:aspect=4/3 \
| -oac mp3lame -lameopts abr:br=128 \
| -vf crop=672:528:24:24,pp=fd,scale=576:432,denoise3d=7:5:9 \
| -sws 6 -o Video-`date +%d.%m.-%H%MUhr`.avi -endpos $1
| --------------


It would be very helpful to have a really usable documentation of all options
available. This man page is an extreme intermix of mplayer and mencoder and
mostly a list of commands, but with missing detail information about every
particular option, what it does, what is recommended,...

But I will try your settings.

mfg

  Ing. Rainer Hantsch
-------------- next part --------------
#!/bin/sh

DL="==============================================================================="
SL="-------------------------------------------------------------------------------"


cd ~

function Header ()
{  clear
   echo "$DL"
   echo "  VIDEO-RECORDER - Programmierung                   `date +"%H:%M:%S  %a, %d.%m.%Y"`"
   echo "$DL"
   echo
}


function Info ()
{
cat - << EOF
  Dieser Script dient dazu, eine Videoaufnahme kontrolliert zu erfassen und 
  daraus einen passenden AT-Job zu machen. Dazu werden folgende Angaben be-
  nötigt:  SENDER, STARTZEITPUNKT, AUFNAHMEDAUER, FILMNAME.
  Die Schreibweise von Sender wird geprüft.

EOF
echo "$SL"
echo
}

# Umrechnen hh:mm:ss -> ss 
function Sekunden ()
{
zeit="$1:"
hh=`echo $zeit | cut -d: -f1` 
mm=`echo $zeit | cut -d: -f2` 
ss=`echo $zeit | cut -d: -f3` 

while [ "$ss" == "" ] ; do
  ss=$mm
  mm=$hh
  hh="00"
done

sekunden=`expr $hh "*" 3600`
dummy=`expr $mm "*" 60`
sekunden=`expr $sekunden + $dummy`
sekunden=`expr $sekunden + $ss`
}


function HMS ()
{  ss=$1
   hh=`expr $ss / 3600`
   dummy=`expr $hh "*" 3600`
   ss=`expr $ss - $dummy`

   mm=`expr $ss / 60`
   dummy=`expr $mm "*" 60`
   ss=`expr $ss - $dummy`
   
   hms="$hh:$mm:$ss"
}


function CheckDate ()
{
startdatum="$startdatum...."
TAG=`echo $startdatum | cut -d"." -f1`
MON=`echo $startdatum | cut -d"." -f2`
JAH=`echo $startdatum | cut -d"." -f3`

[ "$TAG" == "" ] && TAG=`date +%d`
[ "$MON" == "" ] && MON=`date +%m`
[ "$JAH" == "" ] && JAH=`date +%Y`

startdatum="$TAG.$MON.$JAH"
unset TAG MON JAH
}




# Initialisierung der Werte
# Es muß eine Zeit eingegeben werden, die konform zum 'at' Kommando ist
startzeit=""
startdatum=""
dauer=""


# Auswählen des Senders. 
# Es wird geprüft, ob der Sender in dieser Schreibweise auch in der .xawtv
# abgelegt ist, andernfalls wird nochmals gefragt.

echo -n "SLISTE=\"" > ~/.senderliste
grep "^\[" ~/.xawtv | \
while read SLISTE ; do
  [ "$SLISTE" != "[global]" -a "$SLISTE" != "[defaults]" ] && \
  echo -n "$SLISTE " | sed -e s/"\["// -e s/"\]"// >> ~/.senderliste
done
echo -n "\"" >> ~/.senderliste

. ~/.senderliste

sender=""
while [ "$sender" == "" ] ; do
  Header
  Info

  echo -e "Senderliste: \n$SLISTE\n"

  echo -n "Name des Senders : "
  read sender

  if [ "`grep "\[$sender\]" ~/.xawtv`" == "" ] ; then
    sender=""
    echo "Dieser Sender ist nicht definiert. Schreibweise falsch?"
    sleep 2
  fi
done



# Name des Films...
  Header
  Info
  echo -n "Name des Films   : "
  read name
  name=`echo $name | sed s/" "/_/g`



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

Header
Info

echo -n -e "                                               (Wird autom. komplettiert\r"
echo -n -e "Datum der Aufnahme [tt.mm.jjjj] : `date +%d.%m.%Y`\010\010\010\010\010\010\010\010\010\010"
read startdatum
CheckDate $startdatum

echo
echo -e -n "Startzeit [hh:mm] : hh:mm\010\010\010\010\010"
read startzeit

echo
echo
echo "Es werden automatisch 10 Sekunden abgezogen (Spielraum für AT Kommando)"
echo -e -n "Aufnahme Endzeit [ hh:mm ] : hh:mm\010\010\010\010\010"
read endzeit



# Startzeit in Sekunden umrechen
Sekunden $startzeit:00
startzeitsek=$sekunden
Sekunden $endzeit:00
dauer=`expr $sekunden - $startzeitsek`
dauer=`expr $dauer - 10`   # 10 Sekunden Spielraum für at()
HMS $dauer

dummy=""
while [ "$dummy" != "j" -a "$dummy" != "n" ] ; do
Header

start="$startzeit $startdatum"

cat - << EOF
Kontrolle:
==========

  Gewünschter Sender ..... : $sender

  Name des Films ......... : $name

  Aufnahmebeginn ......... : $start
  Aufnahmeende ........... : $endzeit

  Aufnahmedauer .......... : $hms  ($dauer Sekunden)

EOF

  echo -e -n "Diese Aufnahme speichern? [J/n] : j\010"
  read dummy 
  if [ "$dummy" == "" ] ; then 
    dummy="j"
  fi
done


if [ "$dummy" == "j" ] ; then
  echo
  echo
  echo "~/.vr $sender $dauer \"$name\"" | at "$start"

fi



#-eof-


More information about the MPlayer-users mailing list