[FFmpeg-devel] Flac Sample Format
Goo Creations
goocreations at gmail.com
Tue Apr 24 14:29:03 CEST 2012
Hi,
Seems it happens with all formats (wav, mp3, etc), not just Flac.
Chris
On Tue, Apr 24, 2012 at 2:26 PM, Goo Creations <goocreations at gmail.com>wrote:
> Hi all,
>
> I've been stuck with this problem for a while now. When opening a flac
> file and doing the following:
>
> AVCodecContext *codecContext = NULL;
> AVFormatContext *formatContext = NULL;
> AVCodec *codec;
>
> avformat_open_input(&formatContext, "a.flac", NULL, NULL);
> int streamId = av_find_best_stream(formatContext, AVMEDIA_TYPE_AUDIO, -1,
> -1, &codec, 0);
> codecContext = formatContext->streams[streamId]->codec;
>
> cout<<codecContext->sample_fmt<<endl;
>
> It returns -1 (AV_SAMPLE_FMT_NONE) with flac files (other codecs are
> fine). If I use the terminal tool (ffmpeg -i a.flac) it says s32 under the
> stream info. So what am I doing wrong that my code does not return the
> sample format?
>
> Thanks
>
> Chris
>
More information about the ffmpeg-devel
mailing list