<div class="gmail_extra"><br><br><div class="gmail_quote">2012/4/24 Goo Creations <span dir="ltr"><<a href="mailto:goocreations@gmail.com" target="_blank">goocreations@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi all,<br><br>I've been stuck with this problem for a while now. When opening a file and doing the following:<br><br>AVCodecContext *codecContext = NULL;<br>AVFormatContext *formatContext = NULL;<br>AVCodec *codec;<br>


<br>avformat_open_input(&formatContext, "a.flac", NULL, NULL);<br><div>int streamId = av_find_best_stream(formatContext, AVMEDIA_TYPE_AUDIO, -1, -1, &codec, 0);<br>codecContext = formatContext->streams[streamId]->codec;<br>


<br>cout<<codecContext->sample_fmt<<endl;<br><br>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.<br>
<br>Thanks<br><br>Chris</div>
<br>_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br></blockquote></div><br>try "avformat_find_stream_info" <a href="http://www.ffmpeg.org/doxygen/trunk/group__lavf__decoding.html#gd42172e27cddafb81096939783b157bb">http://www.ffmpeg.org/doxygen/trunk/group__lavf__decoding.html#gd42172e27cddafb81096939783b157bb</a> </div>
<div class="gmail_extra">before using "av_find_best_stream"</div><div class="gmail_extra"><br clear="all"><div><br></div>-- <br><span style="color:rgb(51,51,51);font-family:'Lucida Grande',Helvetica,Verdana,sans-serif;font-size:12px;line-height:20px"><b><u><a href="http://codergrid.de" target="_blank">Media Encoding Cluster</a></u>, </b></span><div>
<span style="color:rgb(51,51,51);font-family:'Lucida Grande',Helvetica,Verdana,sans-serif;font-size:12px;line-height:20px"><b>the first Open Source Cluster Encoding Solution </b></span></div><div><span style="color:rgb(51,51,51);font-family:'Lucida Grande',Helvetica,Verdana,sans-serif;font-size:12px;line-height:20px"><b>for distributed Media Encoding.</b></span></div>
<br>
</div>