Both files play correct in VLC. So I have a very simple suggestion. It's your code that fails to play generated mp3 flv file properly. One day I faced a similar problem with AAC streams - they played 2x slower. The problem was related to audio format being improperly guessed upon completion of av_open_input_file. Check output audio format *after* you receive the first decoded audio buffer - I bet it will be diffferent.
On Fri, Nov 5, 2010 at 10:03 AM, John Ferlito <[email protected]> wrote: > Hi All, > > An update on my issues with CoreAudio and encoding to MP3/FLV. > > I've now taken the iPhone out of the equation and have a piece of > sample code that runs natively on MacOSX. It shows the exact same > symptoms. ie if I encode to PCM it works fine, but the speed is wrong > for MP3. > > The code can be found at http://inodes.org/johnf/audio_record.c > > One thing I have worked out is that the speed changes if I change the > size of the audio buffer that CoreAudio is giving me. > > So I think it is related to that in some way. > > If I have 3 seconds of audio from CoreAudio in a buffer do I pass this > to avcodec_encode_audio in one call call, or do I need to split this > up by frame size? > > Any pointers in the right direction would be appreciated. I've been > tearing my hair out for days! > > Cheers, > John > > On Tue, Oct 19, 2010 at 05:24:36PM +1100, John Ferlito wrote: >> I'm trying to encode audio on an iPhone and then send it out over >> http. >> >> The video aspect works fine. My problem is with audio. If I choose PCM >> as the codec then everything works fine. >> >> However if I switch to MP3 then the audio plays too fast. >> >> An example of each file can be found at >> http://inodes.org/johnf/iphone_pcm.flv >> and >> http://inodes.org/johnf/iphone_mp3.flv >> >> Is there anything extra I need to do when encoding audio to FLV? >> >> The only difference between the two files above is choosing a >> different audio codec for the output. > > -- > John > Blog http://www.inodes.org > LCA2011 http://www.lca2011.org.au > _______________________________________________ > libav-user mailing list > [email protected] > https://lists.mplayerhq.hu/mailman/listinfo/libav-user > _______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
