[Libav-user] AVCodecContext::request_sample_fmt is not working

rohit khali khali.rohit at gmail.com
Thu Sep 3 08:01:20 EEST 2020


I am using
a base for my audio decoder.
Audio decoding sounds  ok however looks like ffmpeg outputs decoded PCM
audio based on codec type. Below are my observations for the sample_fmt.

mpeg1/mpeg2 audio : s16p
aac,aac_latm,ac3,eac3 : fltp

I want to normalize my decoded PCM output to always " fltp ". I came across
about AVCodecContext::request_sample_fmt however this setting is not
I am trying below code for mpeg1/mpeg2 audio.
   DecCtx = avcodec_alloc_context3(Codec);
    if (!DecCtx)
        return false;

    DecCtx->request_sample_fmt = AV_SAMPLE_FMT_FLTP;

    if (avcodec_open2(DecCtx, Codec, NULL) < 0)
        return false;
    const char *sample_fmt = av_get_sample_fmt_name(m_pDecCtx->sample_fmt);
    printf("[CffmpegAudioDecoder-Open: AVSampleFormat=%s]\n",sample_fmt);
-->always fetting s16p

I am wondering what am I missing?
Please help! Thanks in advance.

Rohit Khali
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20200903/a9c27957/attachment.html>

More information about the Libav-user mailing list