[Libav-user] Converting audio sample buffer format
Brad O'Hearne
brado at bighillsoftware.com
Mon Feb 18 23:22:14 CET 2013
Hello,
I am trying to stream (publish) flv video/audio from a client capturing video/audio on their machine using QTKit on Mac, using libavformat and libavcodec. I have the video streaming working, and actually the audio frames are streaming too, albeit the sound is distorted pretty much to white-noise on the other end. This is due to a mismatch between the format being output from QTKit when captured, and the format needed by libavcodec for flv.
QTKit's QTSampleBuffer info: Linear PCM, 32 bit little-endian floating point, 2 channels, 44100 Hz
Sample buffers being received from QTKit contain 512 samples, and have a buffer of 4096 in length.
The libavcodec flv audio codec:
audioCodecCtx->bit_rate = 64000;
audioCodecCtx->sample_rate = 44100;
audioCodecCtx->channels = 2;
audioCodecCtx->sample_fmt = AV_SAMPLE_FMT_S16;
audioCodecCtx->codec_type = AVMEDIA_TYPE_AUDIO;
Note that the flv codec doesn't seem to like changing the sammple format to AV_SAMPLE_FMT_S32 -- apparently isn't supported. So I think it is pretty clear that data coming in needs to be converted to the format expected by the codec. Can someone assist me in how to go about converting the QT data received into a format that can be used in flv encoding?
Your guidance is appreciated.
Thanks,
Brad
More information about the Libav-user
mailing list