Recording Audio Using QtAudioRecorder
im trying to use the QtAudioRecorder to record some simple soundfiles. But I've discovered a few problems.
First if I'm trying to use it like in the example it keeps showing an error like:
"Could not create a media muxer element: "" "
It's always the same error even if i switch the codec.
However there's a workaround for that error. It dissapears when im not using
If i dont use the codec im able to take up to 3 records stored correctly in a .wav file (Sometimes i can take only 1 record, then again it's 2 or 3... I can't discover any regularity in it). But then the programm freezes when I'm using:
QAudioRecorder *audioRecorder; //Class member
audioRecorder = new QAudioRecorder(this);
if (audioRecorder->state() == QMediaRecorder::StoppedState)
if (audioRecorder->state() == QMediaRecorder::RecordingState)
My OS is Debian 7.
Any help is appreciated! Thanks in advance.
This post is quite old, but I had a similar problem and solved it, so here is what I did. The problem was that I had to define both the codec and the container. The latter is necessary to create the muxer element, and the former has to be a string as defined in the Qt code (so I had to use "audio/PCM"; it did not work with "audio/wav" or "audio/pcm"):
audioSettings.setCodec("audio/PCM"); ... audioRecorder->setContainerFormat("wav");
I could then record into a WAV file.