[FFmpeg-devel] [PATCH v2] avcodec: add realtime bitstream filter

Moritz Barsnick barsnick at gmx.net
Thu May 2 13:42:21 EEST 2019


On Wed, May 01, 2019 at 12:03:41 -0300, James Almer wrote:
> > +    if (pkt->pts != AV_NOPTS_VALUE) {
> > +        int64_t pts = av_rescale_q(pkt->pts, bsf->time_base_in, AV_TIME_BASE_Q) / ctx->speed;
> > +        int64_t now = av_gettime_relative();
> > +        int64_t sleep = pts - now + ctx->delta;
> > +        if (!ctx->inited) {
> > +            ctx->inited = 1;
> > +            sleep = 0;
> > +            ctx->delta = now - pts;
>
> If this is meant to be used for input, where seeking can take place,
> wouldn't a flush() callback to set ctx->inited and ctx->delta back to 0
> be needed?

Interesting point. I suppose you mean backward seeking. Is that a valid
use case for a bitstream filter? Would it also apply to the standard
filter, where I took this code from?

I don't know, but I can try to add that, if required. Can you tell me
how to emulate or test seeking from the command line? Would I create a
file with backward jumps in PTS (and how)?

I also missed to bump libavcodec version, or to at least mention it,
BTW.

Thanks,
Moritz


More information about the ffmpeg-devel mailing list