[Libav-user] AAC with FLV
brado at bighillsoftware.com
Sat Apr 20 18:36:57 CEST 2013
On Apr 20, 2013, at 4:42 AM, Paul B Mahol <onemda at gmail.com> wrote:
> On 4/20/13, Brad O'Hearne <brado at bighillsoftware.com> wrote:
>> affecting it. Does the creation of the output format context where it sets
>> the default audio codec also set some other state that would effect
> Without source code, this is lottery.
Paul -- thanks for the reply. My source code is on Github at:
This is a fully runnable Mac OS X (10.8) app, which captures video and audio, and writes them to a local FLV file on the desktop. The class which contains all FFmpeg code is QTFFAVStreamer. Configuration is mostly contained in QTFFAVConfig. Note that presently the app is configured to write only audio, so as to isolate it away from dealing with video. I have also included an FLV file created with this app in the following location:
You can go ahead and play this file, and hear what the problem is with the audio. If you have the knowhow to look into the file itself, well I suppose that could be done too.
At this point, essentially here's a synopsis of the situation: the app mentioned above (same codebase) has been used to create good FLV files containing both video and audio, playback appeared to be perfectly synced. In this scenario, audio was being encoded with the adpcm_swf codec, which used an S16 sample format. The only changes made to the codebase from this working scenario were:
1. The adpcm_swf codec on the output format context (which was default for FLV) was replaced with the AAC codec.
2. The codec context was set for the proper strict compliance for AAC to work:
audioCodecCtx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
3. The output sample format to which the captured audio was resampled to was changed from S16 to FLTP.
Those were the only changes made save updating the FFmpeg source code to the latest on 4/18 and rebuilding the libraries -- and if you are curious about build settings, my configure script is located at:
So after these changes, the audio is distorted. I'm not sure why -- as I know the actual capture-resample-encode-write approach / pipeline is sound, my guess is that this is some kind of additional configuration or handling need surrounding AAC.
Any thoughts, ideas, or help are greatly appreciated.
More information about the Libav-user