[Libav-user] Audio sample rate conversion and fixed frame size
Anton Shekhovtsov
shekh.anton at gmail.com
Fri Jan 23 13:55:41 CET 2015
2015-01-23 14:34 GMT+02:00 Max Vlasov <max.vlasov at gmail.com>:
> 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.
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
>
Yes, in the code fragment above "buf_data" is assumed to hold data between
invocations. Exactly that - caching somewhere
But it is plain memory buffer, not tricky :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20150123/20d0a9f4/attachment.html>
More information about the Libav-user
mailing list