Talkback for article: 178, March2001

Real-time MP3 recording

Back to:

From: Mike <mikep(at)> [ date: 2001-03-17 ]

i don't think 192kbps is a strange value. mp3 audio with 128kbps is horrible.
If you think 128kbps is near CD-quality, you should consider a trip to your local
ear doc :)

just my 0.02$
From: Don <dsaltarelliatnetscapedotnet> [ date: 2001-03-18 ]
a better idea may be to change the suse script that does the
cleanup procedure so that it 'renice'es itself to 19. this means
it will only use cpu when nothing else wants it. so in the script,
put (the $$ indicates the current process. all children with also be
niced to 19):

renice 19 $$

my $0.02
From: Jens M Andreasen <ja(at)> [ date: 2001-03-18 ]

Renicing the cron script will still leave you with the latency
inroduced from cron accessing disks (upto 300ms). This happens
in kernel space.

my SEK 0,50

From: Philip de Groot <philipg(at)> [ date: 2001-03-18 ]

I want to comment on the 192 kbps issue. First of all, my ears are quite O.K.. Second, most mp3-files ARE in 128 kbps! Apparently, most users think that this is convenient and everyone has to sort this out by themselve. I don't have a problem with a poorer quality. I use a portable mp3-player in my car to listen to the recorded radio broadcasts, so a lower quality does not really matter. Furthermore, radio quality is also less than CD quality, so 128 kbps should be convenient. But again, everyone has to sort this out by themselves.

About the SuSE script and nicing. I really do not know if this works without any problem. The way I indicated it will definitely prevent flaws in the music recording stream. I think it is the best way to go for standalone machines (which I happen to use at home). For more dedicated machines, nice might help. Very fast disk access and processor speed might help even more. Try it out and let me now!

I will check out this talkback page on a regularly basis, so people can communicate with me through this pages (and let other people also read their matters).


Philip de Groot
From: Pierre Abbat <phma(at)> [ date: 2001-03-19 ]
Don't shut down cron, just comment the cron.daily entry out of the crontab.
In Mandrake this is /etc/crontab and it has hourly, daily, weekly, and monthly
entries. The big time-eaters are slocate (supersedes updatedb, lists all files
on the computer) and makewhatis (compiles an index of all man pages). You can
just chmod -x these in the cron.daily and cron.weekly directories and it won't
run them.
From: Domenico Rotiroti [ date: 2001-03-21 ]
Has anyone considered using gogo instead of lame ?
Uses the same encoding algo., but it's notably faster on
intel/amd processors.
From: Philip de Groot <philipg(at)> [ date: 2001-03-21 ]

As a matter of fact, I initially tried to use gogo, but it won't work. It is not possible to pass the correct options through to gogo, whereas it works in lame (gogo is derived from lame, but you cannot replace it that easily...). If you want to, you can try for yourself to use gogo. If you are succesfull, please let me now...


Philip de Groot
From: reihal <reihal(at)> [ date: 2001-04-04 ]

All you will ever need to know about setting MP3 encoding can be found at this site:
Use his default settings.
100% quality guaranteed!
From: Rick Holbert [ date: 2001-04-11 ]
Here's an example script that could be used to record a 90 minute long local computer talk show:

/usr/local/bin/mpegrec \
-l 5400 \
-x '--preset fm \
--tt "Computers in Your Life" \
--tl "Open Line with Tom Wieble" \
--ta "Tom Wieble" --ty `date +%Y` \
--tg "Speech" \
--tc "Copyright (c) 1997 - `date +%Y` WOSU" -c' \
-o open_line_`date +%d%b%y`_`date +%H%M`.mp3

Edit as needed, save it as mp3_record, chmod it to 755, and use cron or at to start it at the appropriate time.


From: Y <Yen7(at)> [ date: 2001-04-12 ]
just want to ask if anybody got experience with ripping mp3-streams(or real) from the web to the harddisk? I am grateful for any hint or link, perhaps Phillip himself has any ideas? cu Y
From: Rick Holbert [ date: 2001-04-13 ]
Here are some programs for saving mp3 and/or real streams to your harddisk:

wget - doesn't yet support rtsp://, try replacing with http://
vsound - runs in front of player i.e., vsound realplay url
streamripper - mp3? haven't tried this one yet

From: Philip de Groot <philipg(at)> [ date: 2001-04-15 ]

I want to comment that a search on mp3-recording on the internet resulted in programs that just store e.g. an mp3-stream locally on the hard disk (it was very hard to find a program such as 'mpegrec' in the first place).. Plenty of programs are available to do this job. It is even possible to click on an mp3-stream and to save it on disk. Another possibility is the use of 'mpg123'. You can use this program to listen to mp3-streams, but it is also possible to store the encoded music as a wave-file:

mpg123 -s > test.wav

The stream here originates from my favorite station, Loostad radio. Fill in any link you like! To play the encoded wave back, the following command will do:

play -r 22050 -t raw -s w -f s -c 1 test.wav (see man pages!)

However, storing the decoded wave-file is very disk-consuming, but it is possible anyway.

And Rick, I have received your email (and seen your listing here). I will include some in the next article about real-time mp3-recording. However, I do not know whether I can manage to publish it in the May issue of LinuxFocus (I am a bit busy, you know).


Philip de Groot
From: zero§7 [ date: 2001-04-30 ]
it's amazing to me, how many people stake their reputation on 128kbit mp3s.

not that it was worth much to begin with
From: pearn <pearn(at)> [ date: 2001-08-06 ]
Hy folks!
Iīm looking for a method to do mp3 - realtime-encoding without a increasing wave-file getting ībigger every minute. Is it possible to use a wave-file only as a buffer not getting bigger than letīs say 50MB where every second of wave file is deleted after itīs encoded ?

Thanks a lot..

From: Philip de Groot <philipg(at)> [ date: 2001-08-06 ]

How you can achieve this is explained in detail in the article. You should use 'mpegrec', which in fatc uses a small memory buffer for the real-time encoding...


From: ross randolph <rand104(at)> [ date: 2001-11-30 ]
I am a beginner, and do not understand most of the data presented. How can a beginner start, is there an idiot book or article for me?
I am just learning how to master coping a CD on my CD writer.
From: Philip de Groot <philipg(at)> [ date: 2001-12-13 ]
The MP3 HowTo might be of great help:
By the way: I apologize for the late response. I have not visited this page for a while and the automated email-notification system seems to be non-functioning. Regards, Philip
From: Samuel Hammond <nsxfan2001(at)> [ date: 2002-01-05 ]
I'm looking for a way to stop and start recording when a serial port line (DSR? DTR?) is toggled, maybe also to name the file with the date & time the recording started. Can someone point out a script that will accomplish this?
From: Philip de Groot <philipg(at)> [ date: 2002-01-15 ]
Hello Samuel,

I have no idea how you can accomplish this... Sorry, Philip
From: Matt [ date: 2002-02-12 ]
I'm having problems using a script which uses mpegrec from cron. The script which I have written includes the following lines :

/home/u99/n9323400/local/bin/mpegrec \
-b 16 -l 60 -o /home/u99/n9323400/project/test.mp3 \
-x "--resample 16 -a -mm -h"

This was giving me an error that lame could not be found so I made changes so that the location of lame was given explicitly :

/home/u99/n9323400/local/bin/mpegrec \
-e "/home/u99/n9323400/local/bin/lame" \
-b 16 -l 60 -o /home/u99/n9323400/project/test.mp3 \
-x "--resample 16 -a -mm -h"

Now i'm getting the following errors:

Streaming 44100Hz WAV data to:
/home/u99/n9323400/local/bin/lame --resample 16 -a -mm -h

LAME version 3.91 (

usage: /home/u99/n9323400/local/bin/lame [options] <infile> [outfile]

<infile> and/or <outfile> can be "-", which means stdin/stdout.

"/home/u99/n9323400/local/bin/lame --help" for general usage information
"/home/u99/n9323400/local/bin/lame --preset help" for information on suggested predefined settings
"/home/u99/n9323400/local/bin/lame --alt-preset help" for information on the seperate and very highly
tuned for quality predefined settings
"/home/u99/n9323400/local/bin/lame --longhelp"
or "/home/u99/n9323400/local/bin/lame -?" for a complete options list

Has anyone ideas what i'm doing wrong? The script is definately running as the radio is starting and i'm getting the error messages, but there is no output.



From: Philip de Groot <philipg(at)> [ date: 2002-03-14 ]

I think that some things in this new version of lame has been changed. Have you tried to compile an older version of 'lame'? This will probably solve your problem!


From: clara maria <sabba22(at)> [ date: 2002-04-09 ]
kiero bajar musica para mi ordenata
From: I Shelton <divxname(at)> [ date: 2002-08-27 ]
I've been trying to record some asf/asx streams with mpegrec (via aviplay).
I am getting "no Inputbuffers!" error all the time.The mpegrec program compiled fine (had to adjust machine type from "march=pentiumpro.." to "march=i586.." in the source file, though).
Also, when I try to record from CD with mpegrec the recorded file runs with double speed on playback! BTW, Lame is v3.92, compiled clean.
I thought my hardware was too obsolete (P233MMX,128Mb RAM 16-bit ALS 120s/c), but on win2000 which I run in parallel to SuSE 8.0 on the same machine I can record streaming media via Total Recorder without any difficulty, and the quality is G-O-O-D! So, obviously it is more of the OS/software problem, because, at the end of the day, all s/w is just a code, nothing more.Is there anything I can do to correct these problems?
From: Philip de Groot (original author) <philipg(at)> [ date: 2002-08-28 ]

I have encountered the same problems in SuSE 8.0. It has everything to do with the NEW ALSA 0.9 drivers. For some reason, the ALSA OSS emulation with this new version does not work properly. Even after compiling and installing the latest ALSA drivers (0.9.0rc3), I was unable to solve the problem (on the contrary, I couldn't even play sound anymore)! I have found the OSS compatibility library on their website, but have not taken a closer look to it yet. Anyway, using ALSA 0.9 in SuSE 8.0 as the standard sound driver was VERY premature. Perhaps you should consider compiling the OSS support in instead of using ALSA for the moment (also see my compile-kernel article in the July/August 2002 edition of this magazine).

If anyone has some advice, please inform us!

Regards, Philip
From: I Shelton <divxname(at)> [ date: 2002-08-29 ]
Thank you for your comments. In fact, I 've compiled kernel sound modules, and use sb.o module instead of ALSA. It works with all sound proggies, EXCEPT mpegrec. Now, whenever I try to record streaming asf/asx via AVIPLAY, I get /dev/dsp busy message. I the article you mentioned recording radio transmission. Could you please specify, was it streaming via Internet, or just via radio receiver - plug into "line-in" to s/card - record via mpegrec?

From: Philip de Groot (original author) <philipg(at)> [ date: 2002-08-31 ]
Hello Shelton,

I was NOT making recordings via the internet. I used a radio receiver and the line-in plugin of my soundcard. If you want to make a recording of a internet transmission, why using mpegrec? I mean: internet streams are in .asf-format which can be stored and replayed, is it not? There is some software available to do so in windows, but storing the stream on harddisk instead of listening should have the same result, I guess!

Succes, Philip
From: I Shelton <divxname(at)> [ date: 2002-08-31 ]
I think I 've found the reason for my problems. Linux sound drivers are "not very good" at initialising full duplex capabilities of legacy ISA sound cards (though, to my knowledge, a lot of people still use them, simply because they are as good as it gets under Windows for the average user!). My s/card would be installed by OSS, kernel or ALSA as a half-duplex device. This device type cannot record and playback simultaniously. That is the reason mpegrec cannot access "second" /dev/dsp: second DMA channel is simply "lost" by Linux driver.
From: I Shelton <divxname(at)> [ date: 2002-08-31 ]
Thank you again for the explanation. That really helps because I thought I've been missing something at my end. Yes, in Windows it is piece of cake, just two clicks away with Total recorder. I've been trying to solve this puzzle on Linux. Storing asf/asx files: yes, you can do with Asfrecord, for example (if you have a cygwin compiler - abt 100MB download, btw), however, direct recording to MP3 format makes sense: it is "editable" straight away you can run any sound manipulator, CD recorder, etc. The difference between radio recording via Internet and through a "radio receiver in line-in" is, as I understand, the same as between digital (=Internet) and analogue (=wave) reception. Internet stream is already bits-and-bites!

From: Anonymous User [ date: 2002-10-11 ]

I'm having problems compiling mpegrec, I've got the following error message:

Building wavrec for a system with 1 processor(s)
Not utilizing libhoard for SMP memory management.
g++ -o wavrec -O9 -lpthread -fomit-frame-pointer \
-march=pentiumpro -ffast-math -funroll-loops -fprofile-arcs \
-fbranch-probabilities warning: file srec.da not found, execution counts assumed to be zero.

my configuration: P200, SoundBlaster 128PCI, SuSE 7.3

any help greatly appreciated


From: Philip de Groot (original author) <philipg(at)> [ date: 2002-10-12 ]
Hello Eric,
This is no problem at all. The file srec.da is the temporarily file where 'mpegrec' stores the wave-data. You're compiling this program for the first time, so the file does not exist and is created with a size of zero. As it should be! You shouldn't have any problems using 'mpegrec' within SuSE 7.3 (you will in SuSe 8.0 or higher due to the new ALSA-drivers they use in there, but this does not apply to SuSE 7.3 or lower).If you have problems, however, try to omit '-O9'; an optimization parameter that may cause a problem. Regards,Philip
From: eric [ date: 2002-10-14 ]
it was probably this '-O9' parameter, without it mpegrec compiled just fine and it works well now
thank you very much

From: eric [ date: 2002-12-03 ]
Does mpegrec have an option for selecting the soundcard? I would like to record from my second soundcard. Or must I link /ded/dsp to /dev/dsp1?


From: Philip <philq(at)> [ date: 2003-05-08 ]
This is really not about this article. But I need a knowledgable person's help. I am a programmer, written in languages from assembler to basic and c plus many others. I have a client who needs me to create a program that can be called and basically given two audio files (probably mp3 format) the first file I need to truncate at 45secs. the send file will be a 'voiceover' file that is 45secs long From these two files I need to produce one file which contains the contents of both and is only 45 secs long. Can you proint to any software that does this or libraries of code that will allow me to do this.
Thank you in advance.

Philip Quirino
From: Philip de Groot (original author) <<Due to SPAM disabled>> [ date: 2003-05-12 ]
Hello Philip (Hee, same name!),

Perhaps these two links might be of help: (portable cross-platform Audio API) (saves many audio formats!)

I think that the top link (portaudio) gives you the tool to program such a utility. I guess that the only thing that needs to be done is opening both files, mix them throught the soundcard mixer and save the resulting file. The libsnd library provides support for loading and saving popular audio formats (also platform independent). The 2 links above should be a nice starting point.


Philip de Groot (author real-time mp3-recording article)

From: Walt Joyce [ date: 2003-09-03 ]
I just did something stupid and need some help backing out of it. I used the
suggested command line but changed the "-c 2" to "-c 1". Thus, my command
line was: "sox -t ossdsp -w -s -r 44100 -c 1 /dev/dsp -t raw -|lame -x -m s
- ./testfile.mp3". The result is half the expect file size, claims to be half
the expect time length, and plays much too fast (possibly twice the speed
of the original). Is there a way to convert what I have to what I want?


Walt Joyce

From: Philip de Groot (original author) <<due to SPAM disabled>> [ date: 2003-09-05 ]
Hello Walt,

What might help is to playback the file with mpg123 --mono <filename>

If this works, you can decode the file back to wave (see manpages of mpg123) en encode it to mp3 again using lame, but WITHOUT supplying the option '-m s' (which forces stereo)

If this does not work, you're in trouble. I do not know whether your obtained mp3-file can be repaired then.


From: Peter [ date: 2003-12-04 ]
If you want to record in ogg vorbis, use something like this:
sox -t ossdsp -w -s -r 44100 -c 2 /dev/dsp -t raw - | oggenc -r -q 4 -o test.ogg -

From: Nico [ date: 2005-02-03 ]
Hi to all !
I'm working on a recorder linux (mp3 ogg) problem is that i want stop recorder after x time(sec)....Is a param that work with sox,lame and ogg ? or you know another software that work with this option (seconds of recoring..)..I don't want use the kill functions...
thanks a lot in advance,
From: Harald <morosus(at)> [ date: 2006-03-24 ]
I found a note (dated 2002-10-12) where you describe a problem solution
for mpegrec:

This is no problem at all. The file srec.da is the temporarily file
where 'mpegrec' stores the wave-data. You're compiling this program for
the first time, so the file does not exist and is created with a size of
zero. As it should be! You shouldn't have any problems using 'mpegrec'
within SuSE 7.3 (you will in SuSe 8.0 or higher due to the new
ALSA-drivers they use in there, but this does not apply to SuSE 7.3 or
lower).If you have problems, however, try to omit '-O9'; an optimization
parameter that may cause a problem. Regards,Philip

how can I "omit '-09'????? (I'm using ubuntu 5.10)
From: hernandez aldape ludwig <cfrance_5(at)> [ date: 2006-06-21 ]
gracias por tener una pagina asi
From: victoria <victoria0072(at)> [ date: 2006-07-10 ]
me lo quiero bajar porq parece ser muy bueno
From: lola <lala_1800(at)> [ date: 2006-08-31 ]
super le site

42 talkbacks in English
Other talkbacks:   Nederlands Francais

Due to the increased amount of web spam we have deciced to removed the talkback posting possibility. You can read old talkbacks but you can no longer post new ones.

Back to

Please contact webmaster(at) if you have any questions with regards to this talkback

lftalkback version 3.10