[Ffmpeg-devel] encode audio with FFMPEG ... Please help me

Michael Niedermayer michaelni
Sat Oct 28 12:07:17 CEST 2006


On Sat, Oct 28, 2006 at 04:47:47PM +0700, Paul wrote:
> I have used DirectSound for recording wave file from microphone.
> I create a thread to run recording,.... Inside recording function, i have pbCaptureData (type is IDirectSoundBuffer) to get sound data in real-time.
> And i also write these codes (in recording function) to encode audio and then write to file
> .....
> DWORD out_size ;
> out_size = avcodec_encode_audio(c, outbuf, outbuf_size, (short*)pbCaptureData);
> fwrite(outbuf, 1, out_size, outputfile);
> ....
> (Note: Before call above, i set outbuf_size = 10000; and outbuf = (unsigned char*)malloc(outbuf_size); i used codec is MP2... )
> ....
> But the outputfile  (output file) is not correct. Althought the output file was encoded, but data not correct.
> I donot know where i am wrong??? Anyone can help me fix...
> Or anyone can show me source sample for encoding from exist file (wave format) to MP2.

see libavcodec/apiexample.c and output_example.c

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is

More information about the ffmpeg-devel mailing list