I learnt some BASH stuff and updated my record script so it no longer 
needs a VCR_POST_REC command to kill mencoder; it can now receive and 
act on the SIGTERM freevo sends. That could be a new FAQ item "How can I 
specify my own recording script?".

I'll update the wiki sometime (which btw can be very slow and buggy with 
random 500 errors thrown up).

I also wrote a quick build_index_avi that I run from VCR_POST_REC to 
build the avi index after recording so I don't have to during runtime. I 
could add that to the wiki sometime too if it's useful.

Amadeus (who promised to stop this week but didn't)

#!/bin/bash

# commands to run when finishing recording
clean_up () {
    echo "Cleaning up..."
    kill -INT $MPID # kill mencoder neatly
    v4lctl volume mute on            # silence tv
    amixer -q cset numid=22 on        # unsilence aux
    exit 0                    # exit nicely
}

trap clean_up TERM INT # trap TERM (15) and INT (ctrl-c) so we stop 
recording when freevo tells us or when user wants to

# start the script
channel=$1; output=$2; seconds=$3

if [ -z $seconds ]; then
    echo "Usage:    ${0##*/} channel filename length(seconds)"
    exit 1
fi

# some settings:
mencoder='/usr/bin/mencoder'
width=768
height=576
adevice=hw.0,0:alsa

# 2 bodges for converting tvtime channel names into mplayer channel names
# U29 -> 29
channel=${channel#U}

# S1-S20 -> SE1-SE20
if [[ ${channel#S} != $channel && ${channel#S} -lt 21 ]]; then
    channel="SE${channel#S}"
fi

# mencoder options
options="tv:// -tv 
driver=v4l2:brightness=53:contrast=26:saturation=50:hue=50:adevice=$adevice:forceaudio:audiorate=32000:amode=1:norm=PAL-BG:input=0:chanlist=europe-west:channel=$channel:width=$width:height=$height:outfmt=yuy2:device=/dev/video0:buffersize=64
 
-ovc lavc -lavcopts vcodec=mpeg4:vbitrate=4000:keyint=30 -oac mp3lame 
-lameopts br=128:cbr:mode=3 -endpos $seconds -ffourcc divx -o $output"

# start the recording process:
# mute aux
amixer -q cset numid=22 off
# set aux vol
amixer -q cset numid=23 90%
# set capture aux
amixer -q cset numid=26 3
# set capture on
amixer -q cset numid=27 on
# set capture volume
amixer -q cset numid=28 90%
# video mute off
v4lctl volume mute off

$mencoder $options &

MPID=$?        # get mencoder PID

# wait for the length of recording before stopping

while [ -z $flag ]; do
    sleep $((seconds+2))    # take into account 2 seconds overhead
    flag=1
done

clean_up

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Freevo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-users

Reply via email to