[Libav-user] Converting audio sample buffer format

Brad O'Hearne brado at bighillsoftware.com
Tue Feb 19 00:12:54 CET 2013


On Feb 18, 2013, at 3:50 PM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:

>> Note that the flv codec
> 
> While I have _no_ idea what the "flv audio codec" could 
> be, please use either the aconvert filter or libswresample 
> directly to convert from one audio format to another.

Perhaps this was a misuse of terms, but my intent in specifying that was to indicate the audio codec which is either tethered to or influenced by the flv video codec or stream. When creating an output context to address flv format as such: 

    const char *cFileNameExt = [@"flv" UTF8String];
    const char *cMimeType = [@"video/x-flv" UTF8String];
    _avOutputFormat = av_guess_format(cStreamName, cFileNameExt, cMimeType);

If I then create an audio stream on the associated output format (context), any attempt to open an audio codec with a sample format other than AV_SAMPLE_FMT_S16 fails. That would lead me to believe that something about having an FLV output format is restricting the audio codec to that sample format -- otherwise, I would think that any sample format could be used. That may or may not be true, but that is what my meaning was when saying "flv audio codec"...I should have probably said the "sample format compatible with flv". 

That said, thank you for your recommendation. I have found the resampling_audio.c in the FFmpeg source examples which appear to address libswresample, and I have found the filter_audio.c -- it would appear to be an aconvert example -- but if there's more doc somewhere on aconvert, I'd be interested in knowing where....that would be great. One final question -- what essentially is the difference in approach between aconvert filter and libswresample, and why would I want to use one over the other? Does it matter? 

Thanks, 

Brad






More information about the Libav-user mailing list