Main Page | Report Page

 

  Linux Forum Index » Linux - Slackware Forum » PVR project (cont.)...

Author Message
Mike Jones...
Posted: Sun Oct 17, 2010 5:56 am
 
Finally got things to a (sane?) working BETA stage.

Using a Freeview box jacked into old TV card's S-Video input...

pvr.sh requires a time-to-run in minutes, and a recording tag-name.

eg:> pvr.sh 30 Progname

So...

at 18:30 today
Quote:
pvr.sh 30 prog1


....gets a recording of 30 mins, called "prog1"

Like this-> ~/PVRGRAB/PVR.101017:1830.prog.avi

pvr.sh also issues a silent killall to mplay.sh to free up required
resources and avoid mencoder just failing in the background.

NOTE: I'm using "capture CD" as my hardware needs this setup.

# =============================================== pvr.sh

#!/bin/sh

SAVEDIR=$HOME/PVRGRAB
TITLE=PVR
TYPE="avi"
TIMESTAMP="$(date +%y%m%d:%H%M)"
TIMEOUT="$(($1*60))"
PROGNAME="$2"

case $1 in
*[^0-9]*)
echo "Oops! Input numbers (minutes) only!";
echo ""
exit 0
;;
esac

if [ ! -h $SAVEDIR ]
then
if [ ! -d $SAVEDIR ]
then
mkdir $SAVEDIR || exit 0
fi
fi

function BAIL()
{
killall -9 mencoder;
exit 0
}

function RECORD()
{
SAVEFILE="$TITLE.$TIMESTAMP.$PROGNAME.$TYPE"
killall -g mplaytv.sh > /dev/null 2>&1; # Clear any competition
killall -g mplaytv > /dev/null 2>&1; # And it's symlink
amixer set CD cap 1> /dev/null; # Set to capture CD input
amixer set CD mute 1> /dev/null; # Set CD int-cable output MUTE ON
mencoder -profile freeview -endpos $TIMEOUT \
tv:// -o $SAVEDIR/$SAVEFILE \
|| BAIL;
echo ""
echo " $SAVEDIR/$SAVEFILE saved."
echo ""
}

RECORD;

exit 0

# =============================================== pvr.sh


mplaytv.sh checks mencoder isn't running before starting, to avoid
grabbing the audio device and spoiling a recording-in-progress.

# =============================================== mplaytv.sh

#!/bin/sh

if [ -n "$(pgrep mencoder)" ]
then
echo ""
echo "* Mencoder is active."
echo ""
echo "* Bailing"
echo ""
exit 0
else
mplayer -profile freeview tv://
fi

exit 0

# =============================================== mplaytv.sh


FWIW:
# =============================================== mencoder.conf

[freeview]
profile-desc="Profile = record *.avi from Freeview box (S-Video)"
cache=1024
oac=copy=yes
audio-delay=0.2
ovc=lavc=yes
lavcopts=vcodec=mjpeg:vbitrate=19600:keyint=125:autoaspect=1:acodec=ac3:abitrate=192
tv=driver=v4l2:input=3:fps=25:width=720:height=576:contrast=-3:saturation=-5:device=/dev/video0:audiorate=48000
vf=pp=fd,unsharp=l:5x5:1
aspect=4:3

# =============================================== mencoder.conf



So far so good. Sanity check anyone?


(Above = GPLv3 http://www.gnu.org/licenses/quick-guide-gplv3.html)


XP = alt.os.linux,alt.os.linux,slackware

--
*=( http://www.thedailymash.co.uk/
*=( For all your UK news needs.
 
 
Page 1 of 1    
All times are GMT - 5 Hours
The time now is Tue Jul 29, 2014 8:00 pm