[Libav-user] Can't retrieve Sample Format

Goo Creations goocreations at gmail.com
Wed Apr 25 10:46:24 CEST 2012


Thanks, I'll try that.




On Tue, Apr 24, 2012 at 6:09 PM, jan hölscher <jan.hoelscher at codergrid.de>wrote:

>
>
> 2012/4/24 Goo Creations <goocreations at gmail.com>
>
>> Hi all,
>>
>> I've been stuck with this problem for a while now. When opening a 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). 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? I can retrieve other info such as
>> the sample rate.
>>
>> Thanks
>>
>> Chris
>>
>> _______________________________________________
>> Libav-user mailing list
>> Libav-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/libav-user
>>
>>
> try "avformat_find_stream_info"
> http://www.ffmpeg.org/doxygen/trunk/group__lavf__decoding.html#gd42172e27cddafb81096939783b157bb
>
> before using "av_find_best_stream"
>
>
> --
> *Media Encoding Cluster <http://codergrid.de>, *
> *the first Open Source Cluster Encoding Solution *
> *for distributed Media Encoding.*
>
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120425/b4022c7a/attachment.html>


More information about the Libav-user mailing list