[FFmpeg-devel] [WIP] New Filter (dejudder)

Nicholas Robbins nickrobbins at yahoo.com
Sun Jan 26 17:07:28 CET 2014


> On Saturday, January 25, 2014 3:18 PM, Nicholas Robbins <nickrobbins at yahoo.com> wrote:

>
> Now it doesn't seem to be saving the PTS I write to frame->pts in 
> filter_frame. If I print frame->pts inside, it shows the new PTS, but when it 
> comes time to put that frame into the mkv it forgets the PTS. What am I doing 
> wrong?

Ok, I'm having a hard time understanding what is going on here. I can't seem to permanently change the timebase of the stream. Right now I have the following as my config_out_props:

static int config_out_props(AVFilterLink *outlink)
{   
    AVFilterContext *ctx = outlink->src;
    DejudderContext *dj = ctx->priv;
    AVFilterLink *inlink = outlink->src->inputs[0];

    outlink->time_base = av_mul_q(inlink->time_base,av_make_q(1,2*(dj->cycle)));
    outlink->frame_rate = av_make_q(1,0);

    av_log(ctx, AV_LOG_VERBOSE, "%d cycle dejudder. TB change: %d/%d -> %d/%d\n",
           dj->cycle, inlink->time_base.num, inlink->time_base.den,
           outlink->time_base.num, outlink->time_base.den);

    outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;
    outlink->w = inlink->w;
    outlink->h = inlink->h;

    return 0;
}


I found that if I didn't put in the undefined framerate, it didn't change the frame positions at all. With the undefined frame rate, it changes them, but now they still have the old timebase when they are output. So, for example, the filter reports setting the frames to (next is old PTS, new is new PTS)
....
next=19854, new=158864
next=19887, new=159198
next=19954, new=159532
next=19987, new=159866
next=20020, new=160195
next=20054, new=160532
next=20120, new=160861
next=20154, new=161198
next=20287, new=162032

Note that the old pts show judder. Some are 33/34 appart and some are 66/67 apart.

but then in the resulting mkv I get the following PTS's:

....
19716
19758
19800
19842
19883
19925
19967
20009
20050

Now, you can see that in some sense I've improved the situation. The new PTS are evenly spaced (all 41 or 42 apart) however, I would like to keep the larger timebase to reduce rounding errors. Also, the new PTS's aren't even the old ones divided by 8. Where are they coming from?

Do I need to add something to my config_out_props to make it respect the timebase I want and not just rescale the PTS's into the old timebase?

-Nicholas Robbins



More information about the ffmpeg-devel mailing list