I use C++ QAudioRecorder to record audio. I know that it’s possible to set the codec and container by making an instance of QAudioEncoderSettings, using its method setCodec and then applying it to an audio recorder with QAudioRecorder::setEncodingSettings. The list of supported encodings can be queried from Qt using the QAudioRecorder::supportedAudioCodecs method. On my device, it includes these codecs: “audio/vorbis”, “audio/speex”, “audio/PCM”, “audio/FLAC”.
I also read here that QtMultimedia uses GStreamer internally. So, I installed gstreamer1.0-tools package and tried running gst-inspect-1.0. It showed that I have the opusenc codec installed. To test it, I ran this command: gst-launch-1.0 pulsesrc ! audioconvert ! opusenc ! oggmux ! filesink location=output.opus. It worked without any issues.
But still, the list from supportedAudioCodecs doesn’t include the opus codec, even though it works fine using GStreamer command line tools. So, why can’t I use the opus codec from Qt, and how can I workaround this?