Hello, I've been trying to encode audio that I capture from DirectShow on
windows. I receive a 88200 bytes-long buffer of PCM input each time my
sample grabber callback function is called by DirectShow.

Here's what my code looks like:

BYTE* pBuffer; // PCM input, received by DirectShow
long BufferLen; // length of buffer, it is 88200 bytes
..........

 // this is adapted from output_example.c
AVCodecContext *c;
AVPacket pkt;
av_init_packet(&pkt);
c = st->codec;
audio_input_frame_size = BufferLen / 2;
pkt.size= avcodec_encode_audio(c, audio_outbuf, audio_outbuf_size, samples);

..............

But the produced mp3 files are playing too quickly - for example after 27
seconds of capturing only 1 second long mp3 file is recorded. What should I
change in my code to fix this?
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to