strec

A Stream Recorder.

Download

latest: strec.pl
2008-09-18: v2.0 - strec-2.0.pl
- use vsound instead of dsproxy
2005-05-27: v1.2 - strec-1.2.pl
- maintain a log file with all recordings
- extended debugging info
2005-05-02: v1.1 - strec-1.1.pl
- add id3v1 tag after recoding is finished
- improved handling of multi-part recordings
2005-05-01: v1.0 - strec-1.0.pl
- Initial release

Helper to re-tag existing audio file: strectag.pl

Installation

Just copy the file into a binary directory included in your PATH and make sure all it's executable flags are set:
 chmod a+x strec.pl
 mv strec.pl /usr/local/bin/

Documentation

A perl wrapper for vsound, realplayer and lame.
What you'll need:
VSound:     http://www.vsound.org/ (get version 0.6, apply patch from http://scara.com/strec/vsound-0.6.1.patch.tgz )
RealPlayer: http://www.real.com/  (set sound device to OSS, not ALSA)
 (old ver.: http://forms.real.com/real/player/blackjack.html)
Lame:       http://lame.sourceforge.net/
gnu wget:   http://wget.sunsite.dk/
LibID3v2    http://id3lib.sourceforge.net/
id3v2       http://id3v2.sourceforge.net/
openRTSP    http://www.live555.com/liveMedia/
  (unpack 'live' directory in /usr/src/ and follow build instructions)

How to do it:
- Make sure all the software above is installed
- Start with "strec.pl <file or URL> [<perfect>]"
  - URL can be any http:, rtsp: or pnm: link
    - the recording file name will be that of the .rm file, 
      e.g. rtsp://server.com/dir/file.rm --> file.mp3
  - file can be:
    - filename.url: One line with a URL as above
    - filename.strec: First line with the URL, second line with Title, Artist, Album and Year, separated by TABs.
    - Otherwise, a line with 'rtsp:' from the file will be used as the URL
    - The recording filename will be that of the file, 
      e.g. /tmp/file.ram --> /tmp/file.mp3 (or $target/file.mp3, if $target is set in the script)
- If you specify a non-zero value for <perfect>, the recoding will be
  stopped if a DSP_RESET is encountered.
- Now the realplayer should start and you should see some messages like these:
  00:00:00.00 SNDCTL_DSP_RESET
  00:00:00.00 SNDCTL_DSP_SPEED    => 44100
  00:00:00.00 SNDCTL_DSP_CHANNELS => 2
  Assuming raw pcm input file : Forcing byte-swapping
  LAME version 3.93  (http://www.mp3dev.org/)
  Using polyphase lowpass  filter, transition band: 15115 Hz - 15648 Hz
  Encoding <stdin> to audiofile.mp3
  Encoding as 44.1 kHz 128 kbps j-stereo MPEG-1 Layer III (11x) qval=2
  00:00:00.00 SNDCTL_DSP_SETFMT   => AFMT_S16_LE AFMT_S16_NE
  00:00:00.00 SNDCTL_DSP_RESET
  00:00:00.00 SNDCTL_DSP_SETFRAGMENT => 0001000d
  00:00:00.00 SNDCTL_DSP_SETFMT   => AFMT_S16_LE AFMT_S16_NE
  00:00:00.00 SNDCTL_DSP_CHANNELS => 2
  00:00:00.00 SNDCTL_DSP_SPEED    => 44100
  00:00:00.00 SNDCTL_DSP_RESET
  
  waiting 5
- The "waiting" value will count up until the pre-buffering is finished, 
  after that is continues like this:
  00:00:00.00 SOUND_MIXER_WRITE_VOLUME => 75 - 75
  00:00:00.00 SOUND_MIXER_WRITE_BASS   => 75 - 75
  00:00:00.00 SOUND_MIXER_WRITE_TREBLE => 75 - 75
  00:00:00.00 SOUND_MIXER_WRITE_PCM    => 75 - 75
  00:00:00.00 SOUND_MIXER_WRITE_PCM    => 75 - 75
  00:05:23.42 
- The time value at the bottom will keep on going during the recording.
- After the file has finished playing, you should see two more
  DSP_RESET messages and success message like:
    "FINISHED: clip is completed at 00:00:10.52"
  The printed time is the recorded length of the .mp3 file. 
- If there were any other DSP_RESET messages during the file recording, 
  the connection got bad and you might have to start over again.
  If that happens, a warning is also displayed: 
    "ALERT! stream interruption at 00:00:05.70"

Visits:
(by digits.com)


2005-05-01 Christian Wolff You can reach me at sub-feedback at this domain.
other projects