<html><head></head><body><div class="yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;"><div dir="ltr" data-setdir="false"><span><span style="color: rgb(35, 38, 41); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Liberation Sans", sans-serif; font-size: 15px;">I need to write C++ function to transcode any mp3 file to G.711 encoded wav file using LibAV API. Since we run on custom ARM board, I can use only specific available cross compiled version of LibAV libraries (pretty old, not the latest one) and there is no way to use latest LibAV library.</span></span><br></div><div dir="ltr" data-setdir="false"><span><span style="color: rgb(35, 38, 41); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Liberation Sans", sans-serif; font-size: 15px;"><br></span></span></div><div dir="ltr" data-setdir="false"><span><span style="color: rgb(35, 38, 41); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Liberation Sans", sans-serif; font-size: 15px;"><div>As part of transcoding I need to perform resampling using swr_convert.</div><div>To prepare swr context I need to setup input and output parameters including sample format, e.g.:</div><div><br></div><div> av_opt_set_sample_fmt(swr_ctx, "in_sample_fmt", pMp3CodecCtx->sample_fmt, 0);</div><div> av_opt_set_sample_fmt(swr_ctx, "out_sample_fmt", pG711CodecCtx->sample_fmt, 0);</div><div><br></div><div>The problem is that in my old version LibAV library there is NO method av_opt_set_sample_fmt defined.</div><div><br></div><div dir="ltr" data-setdir="false">If I skip setting setting <span><span style="color: rgb(35, 38, 41); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Liberation Sans", sans-serif; font-size: 15px;">sample format option </span></span>the <span>swr_init display warning</span><br><br><div><div>[SWR @ 0x2c7b950] Requested sample format (null) is not supported internally, only float & S16 is supported</div><div dir="ltr" data-setdir="false"><br>and eventually <span><span style="color: rgb(35, 38, 41); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Liberation Sans", sans-serif; font-size: 15px;">swr_convert fails on assertion:</span></span><br>Assertion a->planar failed at libswresample/swresample.c:284<br><br>Could you advise how to resolve this issue? Thanks</div><div><br></div></div><br><br></div></span></span></div></div></body></html>