I'm trying to convert arecord wav output to flac and it does work in part:
pi@raspberrypi /tmp $ arecord -d4 -f dat -t wav -r 48000 -c 2 |flac -f -o message.flac - --channels=1 --sample-rate=16000
it will create a file that's recognized and played as a valid flac file by mplayer:
pi@raspberrypi /tmp $ mplayer message.flac ========================================================================== Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders libavcodec version 53.35.0 (external) Mismatching header version 53.32.2 AUDIO: 48000 Hz, 2 ch, s16le, 125.8 kbit/8.19% (ratio: 15723->192000) Selected audio codec: [ffflac] afm: ffmpeg (FFmpeg FLAC audio) ==========================================================================
however, I can't figure how to properly tell flac I want a 16kHz 1 channel track as the result. When I use -d instead of plain '-' it will not accept it.
You may ask why I'm not setting arecord channel/rate to the target settings - the answer is that if I do that, the quality of sound captured is horrible, conversion to flac via sox/flac with lower settings works out much better.
I initially wanted to use sox to record flac without having to recode wav to flac but it's giving me a segmentation fault and I couldn't find a way to overcome this yet.