[Libav-user] How to get raw audio frames from an audio file

Matthieu Regnauld mregnauld at gmail.com
Sun Oct 21 13:37:02 EEST 2018


Thanks a lot for your help.

That said, I still haven't managed to solve my problem, and I'm new to
FFMpeg.

My final goal is to be able to extract raw audio frames from an OGG file on
the fly (and, if possible, from any other format), and convert them in an
array of float amplitudes (between -1 and 1).

Here is a copy of the code that I'm trying to make work:
https://gist.github.com/mregnauld/2538d98308ad57eb75cfcd36aab5099a

I initiate my player this way:
FFMpegPlayer* ffMpegPlayer = new FFMpegPlayer();
ffMpegPlayer->createFFmpeg("/path/to/my/file.ogg");

And later on, when I need audio samples, I do this way, and I redirect the
buffer directly to the audio output (it for an Android app):
float *buffer;
ffMpegPlayer->getPcmFloat(buffer);

I still have white noice so far, but I can hear a little bit the music
(actually I guess it more that I can hear it), which makes me think that
I'm close to the solution.

What should I change in my code to get the proper float amplitudes?

Thanks for your help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20181021/bd44fe8f/attachment.html>


More information about the Libav-user mailing list