QMediaRecorder(QMediaFormat) not support wave format
-
I use QMediaRecorder to record audio and save it as a wav format, but find that the supported formats do not include the wave format. Do I need to add any components or 3rd libs?
code:
QMediaFormat _out_fmt; for (auto codec : _out_fmt.supportedAudioCodecs(QMediaFormat::Encode)) { qDebug() << QMediaFormat::audioCodecDescription(codec); } for (auto codec : _out_fmt.supportedFileFormats(QMediaFormat::Encode)) { qDebug() << QMediaFormat::fileFormatDescription(codec); }
output:
"Free Lossless Audio Codec (FLAC)" "Advanced Audio Codec (AAC)" "MP3" "Dolby Digital (AC3)" "Windows Media Audio" "Apple Lossless Audio Codec (ALAC)" "MPEG-4 Audio" "Free Lossless Audio Codec (FLAC)" "MPEG-4 Video Container" "Windows Media Video" "AAC" "MP3" "Windows Media Audio"
-
Is that on Windows? By default Qt uses Windows Media Foundation backend, which does support PCM audio in WAV containers, but for some reason this format doesn't seem to be mentioned in the windows platform plugin. I don't know if it's a omission by mistake or intentional. You might want to ask the developers on the mailing list.
Qt 6.4 introduced experimental ffmpeg backend that seems to at least mention this format in the code. It's a technology preview, so you might need to compile it yourself though. Target platform and backend notes.
-
@Chris-Kawa said in QMediaRecorder(QMediaFormat) not support wave format:
Is that on Windows? By default Qt uses Windows Media Foundation backend, which does support PCM audio in WAV containers, but for some reason this format doesn't seem to be mentioned in the windows platform plugin. I don't know if it's a omission by mistake or intentional. You might want to ask the developers on the mailing list.
Qt 6.4 introduced experimental ffmpeg backend that seems to at least mention this format in the code. It's a technology preview, so you might need to compile it yourself though. Target platform and backend notes.
Yes, I use Qt6.2.4 on Win 11.
Thanks for you reply.