Formation of a waveform from an audio (or video) file?

I am trying to understand how I can generate a signal from an audio (or video) file for display to the user.

I’ve been searching the Internet for a long time and can’t determine if this is possible in Qt without using something like FFmpeg . I saw all of these classes: QMediaPlayer , QMediaContent , QMediaResource , QAudioProbe and experimented with Qt Media Player Example , but just can't see where I can access the actual sound buffer.

I have 2 questions:

  • Is this what I want to do even without third-party libraries?
  • If possible, some soul can describe what I need to read and understand in order to access the audio data.

I tried suggestions on this ( Audio visualization using QMediaPlayer ), but the result is audioProbe->setSource(player)always false and the method processBufferwill never be called.

audioProbe = new QAudioProbe(this);
bool success = audioProbe->setSource(player);
qDebug() << success;

connect(audioProbe, SIGNAL(audioBufferProbed(QAudioBuffer)), this, SLOT(processBuffer(QAudioBuffer)));

Update: Add more details in the hope of clarifying the situation.

  • For testing / training, I use the Media Player Example , which comes with Qt, so it is configured correctly with Q_OBJECT, etc.

  • For audio, I tested the .mp3 and .wav files. FWIW, the example playerfor some reason does not play the video (.mp4, .avi were tested)

  • player QMediaPlayer - QMediaObject. player . ( ) . .

  • , - , .

, .

+1
2

" ", , , . , , . (wav ), , . C. , .

, wav , , , - . .

+1

, QAudioProbe OSX - , . ( "Qt while..." ), , .

. : Qt 5.5.0

+1

All Articles