<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, Sans-Serif;font-size:10pt"><div class="" style=""><span class="" style="">I've had a look at your code, thanks. It seems you are using av_read_frame which for me crashes with mp3 files as previously described.</span></div><div style="color: rgb(0, 0, 0); font-size: 13.63636302947998px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal" class=""><span class="" style=""><br class="" style=""></span></div><div style="color: rgb(0, 0, 0); font-size: 13.63636302947998px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal" class=""><span class="" style="">I have just quickly written some code which has the crashes in when I run it - I hope this
 can help somebody to point me in the right direction. It crashes on av_read_frame or (find_stream_info - if i uncomment it out)</span></div><div style="color: rgb(0, 0, 0); font-size: 13.63636302947998px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal" class=""><span class="" style=""><br class="" style=""></span></div><div style="background-color: transparent" class="">        int ret= avformat_open_input(&inputAudioFormat, filename, NULL, NULL);</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre"> </span>//yyy = avformat_find_stream_info(inputAudioFormat, NULL);</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">      </span>//qDebug() << " crashes above line if not commented out ...after find stream info inputAudioFormat res=" <<
 yyy;</div><div style="background-color: transparent" class=""><br class="" style=""></div><div style="background-color: transparent" class=""><br class="" style=""></div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">    </span>inputAudioContextz = inputAudioFormat->streams[0]->codec;</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre"> </span>inputAudioContextz->strict_std_compliance = -2;</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">      </span>inputAudioContextz->bit_rate = 64000;//inputAudioFormat->streams[0]->codec->bit_rate;</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">       </span>inputAudioContextz->channels = 2;</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">
        </span>inputAudioContextz->request_channel_layout = AV_CH_LAYOUT_STEREO;</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">    </span>inputAudioContextz->sample_rate = 44100;//inputAudioFormat->streams[0]->codec->sample_rate;</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre"> </span>inputAudioContextz->codec =  avcodec_find_decoder(inputAudioContextz->codec_id);</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">     </span>inputAudioCodec = (AVCodec*)inputAudioContextz->codec;</div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 13.63636302947998px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal;" class=""><br></div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">
                </span>if (!inputAudioCodec) {</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">                 </span>fprintf(stderr, "no codec not found\n");</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">                      </span>exit(1);</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">                </span>}</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">       </span>if (avcodec_open2(inputAudioContextz, inputAudioContextz->codec, NULL) < 0) {</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">                     </span>fprintf(stderr, "could not open codec\n");</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">                    </span>exit(1);</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">        
        </span>}</div><div style="background-color: transparent" class=""><br class="" style=""></div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">     </span>AVPacket pkt;</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">   </span>  av_init_packet( &pkt );</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">      </span>      qDebug() << "b4 while read frame";</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre"> </span>  while (av_read_frame( inputAudioFormat, &pkt ) >= 0) {</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">            </span>  qDebug() << "after while read frame";</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">    </span>  
  if(pkt.stream_index == 0)</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">             </span>  <span class="" style="white-space:pre">   </span>{</div><div style="background-color: transparent" class=""><br class="" style=""></div><div style="background-color: transparent" class=""><br class="" style=""></div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">           </span>  <span class="" style="white-space:pre">           </span>if(decoded_frame)</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">               </span>  <span class="" style="white-space:pre">                   </span>av_frame_unref(decoded_frame);</div><div style="background-color: transparent" class=""><br class="" style=""></div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">                </span>  <span class="" style="white-space:pre">           </span>if
 (!(decoded_frame = avcodec_alloc_frame()))</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">          </span>  <span class="" style="white-space:pre">           </span>{</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">               </span>  <span class="" style="white-space:pre">                   </span>fprintf(stderr, "Could not allocate audio frame\n");</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">          </span>  <span class="" style="white-space:pre">                   </span>exit(1);</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">                </span>  <span class="" style="white-space:pre">           </span>}</div><div style="background-color: transparent" class=""><br class="" style=""></div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">             </span>  <span class=""
 style="white-space:pre">          </span>int rv = avcodec_decode_audio4(inputAudioContextz, decoded_frame, &got_frame, &pkt);</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">            </span>  <span class="" style="white-space:pre">           </span>qDebug() << "result decodeframe" <<rv;;</div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">           </span>  <span class="" style="white-space:pre">   </span>}</div><div style="background-color: transparent" class=""><span class="" style=""></span></div><div style="background-color: transparent" class=""><span class="" style="white-space:pre">      </span>  }</div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, Sans-Serif; font-size: 10pt" class=""> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida
 Grande, Sans-Serif; font-size: 12pt" class=""> <div dir="ltr" class="" style=""> <font size="2" face="Arial" class="" style=""> On Monday, 28 April 2014, 0:09, Gonzalo Garramuno <ggarra13@gmail.com> wrote:<br class="" style=""> </font> </div>  <div class="" style="">On 27/04/14 20:03, <a shape="rect" ymailto="mailto:b.mcdonagh@sky.com" href="mailto:b.mcdonagh@sky.com" class="" style="">b.mcdonagh@sky.com</a> wrote:<br clear="none" class="" style="">> Thank you for your response Gonzalo.<br clear="none" class="" style=""><br clear="none" class="" style="">Maybe my code sample in <a shape="rect" href="http://sourceforge.net/projects/mrviewer" target="_blank" class="" style="">http://sourceforge.net/projects/mrviewer </a>will <br clear="none" class="" style="">help you out.  You should look at the file called CMedia_audio.cpp and <br clear="none" class="" style="">aviImage.cpp.<br clear="none" class="" style="">The viewer plays mp3 and has
 never needed to call the routines you mention.<div class="" id="yqtfd22621" style=""><br clear="none" class="" style=""><br clear="none" class="" style="">_______________________________________________<br clear="none" class="" style="">Libav-user mailing list<br clear="none" class="" style=""><a shape="rect" ymailto="mailto:Libav-user@ffmpeg.org" href="mailto:Libav-user@ffmpeg.org" class="" style="">Libav-user@ffmpeg.org</a><br clear="none" class="" style=""><a shape="rect" href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank" class="" style="">http://ffmpeg.org/mailman/listinfo/libav-user</a><br clear="none" class="" style=""></div><br class="" style=""><br class="" style=""></div>  </div> </div>  </div> </div></body></html>