c++qtqt5codecqtmultimedia

How to select the parameter of the setCodec() function for audio recording in Qt


I'm using QAudioRecorder in Qt to record a voice, here is the sample code.

audioRecorder = new QAudioRecorder;

QAudioEncoderSettings audioSettings;
audioSettings.setCodec("audio/amr"); //here's my question
audioSettings.setQuality(QMultimedia::HighQuality);

audioRecorder->setEncodingSettings(audioSettings);

audioRecorder->setOutputLocation(QUrl::fromLocalFile("test.amr"));
audioRecorder->record();

But I have no idea how to use the setCodec() function

void QAudioEncoderSettings::setCodec(const QString & codec)

How can find out which parameter (such as "audio/amr" or "audio/x-wav") I can use and their exact meanings? Thanks!


Solution

  • You could see the codec candidate in the source code for the different plugins.