<html><head></head><body><div><div><div style="display: none; border: 0px; width: 0px; height: 0px; overflow: hidden; visibility: hidden;"><img src="https://r.superhuman.com/9E2wHvgP6rM-N3whi-bXdin4LdYl5h1KS-yXbYrB3xD--VkMO3QFmibI4ahhQZSeS3DDXIV_XHWXda4aHOKZuhBDgV0rVW4SQVmK6HKl6HRr7P67Rpvvxfv8YfuLxL2MPQeAVl2yoH-ZwROxOqyMB4wr6fS-C65aoPWxwAElRvhOocTdoHbqk_U.gif" alt=" " width="1" height="0" style="display: none; border: 0px; width: 0px; height: 0px; overflow: hidden; visibility: hidden;"/><!-- --></div><div><div class=""><p style="color: rgb(36, 39, 41);" class="">I am trying to encode raw audio (pcm_f32le) to AAC encoded audio. One thing I've noticed is that I can accomplish this via the CLI tool:</p><pre style="color: rgb(36, 39, 41); margin-top: 0px;" class=""><code style="font-weight:inherit;font-style:inherit;margin-left:0;margin-bottom:0;margin-right:0;margin-top:0;" class="">ffmpeg -f f32le -ar 48000 -ac 2 -c:a pcm_f32le -i out.raw out.m4a -y
</code></pre><p style="color: rgb(36, 39, 41);" class="">This plays just fine and decodes fine.</p><p style="color: rgb(36, 39, 41); margin-top: 0px;" class="">The steps I've taken:</p><ol style="color: rgb(36, 39, 41); margin-top: 0px;" class=""><li style="font-weight:inherit;font-style:inherit;margin-left:0;margin-right:0;margin-top:0;" class=""><p style="font-weight: inherit; font-style: inherit;" class="">When I am using the C example code: <a style="color: rgb(0, 100, 189); font-weight: inherit; font-style: inherit; margin: 0px;" rel="noopener noreferrer" href="https://ffmpeg.org/doxygen/3.4/encode_audio_8c-example.html" target="_blank">https://ffmpeg.org/doxygen/3.4/encode_audio_8c-example.html</a> and switch the encoder to <code style="font-weight:inherit;font-style:inherit;margin-left:0;margin-bottom:0;margin-right:0;margin-top:0;" class="">codec = avcodec_find_encoder(AV_CODEC_ID_AAC);</code></p></li><li style="font-weight:inherit;font-style:inherit;margin-left:0;margin-right:0;margin-top:0;" class=""><p style="font-weight: inherit; font-style: inherit;" class="">Output the various sample formats associated with AAC, it only provides FLTP. That assumes a planar/interleaved format.</p></li><li style="font-weight:inherit;font-style:inherit;margin-left:0;margin-bottom:0;margin-right:0;margin-top:0;" class=""><p style="font-weight: inherit; font-style: inherit;" class="">This <a style="color: rgb(0, 100, 189); font-weight: inherit; font-style: inherit; margin: 0px;" rel="noopener noreferrer" href="https://forum.videohelp.com/threads/373264-FFMpeg-List-of-working-sample-formats-per-format-and-encoder" target="_blank">page</a> seems to provide the various supported input formats per codec.</p></li></ol><p style="color: rgb(36, 39, 41);" class="">This is confusing because I don't think my raw captured audio is interleaved. I've certainly tried passing it through and it doesn't work as intended.</p><p style="color: rgb(36, 39, 41); margin-top: 0px;" class="">It will stay stuck here with this ret code indefinitely after calling <code style="font-weight:inherit;font-style:inherit;margin-left:0;margin-bottom:0;margin-right:0;margin-top:0;" class="">avcodec_receive_packet</code>:</p><pre style="color: rgb(36, 39, 41); margin-top: 0px;" class=""><code style="font-weight:inherit;font-style:inherit;margin-left:0;margin-bottom:0;margin-right:0;margin-top:0;" class="">AVERROR(EAGAIN): output is not available in the current state - user must try to send input
</code></pre><p style="color: rgb(36, 39, 41);" class="">Questions:</p><ol style="color: rgb(36, 39, 41); margin-top: 0px;" class=""><li style="font-weight:inherit;font-style:inherit;margin-left:0;margin-right:0;margin-top:0;" class=""><p style="font-weight: inherit; font-style: inherit;" class="">How can I modify the example code from FFmpeg to convert pcm_f32le raw audio to AAC encoded audio?</p></li><li style="font-weight:inherit;font-style:inherit;margin-left:0;margin-right:0;margin-top:0;" class=""><p style="font-weight: inherit; font-style: inherit;" class="">Why is the CLI tool able to?</p></li><li style="font-weight:inherit;font-style:inherit;margin-left:0;margin-right:0;margin-top:0;" class=""><p style="font-weight: inherit; font-style: inherit;" class="">I am using <a style="color: rgb(0, 100, 189); font-weight: inherit; font-style: inherit; margin: 0px;" rel="noopener noreferrer" href="http://libsound.io/" target="_blank">libsoundio</a> to capture raw audio from Linux's Dummy Output. I wonder how I could get a planar format to pass through to get AAC encoded audio.</p></li><li style="font-weight:inherit;font-style:inherit;margin-left:0;margin-bottom:0;margin-right:0;margin-top:0;" class=""><p style="font-weight: inherit; font-style: inherit;" class="">If AAC is not a possibility, is doing so with MP3?</p></li></ol></div></div><br/><div class="gmail_signature"><div><div dir="ltr"><div><div dir="ltr"><br/></div><div dir="ltr">Suhail</div></div></div></div><br/></div></div></div></body></html>