Re: [Ffmpeg-devel] Using libavformat and libavcodec(help me Martin Böhme)
Martin Boehme
boehme
Thu Jun 2 12:16:48 CEST 2005
Hi Chang,
> Thank you reply
> I read a source about audio_decode_example.
>
> So I reference example source . I write following line.
>
> First of all, Sound device initilizing.
>
> [snip loads of code]
> * GetNextAudio function is similar with GetNextFrame
>
> bool CVideoView::GetNextAudio(AVFormatContext *pFormatCtx,
> AVCodecContext *pAudioCtx, int audioStream)
> [snip more code]
>
> Problem - app is running. Video is displayed very well. But audio
> output is not correct.
Can you provide more info on how exactly the audio is not correct? Do
you get silence? Is the audio corrupted but recognizable? Do you just
get garbage (noise)? Have you tried not using the sound device directly
but writing the audio into a file, then playing it from there?
You'll find people's willingness to help you is proportional to the
amount of detail you give. ;-)
It sounds as if you're trying to decode audio and video at the same time
-- are you aware that your "GetNextAudio" function won't work in this
context? It will only work if you're decoding _only_ audio, since you're
throwing away all the video packets. Same for GetNextFrame (I assume
you're using the code from my example) -- it throws away all the audio
packet it gets (which, I assume, is why your audio doesn't work ;-)).
If you want audio and video at the same time, you'll have to separate
("demux") the audio and video packets and feed each to the correct
decoder (as Mans remarked). See ffplay.c for an example of how this works.
HTH
Martin
--
Martin B?hme
Inst. f. Neuro- and Bioinformatics
Ratzeburger Allee 160, D-23538 Luebeck
Phone: +49 451 500 5514
Fax: +49 451 500 5502
boehme at inb.uni-luebeck.de
More information about the ffmpeg-devel
mailing list