[Libav-user] FFmpeg 4.0 - wrong audio sample format

Carl Eugen Hoyos ceffmpeg at gmail.com
Sat Jun 30 00:51:58 EEST 2018

2018-06-29 15:20 GMT+02:00, Javier Taibo <javier.taibo at gmail.com>:

>   I have a piece of code decoding audio that broke when upgrading from
> ffmpeg 3 to 4. After tracing the code, the problem seems to be that the
> sample format of some audio streams is incorrectly notified both in
> AVCodecParameters and in AVCodecContext.
>   With ffmpeg up to 3.2, the audio stream reports s16p sample format (can
> be seen in ffprobe output), and everything works fine.
>       Stream #0:1[0x101]: Audio: mp2 ([3][0][0][0] / 0x0003), 44100 Hz,
> mono, s16p, 192 kb/s
>   Since ffmpeg 4.0 the audio stream reports fltp sample format, but the
> decoder still delivers s16p samples, so it outputs noise.
>       Stream #0:1[0x101]: Audio: mp2 ([3][0][0][0] / 0x0003), 44100 Hz,
> mono, fltp, 192 kb/s
>   Has anyone else experienced this issue?

Many people...

> Maybe a ffmpeg bug?

No, the sample format (and the pix_fmt) for a given input and a
given decoder is not part of the api, you always have to check
the sample format (and pix_fmt).

(I left the above because many people forget this and we
have changed both formats in the past and may change
them in the future.)

Edit: Re-reading your mail I see that you have a different
issue, I believe you use different decoders to analyze and
to decode the stream (mp2float vs mp2, the latter being
the integer decoder that is slower on intel hardware), I am
not sure if this is a bug in FFmpeg or in your code.

Carl Eugen

More information about the Libav-user mailing list