[FFmpeg-user] AC3 decoder now decoding to AV_SAMPLE_FMT_S32P? WTF?

Carl Eugen Hoyos cehoyos at ag.or.at
Fri Jun 28 16:47:16 CEST 2013

Thomas Worth <dev <at> rarevision.com> writes:

> >> Correction, that should have said the decoded AVFrame is in
> >
> > Correct: In your old version, the (definitely non-free)
> > conversion from float to s32 was done inside the decoder,
> > now you can either directly use the floats (for higher
> > performance) or use the (optimised) converter in
> > libswresample (that allows you to do other conversions
> > at the same time) if you need ints.
> Thanks, Carl. My code takes the decoded AVFrame from
> avcodec_decode_audio4 (now in float format) and passes 
> it directly to avcodec_encode_audio2 to transcode to 
> PCM S16. Since my output audio needs to be signed PCM 
> 16 bit, do I have no choice but to resample the
> audio manually using swresample?

If you mean pcm_s16le or pcm_s16be (there is no "PCM S16" 
encoder iirc), yes you have to call swresample for the 
conversion because the two mentioned encoders require 
AV_SAMPLE_FMT_S16. Note that the overall process may still 
be faster than before, it should at least not be much 
slower (and some common decoding - encoding processes are 
definitely faster now because the two conversions to and 
from s16 are not needed anymore.)

Carl Eugen

More information about the ffmpeg-user mailing list