[Libav-user] Handling of 24 bit audio in libav* and libswresample
hs at tagtraum.com
Tue Jun 4 13:29:38 CEST 2013
I'm working on a little (java) library for decoding audio using FFmpeg/libav* and have some questions regarding the handling of 24 bit audio.
1. (SHIFTING) When decoding, 24bit audio is apparently shifted, i.e. 24bit become 32bit, as there is no 24bit AVSampleFormat. Am I right to assume that the data is shifted toward the most significant byte? I.e. the most significant 3 bytes are the same as the original 24bit?
Or is the most significant byte simply "sign-extended" and the three least significant bytes are the original 24bit?
2. (SWRESAMPLE) I'm using libswresample to, well, resample data, get rid of planar formats etc. It's working great. libswresample also accepts AVSampleFormat parameters for input and output format. This implies that it does not support any conversion to true 24bit, represented by 3 bytes. Correct?
3. (CODEC) What is the recommend way to produce 24bit audio? After decoding (and potentially resampling), should I use the corresponding codec (e.g. AV_CODEC_ID_PCM_S24LE) to produce the data in the format I'm interested in? Or is there another, better way?
Thanks in advance.
More information about the Libav-user