[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Spam?] Re: Anyone know how to do a "timed program" with mplayer



> and I've successfully recorded (using scripts and at) fixed-duration
> RealPlayer radio shows to .wav to listen to them later.  But I'd
> like to record a specific show tonight from the continuous live ogg
> stream.

In case anyone else cares, here's what I developed.  

$ at 16:00
> record-wuvt 15 15

for example, should produce files wuvt--20051115-1600.mp3 and
wuvt--20051115-1615.mp3, both just under 15 minutes long
(unfortunately you lose a few seconds between segments).

HTH someone,
Adam


#!/bin/sh
# Arguments: numbers of minutes to record

URL='http://engine.collegemedia.vt.edu:8000/wuvt.ogg'
BASENAME='wuvt-'

for MINUTES in $@
do
  FILENAME="${BASENAME}-`date +%Y%m%d-%H%M`"
  
  date
  echo "Start recording  ${FILENAME}  for ${MINUTES} minutes"
  
  mplayer -really-quiet -ao  pcm:file=${FILENAME}.wav  ${URL}  &
  PID=$!
  
  sleep "${MINUTES}m"
  echo "Ding!"
  date

  killall mplayer
  wait ${PID}

  # normalize and encode in the background
  nice -18 normalize-audio -q -a -19dB ${FILENAME}.wav && \
      nice -18 lame --quiet  ${FILENAME}.wav  ${FILENAME}.mp3  &&\
      rm -v ${FILENAME}.wav &

done

wait
ls -l *.mp3
date



Reply to: