[Libav-user] Audio sample rate conversion and fixed frame size
Max Vlasov
max.vlasov at gmail.com
Fri Jan 23 13:34:13 CET 2015
On Fri, Jan 23, 2015 at 2:20 PM, Anton Shekhovtsov <shekh.anton at gmail.com>
wrote:
> I used swresample only to convert format but it looks simple as brick to
> me.
>
>
Is there somewhere a hidden question "What is the problem in the first
place?" :)
Probably I missed the point somewhere, but some codecs report particular
frame_size so one should feed data only with blocks having this particular
size. A quote from the sources about
AVCodecContext.frame_size
...
* - encoding: ... Each submitted frame
* except the last must contain exactly frame_size samples per
channel.
* May be 0 when the codec has CODEC_CAP_VARIABLE_FRAME_SIZE set,
then the
* frame size is not restricted.
*)
If incoming data has the same sample_rate as outgoing, no problem,
swr_convert will output the same amount of frames as it accepted. But if
the sample rate are different (44.1k vs 48 k), you can't avoid tricky
arithmetic/logic or caching extra data somewhere unless you have plans to
violate the rule.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20150123/25fe2132/attachment.html>
More information about the Libav-user
mailing list