[linux-audio-user] Recording internet radio using MPlayer

Kevin Sookocheff kbs464 at mail.usask.ca
Tue Jun 21 15:08:54 EDT 2005


Hi,

        I'm not sure if this is the right forum for this but hopefully some of 
you have done this before.

	I've managed to get everything working as it should when recording internet 
from the command line using mplayer.  But I still have a problem recording 
using cron to record at specific times.

I issue the following statement on command line :

mplayer http://oggtrial.nm.cbc.ca:80/cbcr2-toronto.ogg -ao pcm 
-aofile /home/kbs464/tmp/mystream.wav -vc dummy -vo null;

With the following satisfactory results:

MPlayer 1.0pre6-3.4.3 (C) 2000-2004 MPlayer Team
CPU: Intel Pentium 4/Xeon/Celeron Northwood (Family: 8, Stepping: 3)
Detected cache-line size is 64 bytes
CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection - WARNING - this is not optimal!
To get best performance, recompile MPlayer with 
--disable-runtime-cpudetection.


77 audio & 188 video codecs
Linux RTC init error in ioctl (rtc_irqp_set 1024): Permission denied
Try adding "echo 1024 > /proc/sys/dev/rtc/max-user-freq" to your system 
startup scripts.
Opening joystick device /dev/input/js0
Can't open joystick device /dev/input/js0 : No such file or directory
Can't init input joystick
Setting up LIRC support...
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support.
You will not be able to use your remote control.
Playing http://oggtrial.nm.cbc.ca:80/cbcr2-toronto.ogg.
Resolving oggtrial.nm.cbc.ca for AF_INET6...
Couldn't resolve name for AF_INET6: oggtrial.nm.cbc.ca
Resolving oggtrial.nm.cbc.ca for AF_INET...
Connecting to server oggtrial.nm.cbc.ca[159.33.6.141]:80 ...
Cache size set to 8192 KBytes
Connected to server: oggtrial.nm.cbc.ca
Cache fill: 19.92% (1671168 bytes)    Ogg file format detected.
==========================================================================
Trying to force audio codec driver family libmad...
Opening audio decoder: [libvorbis] Ogg/Vorbis audio decoder
AUDIO: 44100 Hz, 2 ch, 16 bit (0x10), ratio: 4000->176400 (32.0 kbit)
Selected audio codec: [vorbis] afm:libvorbis (OggVorbis Audio Decoder)
==========================================================================
Checking audio filter chain for 44100Hz/2ch/16bit -> 44100Hz/2ch/16bit...
AF_pre: af format: 2 bps, 2 ch, 44100 hz, little endian signed int
AF_pre: 44100Hz 2ch Signed 16-bit (Little-Endian)
[AO PCM] File: /home/kbs464/tmp/mystream.wav (WAVE)
PCM: Samplerate: 44100Hz Channels: Stereo Format Signed 16-bit (Little-Endian)
[AO PCM] Info: fastest dumping is achieved with -vc dummy -vo null
PCM: Info: to write WAVE files use -waveheader (default).
AO: [pcm] 44100Hz 2ch Signed 16-bit (Little-Endian) (2 bps)
Building audio filter chain for 44100Hz/2ch/16bit -> 44100Hz/2ch/16bit...
Video: no video
Starting playback...
Ogg : bad packet in stream 0
A:1049661.2 (91:34:21.2)  0.0% 0%      

and a file /home/kbs464/tmp/mystream.wav gets created.

However, if I run the exact same command as part of the cron scheduler I get 
nothing.  No file gets created by mplayer.

My crontab looks like this:

55 11 * * 1-5 /home/kbs464/scripts/streamrecorder &> /dev/null
30 12 * * 1-5 killall -9 mplayer

And the streamrecorder script like so:

#!/bin/bash

mplayer http://oggtrial.nm.cbc.ca:80/cbcr2-toronto.ogg -ao pcm 
-aofile /home/kbs464/tmp/mystream.wav -vc dummy -vo null;
oggenc /home/kbs464/tmp/mystream.wav -o /home/kbs464/BraveNewWaves_`date 
+%b_%d_%y`.ogg;
rm -f /home/kbs464/tmp/mystream.wav;


If, in crontab, I change the redirect of the streamrecorder script to a text 
file I get the following back:

(contents of error file)

MPlayer 1.0pre6-3.4.3 (C) 2000-2004 MPlayer Team
CPU: Intel Pentium 4/Xeon/Celeron Northwood (Family: 8, Stepping: 3)
Detected cache-line size is 64 bytes
CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection - WARNING - this is not optimal!
To get best performance, recompile MPlayer with 
--disable-runtime-cpudetection.


77 audio & 188 video codecs
Linux RTC init error in ioctl (rtc_irqp_set 1024): Permission denied
Try adding "echo 1024 > /proc/sys/dev/rtc/max-user-freq" to your system 
startup scripts.
Can't init input joystick
Opening joystick device /dev/input/js0
Can't open joystick device /dev/input/js0 : No such file or directory
Setting up LIRC support...
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support.
You will not be able to use your remote control.
Playing http://oggtrial.nm.cbc.ca:80/cbcr2-toronto.ogg.
Resolving oggtrial.nm.cbc.ca for AF_INET6...
Couldn't resolve name for AF_INET6: oggtrial.nm.cbc.ca
Resolving oggtrial.nm.cbc.ca for AF_INET...
Connecting to server oggtrial.nm.cbc.ca[159.33.6.141]:80 ...
Cache size set to 8192 KBytes
Connected to server: oggtrial.nm.cbc.ca
Cache fill:  0.00% (0 bytes)
Cache fill:  0.00% (0 bytes)
Cache fill:  0.00% (0 bytes)
Cache fill:  0.00% (0 bytes)
Cache fill:  0.00% (0 bytes)
Cache fill:  0.00% (0 bytes)

And so on... the cache fill never moves from 0 even though the exact command 
that I ran on the command line is running via cron.

Anyone have any suggestions on how to get this working?

Thank you very much for your time,
Kevin



More information about the linux-audio-user mailing list