<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, Sans-Serif;font-size:10pt"><div id="yiv0038239558" class="" style=""><div class="" style=""><div style="background-color: rgb(255, 255, 255)" class=""><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="color: rgb(0, 0, 0); font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10pt"><span class="" id="yiv0038239558yui_3_13_0_9_1398638654618_14" style="">AVCodecContext *inputAudioContextz= NULL;<br clear="none" style=""></span></div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="color: rgb(0, 0, 0); font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10pt; background-color: transparent"><span class="" id="yiv0038239558yui_3_13_0_9_1398638654618_16" style="">AVFormatContext*
inputAudioFormat= NULL; <br clear="none" class="" id="yiv0038239558yui_3_13_0_1_1398638654618_25881" style=""></span></div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="color: rgb(0, 0, 0); font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.63636302947998px; background-color: transparent; font-style: normal"><span class="" id="yiv0038239558yui_3_13_0_9_1398638654618_19" style=""><br clear="none" id="yiv0038239558yui_3_13_0_1_1398638654618_25884" class="" style=""></span></div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="color: rgb(0, 0, 0); font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.63636302947998px; background-color: transparent; font-style: normal"><span class="" id="yiv0038239558yui_3_13_0_9_1398638654618_22" style="">I do call av_register_all before the code I sent you (sorry
should have said that).</span></div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="color: rgb(0, 0, 0); font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.63636302947998px; background-color: transparent; font-style: normal"><span class="" style=""><br class="" style=""></span></div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="color: rgb(0, 0, 0); font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.63636302947998px; background-color: transparent; font-style: normal"><span class="" style="">I have removed the lines which were setting the muxer values but it didn't help.</span></div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="color: rgb(0, 0, 0); font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.63636302947998px;
background-color: transparent; font-style: normal"><span class="" style=""><br class="" style=""></span></div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="color: rgb(0, 0, 0); font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.63636302947998px; background-color: transparent; font-style: normal"><span class="" style="">Here's the new code in case it helps.</span></div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="color: rgb(0, 0, 0); font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.63636302947998px; background-color: transparent; font-style: normal"><span class="" style=""><br class="" style=""></span></div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style=""><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8"
style="background-color: transparent">int ret= avformat_open_input(&inputAudioFormat, filename, NULL, NULL);</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>if(ret < 0)</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>{</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>qDebug() << "couldn't open input file for audio ";</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>exit(1);</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>}</div><div
class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>inputAudioContextz = inputAudioFormat->streams[0]->codec;</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>inputAudioContextz->codec = avcodec_find_decoder(inputAudioContextz->codec_id);</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><br class="" style=""></div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>if (avcodec_open2(inputAudioContextz, inputAudioContextz->codec, NULL) < 0) {</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre">
</span>fprintf(stderr, "could not open codec\n");</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>exit(1);</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>}</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><br class="" style=""></div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>AVPacket pkt;</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>av_init_packet( &pkt ); //tried both leaving this line in and commenting it out neither help</div><div class=""
id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>qDebug() << "b4 while read frame";</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>while (av_read_frame( inputAudioFormat, &pkt ) >= 0) //crashes here</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>{</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>qDebug() << "after while read frame";</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>if(pkt.stream_index == 0)</div><div class=""
id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>{</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><br class="" style=""></div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><br class="" style=""></div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>if(decoded_frame)</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>av_frame_unref(decoded_frame);</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><br class="" style=""></div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color:
transparent"><span class="" style="white-space:pre"> </span>if (!(decoded_frame = avcodec_alloc_frame()))</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>{</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>fprintf(stderr, "Could not allocate audio frame\n");</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>exit(1);</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>}</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><br class="" style=""></div><div class=""
id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>int rv = avcodec_decode_audio4(inputAudioContextz, decoded_frame, &got_frame, &pkt);</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>qDebug() << "result decodeframe" <<rv;;</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>}</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="background-color: transparent"><span class="" style="white-space:pre"> </span>}</div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="color: rgb(0, 0, 0); font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.63636302947998px;
font-style: normal; background-color: transparent"><br class="" style=""></div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="color: rgb(0, 0, 0); font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.63636302947998px; font-style: normal; background-color: transparent"><br></div><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_8" style="color: rgb(0, 0, 0); font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.63636302947998px; font-style: normal; background-color: transparent">Thanks again for your time.</div></span></div><div class="" id="yiv0038239558yqt07693" style="color: rgb(0, 0, 0); font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10pt"><div class="" id="yiv0038239558yui_3_13_0_9_1398638654618_10" style="display: none"> <div class=""
style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, Sans-Serif;font-size:10pt"> <div class="" style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, Sans-Serif;font-size:12pt"> <div class="" dir="ltr" style=""> <font class="" size="2" face="Arial" style=""> On Monday, 28 April 2014, 1:02, Gonzalo Garramuno <ggarra13@gmail.com> wrote:<br clear="none" class="" style=""> </font> </div> <div class="" style="">On 27/04/14 20:54, <a rel="nofollow" shape="rect" class="" ymailto="mailto:b.mcdonagh@sky.com" target="_blank" href="mailto:b.mcdonagh@sky.com" style="">b.mcdonagh@sky.com</a> wrote:<br clear="none" class="" style="">> I've had a look at your code, thanks. It seems you are using <br clear="none" class="" style="">> av_read_frame which for me crashes with mp3 files as previously described.<br clear="none" class="" style="">><br clear="none" class="" style="">> I have just
quickly written some code which has the crashes in when I <br clear="none" class="" style="">> run it - I hope this can help somebody to point me in the right <br clear="none" class="" style="">> direction. It crashes on av_read_frame or (find_stream_info - if i <br clear="none" class="" style="">> uncomment it out)<br clear="none" class="" style="">><br clear="none" class="" style=""> What are inputAudioFormat and
inputAudioContextz? Also did you <br clear="none" class="" style="">call av_register_all() before?<br clear="none" class="" style="">> int ret= avformat_open_input(&inputAudioFormat, filename, <br clear="none" class="" style="">> NULL, NULL);<br clear="none" class="" style="">> //yyy = avformat_find_stream_info(inputAudioFormat, NULL);<br clear="none" class="" style="">> //qDebug() << " crashes above line if not commented out ...after find <br clear="none" class="" style="">> stream info inputAudioFormat res=" << yyy;<br clear="none" class="" style="">><br clear="none" class="" style="">><br clear="none" class="" style="">> inputAudioContextz = inputAudioFormat->streams[0]->codec;<br clear="none" class="" style="">> inputAudioContextz->strict_std_compliance = -2;<br clear="none" class="" style="">> inputAudioContextz->bit_rate = <br clear="none" class=""
style="">> 64000;//inputAudioFormat->streams[0]->codec->bit_rate;<br clear="none" class="" style="">> inputAudioContextz->channels = 2;<br clear="none" class="" style="">> inputAudioContextz->request_channel_layout = AV_CH_LAYOUT_STEREO;<br clear="none" class="" style="">> inputAudioContextz->sample_rate = <br clear="none" class="" style="">> 44100;//inputAudioFormat->streams[0]->codec->sample_rate;<br clear="none" class="" style="">> inputAudioContextz->codec = <br clear="none" class="" style="">> avcodec_find_decoder(inputAudioContextz->codec_id);<br clear="none" class="" style="">You shouldn't need to initialize the audio context when demuxing. Leave <br clear="none" class="" style="">all values at their default.<br clear="none" class="" style=""><br clear="none" class="" style="">> inputAudioCodec = (AVCodec*)inputAudioContextz->codec;<br clear="none" class="" style="">This
definitively looks wrong.<br clear="none" class="" style=""><br clear="none" class="" style="">><br clear="none" class="" style="">> if (!inputAudioCodec) {<br clear="none" class="" style="">> fprintf(stderr, "no codec not found\n");<br clear="none" class="" style="">> exit(1);<br clear="none" class="" style="">> }<br clear="none" class="" style="">> if (avcodec_open2(inputAudioContextz, inputAudioContextz->codec, NULL) <br clear="none" class="" style="">> < 0) {<br clear="none" class="" style="">> fprintf(stderr, "could not open codec\n");<br clear="none" class="" style="">> exit(1);<br clear="none" class="" style="">> }<br clear="none" class="" style="">><br clear="none" class="" style="">Here you would start with av_read_frame()<div class="" id="yiv0038239558yqtfd17667" 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 rel="nofollow" shape="rect" class="" ymailto="mailto:Libav-user@ffmpeg.org" target="_blank" href="mailto:Libav-user@ffmpeg.org" style="">Libav-user@ffmpeg.org</a><br clear="none" class="" style=""><a rel="nofollow" shape="rect" class="" target="_blank" href="http://ffmpeg.org/mailman/listinfo/libav-user" style="">http://ffmpeg.org/mailman/listinfo/libav-user</a><br clear="none" class="" style=""></div><br clear="none" class="" style=""><br clear="none" class="" style=""></div> </div> </div> </div></div> </div></div></div></div></body></html>