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

Matthieu Regnauld mregnauld at gmail.com
Sun Oct 21 23:44:20 EEST 2018


Thank you so much for your help, it works much better, I can clearly hear
the music now!

Also, about your tips, it's just for the example, to make the code easier
to read (but I agree with you).

That said, I made some changes in the code, and I still have a few more
questions:

1 - Even if the sound is much better, it's unfortunately still bad: on the
left channel, there is only crackling, while on the right channel, the
sound is much better, but still with some crackling too, even if the sound
doesn't saturate. Also, the sound is low-pitched (only if I use
AV_SAMPLE_FMT_FLT for swr_alloc_set_opts()). Where could that come from?

2 - My sound is encoded in 44100 Hz, while my device expects sound in 48000
Hz. I think that there is a command in FFMpeg that allows upscaling (not
sure about the term), i.e. provide 48000 frames per second from a file
encoded in 44100 Hz, for example. How can I achieve that?

3 - *" You have no idea if the buffer passed to getPcmFloat() fits the
samples you wanna write. It would be to pass a size_t bufferLength as
well."* : I agree, and again, I provide this code to make it easy to
understand, but I found a workaround for that. That said, if it's possible
to ask FFMpeg to extract a specific number of frames, I'm interested. Is it
possible, and if yes, how?

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


More information about the Libav-user mailing list