[FFmpeg-devel] [PATCH] libavfilter: Whisper audio filter
Vittorio Palmisano
vpalmisano at gmail.com
Wed Jul 23 13:51:18 EEST 2025
Update: the correct time base is stored inside inlink->time_base, not
in frame->time_base
On Wed, Jul 23, 2025 at 12:19 PM Vittorio Palmisano
<vpalmisano at gmail.com> wrote:
>
> > > To understand why this is a problem, consider some audio input device
> > > which samples at 16khz. This hardware contains lets say for simplicity a 16khz
> > > crystal and samples based on that. But depending on temperature of this
> > > crystal it will really sample lets say between 15990 and 16010khz. So
> > > simply counting samples alone is not enough. the frame->pts need to be
> > > used too.
>
> I'm trying to use the frame->pts value but I don't understand how to
> calculate the absolute time in milliseconds.
> Adding some logs I've found that:
> frame->time_base=1/48000
> frame->sample_rate=16000
>
> Using `1000 * frame->pts * frame->time_base` returns wrong results.
> The only way to get the correct value seems `1000 * frame->pts /
> frame->sample_rate`
>
>
>
> --
> /Vittorio Palmisano/
--
/Vittorio Palmisano/
More information about the ffmpeg-devel
mailing list