[Libav-user] AAC with FLV
brado at bighillsoftware.com
Sat Apr 20 00:42:38 CEST 2013
On Apr 19, 2013, at 1:57 AM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> It is a ffmpeg runtime option, the equivalent is:
> avctx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
Ok, got that working, so I didn't get the error message. However, changing the codec to AV_CODEC_ID_AAC and the sample format to AV_SAMPLE_FMT_FLTP (the only changes I made or that to my knowledge are required in my working capture-resample-encode-write pipeline) now results in distorted audio again. I'm a little stumped this time though, because first, these changes were made on working code which produced a good FLV video (with audio), and ironically the captured sample format of data is the exact same as the sample format used by AAC, so there's no mismatch there. Does anyone know what is different about processing with an AAC encoder vs a ADPCM encoder, and why the output of a working workflow might now be bad audio where before it was good? The audio now sounds slow, like talking through a fan (like a kid trying to sound like Darth Vader), and the video is kind of chunky -- good picture, but the video plays then stops, plays then stops. I've checked pts, and they are being calculated same as before and are good. Note that I've also turned off the video completely, so that only audio is being written, and the same distortion still exists in the audio.
If anyone has any ideas, I'm all ears. One question you can help with, is how to properly set up an FLV output format context for use of a codec that is different from the one it loads by default. When I create my output format context for FLV, I use the following line:
_avOutputFormat = av_guess_format(cStreamName, cFileNameExt, cMimeType);
where the file name extension is ".flv" and the mime type is "video/x-flv", it defaults an audio codec of "adpcm_swf". What I do after the fact is this:
_avOutputFormat->audio_codec = AV_CODEC_ID_AAC;
audioCodec = avcodec_find_encoder(_avOutputFormat->audio_codec);
this works, but is there something else I have to do to make AAC work? Is this the right way to specify an AAC encoder for use in an FLV output format context, or is there another way? I am receiving no errors anywhere in the pipeline, and as stated, the pts looks right. It is all monotonically increasing, and evenly spaced, but the audio is bad.
More information about the Libav-user