Just to add more data, this is an example of what I'm reading from my
mp3 file.  While many of the values appear to be correct (and a graph
I've made of the data appears to mostly match what I'm getting from the
same audio sample in .wav format), I'm getting a lot of byte sequences
that do not belong there - especially 0xeefeeefe. This data is taken
from channel 0, stepped by every 64 samples: f4 8f 94 bd : -0.072540 a4 61 69 bd : -0.056978 15 8e 77 3d : 0.060438 07 31 32 be : -0.174015 af c4 92 3d : 0.071664 c0 dc 45 3d : 0.048306 14 ee 38 bd : -0.045149 67 88 a9 3e : 0.331119 c0 04 c4 2f : 0.000000 ab ab ab ab : -0.000000 c5 76 7e 75 : 322571370690696392781073674665984.000000 5c d4 fb 09 : 0.000000 ee fe ee fe : -158839966806181746533156862930074992640.000000 7b cb 3c 91 : -0.000000 ee fe ee fe : -158839966806181746533156862930074992640.000000 65 55 7e 6f : 78712428148303660770110996480.000000 30 ef fc 6e : 39139691209729015717184929792.000000 0e 2e 00 be : -0.125176 19 8d 08 bb : -0.002084 89 1f da bd : -0.106505 70 c3 23 bb : -0.002499 0e 2e 28 3d : 0.041060 2d d3 28 bd : -0.041217 c8 6c 30 be : -0.172290 61 0f 17 3e : 0.147520 75 a0 15 3d : 0.036530 ee fe ee fe : -158839966806181746533156862930074992640.000000 ee fe ee fe : -158839966806181746533156862930074992640.000000
On 2019-12-03 07:56, Mark McKay wrote:

I'm trying to use libav to read in audio PCM data.  I've got it to read in my 
.wav sample data correctly (the byte format is AV_SAMPLE_FMT_S16). However, my 
.mp3 sample is getting a lot of strange spikes in the data.  The sample format 
for the .mp3 is AV_SAMPLE_FMT_FLTP and while most of the samples appear to be 
correct, about 10% of them have very large magnitudes.  I'm wondering what's 
going wrong, and if this might have something to do with the exponent of the 
floating point number being translated incorrectly.  It's not clear to me what 
the difference between AV_SAMPLE_FMT_FLT and AV_SAMPLE_FMT_FLTP is.

This is a sample of the bit of my code that reads the data from the frame. Am I reading it correctly?
int bufferSize = av_samples_get_buffer_size(NULL,

aCodecCtx->channels,

aFrame->nb_samples,

aCodecCtx->sample_fmt,

1);

uint8_t *dataBuf = aFrame->data[0];

for (int i = 0; i < aFrame->nb_samples; i++)

{

for (int ch = 0; ch < numChannels; ch++)

{

float val = 0;

switch (aCodecCtx->sample_fmt)

{
...

case AV_SAMPLE_FMT_FLT:

case AV_SAMPLE_FMT_FLTP:

{

val = ((float*)dataBuf)[ch + i * numChannels];

if (val > 1 || val < -1)

{

qDebug("Sample out of range %f", val);

val = 0;

}

break;

}

---
http://www.kitfox.com
_______________________________________________
Libav-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".
_______________________________________________
Libav-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to