[FFmpeg-devel] [PATCH v2] avfilter/avf_showcqt: improve pts handling
wm4
nfxjfg at googlemail.com
Wed Feb 17 12:25:04 CET 2016
On Wed, 17 Feb 2016 01:13:54 +0700
Muhammad Faiz <mfcc64 at gmail.com> wrote:
> On Tue, Feb 16, 2016 at 6:22 PM, wm4 <nfxjfg at googlemail.com> wrote:
> > On Tue, 16 Feb 2016 18:01:16 +0700
> > Muhammad Faiz <mfcc64 at gmail.com> wrote:
> ...
> >> remaining -= s->remaining_fill;
> >> + if (out) {
> >> + int64_t pts = av_rescale_q(insamples->pts, inlink->time_base, av_make_q(1, inlink->sample_rate));
> >> + pts += insamples->nb_samples - remaining - s->fft_len/2;
> >> + pts = av_rescale_q(pts, av_make_q(1, inlink->sample_rate), outlink->time_base);
> >> + if (FFABS(pts - out->pts) > PTS_TOLERANCE) {
> >> + av_log(ctx, AV_LOG_DEBUG, "changing pts from %"PRId64" (%.3f) to %"PRId64" (%.3f).\n",
> >> + out->pts, out->pts * av_q2d(outlink->time_base),
> >> + pts, pts * av_q2d(outlink->time_base));
> >> + out->pts = pts;
> >> + s->next_pts = pts + PTS_STEP;
> >
> > What is this code needed for? The PTS_TOLERANCE thing specifically.
>
> Because input time_base and output time_base does not match,
> there is probability that linear input pts gives non linear output pts,
> probably differ by 1, e.g 0 11 20 31 40 ... and I prefer linear output pts.
> You may try it with PTS_TOLERANCE set to 0.
>
Hm ok, that still seems a bit sketchy (a filter shouldn't try to "fix"
timestamps), but probably ok.
More information about the ffmpeg-devel
mailing list