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

Michael Niedermayer michaelni at gmx.at
Thu Jan 9 02:43:50 CET 2014


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 ?


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140109/cec26e4b/attachment.asc>


More information about the ffmpeg-devel mailing list