[FFmpeg-devel] [PATCH 2/4] Change the PTS time base to AV_TIME_BASE before to process a frame in the filter chain, and change it back to the stream time base in the filtered frame.

Stefano Sabatini stefano.sabatini-lala
Mon Jul 19 18:26:20 CEST 2010


On date Tuesday 2010-06-15 03:05:41 +0200, Michael Niedermayer encoded:
> On Sat, Jun 12, 2010 at 12:45:29AM +0200, Stefano Sabatini wrote:
> > On date Wednesday 2010-06-09 00:17:27 +0200, Stefano Sabatini encoded:
> > > This is required, since all the frames in the filterchain are supposed
> > > to use a time base of AV_TIME_BASE.
> > > ---
> > >  ffplay.c |    3 ++-
> > >  1 files changed, 2 insertions(+), 1 deletions(-)
> > > 
> > > diff --git a/ffplay.c b/ffplay.c
> > > index 129cd28..dd3cba0 100644
> > > --- a/ffplay.c
> > > +++ b/ffplay.c
> > > @@ -1678,7 +1678,7 @@ static int input_request_frame(AVFilterLink *link)
> > >      }
> > >      av_free_packet(&pkt);
> > >  
> > > -    picref->pts = pts;
> > > +    picref->pts = av_rescale_q(pkt.pts, priv->is->video_st->time_base, AV_TIME_BASE_Q);
> > >      picref->pos = pkt.pos;
> > >      picref->pixel_aspect = priv->is->video_st->codec->sample_aspect_ratio;
> > >      avfilter_start_frame(link, picref);
> > > @@ -1838,6 +1838,7 @@ static int video_thread(void *arg)
> > >              SDL_Delay(10);
> > >  #if CONFIG_AVFILTER
> > >          ret = get_filtered_video_frame(filt_out, frame, &pts_int, &pos);
> > > +        pts_int = av_rescale_q(pts_int, AV_TIME_BASE_Q, is->video_st->time_base);
> > >  #else
> > >          ret = get_video_frame(is, frame, &pts_int, &pkt);
> > >  #endif
> > 
> > Ping? (That's required by the setpts patch).
> 
> we need the timebase for muxing, a lazy filter could always
> set that to AV_TIME_BASE_Q if it likes but we should support keeping track
> of it.
> If you disagree then which timebase should the muxer store?
> some containers dont like it if the timebase is 1000000 times smaller than
> 1/average fps

Have a look at the attached patch, the ffplay patch is merely intended
to show how this stuff is supposed to be used.

I have also a settb filter I'm using here for testing.

Regards.
-- 
FFmpeg = Furious & Fierce Meaningless Pitiless Exxagerate Guru



More information about the ffmpeg-devel mailing list