[FFmpeg-devel] [PATCH] examples/muxing: honour distinction between encoder PTS timebase and stream timebase

Stefano Sabatini stefasab at gmail.com
Thu Jan 9 10:57:27 CET 2014


On date Thursday 2014-01-09 02:43:50 +0100, Michael Niedermayer encoded:
> On Thu, Jan 09, 2014 at 01:10:27AM +0100, Stefano Sabatini wrote:
> > On date Tuesday 2014-01-07 13:05:58 +0100, Stefano Sabatini encoded:
> > > Fix PTS set on the frame when encoding, which must be specified in the
> > > encoder timebase or this will confuse the encoder.
> > > 
> > > When muxing the packet, the PTS/DTS generated by the encoder is then
> > > rescaled to the stream timebase.
> > > ---
> > >  doc/examples/muxing.c | 7 ++++++-
> > >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > Up.
> > -- 
> > FFmpeg = Fundamental and Fast Monstrous Puritan Earthshaking God
> 
> >  muxing.c |    6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 9ab401bbe5f2ae4fe64936d5e7dad028473ef1a6  0004-examples-muxing-honour-distinction-between-encoder-P.patch
> > From 0ef182c790bff77a7365400d1cef56a27bbbf170 Mon Sep 17 00:00:00 2001
> > From: Stefano Sabatini <stefasab at gmail.com>
> > Date: Tue, 7 Jan 2014 13:03:39 +0100
> > Subject: [PATCH] examples/muxing: honour distinction between encoder PTS
> >  timebase and stream timebase
> > 
> > Fix PTS set on the frame when encoding, which must be specified in the
> > encoder timebase or this will confuse the encoder.
> > 
> > When muxing the packet, the PTS/DTS generated by the encoder is then
> > rescaled to the stream timebase.
> > ---
> >  doc/examples/muxing.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c
> > index 4cf72e5..e5128e8 100644
> > --- a/doc/examples/muxing.c
> > +++ b/doc/examples/muxing.c
> > @@ -427,6 +427,10 @@ static void write_video_frame(AVFormatContext *oc, AVStream *st)
> >          /* If size is zero, it means the image was buffered. */
> >  
> >          if (!ret && got_packet && pkt.size) {
> > +            /* rescale output packet timestamp values from codec to stream timebase */
> > +            pkt.pts = av_rescale_q_rnd(pkt.pts, c->time_base, st->time_base, AV_ROUND_PASS_MINMAX);
> > +            pkt.dts = av_rescale_q_rnd(pkt.dts, c->time_base, st->time_base, AV_ROUND_PASS_MINMAX);
> 
> is this intended to round toward 0 ?

Added AV_ROUND_NEAR_INF| and applied.
-- 
FFmpeg = Faithless and Faithless Magnificient Power Enchanting Genius


More information about the ffmpeg-devel mailing list