[Libav-user] How to specify the audio sample format when opening a file

黄轩宇 xuanyu.huang at gmail.com
Wed Feb 6 04:56:45 CET 2013


Hi all,

I'm upgrading our application from using FFMPEG v0.8.5 to latest version.

As new audio sample formats were introduced in libavutil/samplefmt.h. Now
we have both packed format and planar format.

Our application, when used with old version to open a MP4 file with AAC
encoded audio, the populated pAudioCodecCtx->sample_fmt ==
AV_SAMPLE_FMT_FLP, but when used with latest FFMPEG version, this value
changed to AV_SAMPLE_FMT_FLTP.

I found a member AVCodecContext::request_sample_fmt which is said can be
set by user.

So my question is, how to set it when opening a file.

Here is the steps in our application to open a file.
1. avformat_open_input to open a file
2. avcodec_find_decoder get a pointer to AVCodec
3. call avcodec_open to open codec

could anybody tell me where to set the requested sample fmt?

And if anyone can provide the conversion function from packed data to
planar data, I'll be so grateful.

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130206/86d05ee0/attachment.html>


More information about the Libav-user mailing list