[Libav-user] Audio quality loss while encoding
Brad O'Hearne
brado at bighillsoftware.com
Thu Apr 25 02:16:01 CEST 2013
On Apr 24, 2013, at 4:54 PM, Paul B Mahol <onemda at gmail.com> wrote:
> You call av_samples_alloc_array_and_samples() with align set to 0, which means
> channel data planes are aligned along 32 byte boundary. Is this really the case?
>
> Set align argument to 1 if to make them aligned along 1 byte boundary.
Here is the information on the sample buffer received from QTKit which is being used to fill the source data array:
2013-04-24 17:06:58.653 QTFFmpeg[2732:d407] Linear PCM, 32 bit little-endian floating point, 2 channels, 44100 Hz
2013-04-24 17:06:58.654 QTFFmpeg[2732:d407] Bytes per frame: 4
2013-04-24 17:06:58.654 QTFFmpeg[2732:d407] Frames per packet: 1
2013-04-24 17:06:58.655 QTFFmpeg[2732:d407] Bits per channel: 32
2013-04-24 17:06:58.655 QTFFmpeg[2732:d407] Is packed? YES
2013-04-24 17:06:58.655 QTFFmpeg[2732:d407] Is high aligned? NO
2013-04-24 17:06:58.656 QTFFmpeg[2732:d407] Channels per frame: 2
So to answer your question, provided that I've understood it correctly, samples are packed, therefore should be aligned on the full 32-bit boundary, and thus align should be set to 0. But for the sake of curiosity, I changed align to 1 (for all functions with align) and it made no difference in the audio distortion...same as before. I then tried setting the align parameter to 1 on only the filling of the source data array -- distorted audio still, but seemed to cut the whole track short.
To the best of my knowledge, a packed sample buffer should not need high alignment (which I presume is what you mean by the 1 byte boundary). If I've misunderstood your question, let me know.
Thanks,
Brad
More information about the Libav-user
mailing list