<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I managed to trace this down to av_frame_get_buffer returning -22.</div><div class=""><br class=""></div><div class="">Here's the code that I tried:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(52, 149, 175); background-color: rgb(255, 255, 255);" class="">  AVFrame<span style="color: #000000" class=""> *audioFrame = </span>av_frame_alloc<span style="color: #000000" class="">();</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">  audioFrame-><span style="color: #3495af" class="">channels</span> = 2;</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(52, 149, 175); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">  audioFrame-></span>channel_layout<span style="color: #000000" class=""> = </span>av_get_default_channel_layout<span style="color: #000000" class="">(2);</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">  audioFrame-><span style="color: #3495af" class="">sample_rate</span> = 44100;</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">  audioFrame-><span style="color: #3495af" class="">nb_samples</span> = buffer-><span style="color: #3495af" class="">mBuffers</span>[0].<span style="color: #3495af" class="">mDataByteSize</span>/ <span style="color: #0433ff" class="">sizeof</span>(<span style="color: #3495af" class="">Float32</span>) * 44100;</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">  audioFrame-><span style="color: #3495af" class="">pts</span> = audioFrame-><span style="color: #3495af" class="">nb_samples</span>;</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(52, 149, 175); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">  </span>av_frame_get_buffer<span style="color: #000000" class="">(audioFrame, 0); <--- returns -22</span></div><div style="margin: 0px; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">  audioFrame-><span style="color: #3495af" class="">extended_data</span>[0] = buffer-><span style="color: #3495af" class="">mBuffers</span>[0].<span style="color: #3495af" class="">mData</span>;</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">  audioFrame-><span style="color: #3495af" class="">extended_data</span>[1] = buffer-><span style="color: #3495af" class="">mBuffers</span>[1].<span style="color: #3495af" class="">mData</span>;</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">  audioFrame-><span style="color: #3495af" class="">linesize</span>[0] = buffer-><span style="color: #3495af" class="">mBuffers</span>[0].<span style="color: #3495af" class="">mDataByteSize</span>;</div><div style="margin: 0px; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(52, 149, 175); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">  </span>AVFrame<span style="color: #000000" class=""> *otherFrame = </span>av_frame_alloc<span style="color: #000000" class="">();</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">  <span style="color: #0433ff" class="">int</span> result2 = <span style="color: #3495af" class="">av_frame_ref</span>(otherFrame, audioFrame); <--- returns -22</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(180, 38, 26); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">  </span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(52, 149, 175); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">  </span><span style="color: #0433ff" class="">int</span><span style="color: #000000" class=""> result = </span>av_buffersrc_write_frame<span style="color: #000000" class="">(</span><span style="color: #0433ff" class="">self</span><span style="color: #000000" class="">.</span>bufferContext<span style="color: #000000" class="">, audioFrame);</span></div></div><div class=""><br class=""></div><div class="">Why would av_frame_get_buffer return -22? Am I not supposed to call it? What about write frame?</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Nov 27, 2017, at 7:19 PM, Ronak Patel <<a href="mailto:ronak2121-at-yahoo.com@ffmpeg.org" class="">ronak2121-at-yahoo.com@ffmpeg.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Hi Paul,<br class=""><br class="">Do you mind pointing me to the relevant documentation?<br class=""><br class="">I tried setting up an AVFrame instance with the sample rate, channel layout and data but the calls to av_frame_ref are failing with -22 errors. I’m looking for any sample code that shows how to properly initialize an AVFrame from an AudioBufferList.<br class=""><br class="">Thanks<br class=""><br class="">Ronak<br class=""><br class="">Sent from my iPhone<br class=""><br class=""><blockquote type="cite" class="">On Nov 26, 2017, at 2:17 PM, Paul B Mahol <<a href="mailto:onemda@gmail.com" class="">onemda@gmail.com</a>> wrote:<br class=""><br class=""><blockquote type="cite" class="">On 11/26/17, Ronak <<a href="mailto:ronak2121-at-yahoo.com@ffmpeg.org" class="">ronak2121-at-yahoo.com@ffmpeg.org</a>> wrote:<br class="">Hi,<br class=""><br class="">I'm trying to build a graphic equalizer using the ffmpeg library for iOS,<br class="">wrapping the AVFilter library in an AUAudioUnit.<br class=""><br class="">I'm having trouble figuring out how to convert an AudioBufferList's data to<br class="">an AVFilter and back. The input buffers are in stereo, so I'm also unsure<br class="">how to pass in both data arrays.<br class=""><br class="">Does anyone know how to do this?<br class=""></blockquote><br class="">Have you read already available documentation?<br class=""><br class="">AVFrame stores samples for packed format into AVFrame->data[0].<br class="">And planar format into AVFrame->extended_data[ X ], where X is channel number.<br class="">_______________________________________________<br class="">Libav-user mailing list<br class=""><a href="mailto:Libav-user@ffmpeg.org" class="">Libav-user@ffmpeg.org</a><br class="">http://ffmpeg.org/mailman/listinfo/libav-user<br class=""></blockquote><br class="">_______________________________________________<br class="">Libav-user mailing list<br class=""><a href="mailto:Libav-user@ffmpeg.org" class="">Libav-user@ffmpeg.org</a><br class="">http://ffmpeg.org/mailman/listinfo/libav-user<br class=""></div></div></blockquote></div><br class=""></body></html>