On Wed, 2021-02-03 at 12:14 -0500, Bob Goodwin wrote:
How can I put them together in one command or if there is a simpler
and better way, how to get a compressed output file from arecord?
When you say compressed, do you really mean MP3, or would any
compressed audio format suffice? And does it have to be arecord, or a
command line tool?
arecord supports .au files, which are/can be compressed files.
And arecord can supposedly be used like this to create a MP3:
arecord -f cd -t raw | lame -x -r – out.mp3
Or, like this to create an OGG file:
arecord -f cd -t raw | oggenc – -r -o out.ogg
I haven't tested either of these, I just googled:
command line mp3 recording linux
Those examples use a pipe to take the output from one program (the
first one on the command line) and directly send it to the next one,
without first saving it as a file. You should be able to combine the
process you previously used over a couple of command lines to record a
wav and convert to MP3, in a variety of different ways.
However, MP3 encoding requires a certain amount of data to do its
compression trick, so might not be as instantaneous as you think, might
require a longer test recording using this method.
And how are you going to stop recording? Does your command line tool
cleanly stop and output a useable file when you CTRL+C it? I've only
used GUI tools to record (e.g. Audacity), but I realise that's not a
practical solution for everyone.
When I googled: command line mp3 recording linux
I see another page where they suggest this example:
arecord -d 5 -f U8 sample.mp3
Which recorded 5 seconds of 8-bit MP3. But perhaps Fedora's arecord
doesn't support MP3?
And apparently ffmpeg can record an audio input. This page details
recording to a wav
https://trac.ffmpeg.org/wiki/Capture/ALSA but you
ought to be able to specify any file format that ffmpeg supports.
--
uname -rsvp
Linux 3.10.0-1160.11.1.el7.x86_64 #1 SMP Fri Dec 18 16:34:56 UTC 2020 x86_64
Boilerplate: All unexpected mail to my mailbox is automatically deleted.
I will only get to see the messages that are posted to the mailing list.