Writing and reading back metadata on audio files
-
Hi
I'm trying to record audio from my mic and add some tags. I need something like QMediaMetaData::Comment to write some specific text.
I tried a few combinations from supported containers/codecs/file extensiosns but it aways writes matroska container and Qt can't read QMediaMetaData::Comment back from such a file. Though I can open written media file in VLC and it shows COMMENTS extra tag. I tried to read QMediaMetaData::Comment from 3rdparty mp3 files and it works well except some text encoding problems, though QAudioRecorder is unable to write mp3 (audio/mpeg for both container and codec) files for me.
I also tried to hexdump of the written file and noticed the metadata is duplicated somewhere in the beginning of the file and in the end. Weird.Does anyone know any combination which definitely works in writing and reading back QMediaMetaData::Comment or any other type where I can put 300 bytes of text for robots?
-
I uderstood was I was doing wrong. I was trying to catch
QMediaPlayer::metaDataAvailableChanged
signal and take metadata from its handler. But basically this signal is absolutely useless and one should useQMediaObject::metaDataChanged(const QString &key, const QVariant &value)
instead.It still doesn't eplain why metadata is duplicated in the mediafile. But it's not that important now.