Hey, this is my first time decoding audio and I'm currently trying to figure out the best way to convert audio to the target format.<div><br></div><div>My understanding is that when the audio is decoded, in order to play it through the sound system (with say pulseaudio), it should be converted to the sound system's target format if it isn't already in that format, like say if my target format is two channels, S16 non-planar, 44100hz. After consulting the ffplay source I found that they use libswresample. However I've also found mention of using libavfilter for this purpose. I have no experience with libavfilter but it seems to me like a very recent commit to ffplay adds support for it: <a href="https://github.com/FFmpeg/FFmpeg/commit/e96175ad7b576ad57b83d399193ef10b2bb016ae" target="_blank">https://github.com/FFmpeg/FFmpeg/commit/e96175ad7b576ad57b83d399193ef10b2bb016ae</a> so I can probably learn from that.</div>


<div><br></div><div>It seems like it uses the 'abuffer' filter, is this the one to use for this case? It doesn't strike me (from the doxygen) as a filter used for conversion. It seems to me like it's setup as an `abuffer` for the input and an `abuffersink` for the output, and the `abuffersink`'s parameters describe the target format. So when a frame is put in and pulled out from the filter graph it's automatically converted to that format due to the parameters passed to 'abuffersink'?</div>
<div><br></div><div>I had also previously seen someone say to use the 'aformat' filter for this purpose. Is there a difference? Looking at the list of filters, I also see "aconvert: Sample format and channel layout conversion audio filter" and "resample: Sample format and channel layout conversion audio filter". So I see there's abuffer, aformat, aconvert, and resample, so I'm pretty confused here and would really appreciate any clarification. Then again I know nothing about the whole filter system so this may be something very simple/obvious.</div>
<div><br></div><div>Aside from that, what are the benefits of using libavfilter for converting to the target format over using libswresample? It seems to me like after the initial setup for avfilter, the actual conversion process seems a lot simpler, simply consisting of putting frames and pulling them out of the filter graph. Is this the benefit?</div>

<div><br></div><div>Thanks, I would really appreciate some clarification for this.<br clear="all">
<div><br></div>-- <br>- Jorge Israel Peña
</div>