[FFmpeg-cvslog] avconv: Move rescale to stream timebase before monotonisation

Mark Thompson git at videolan.org
Thu Sep 28 06:52:40 EEST 2017


ffmpeg | branch: master | Mark Thompson <sw at jkqxz.net> | Sun Feb 12 23:47:58 2017 +0000| [82989bd98c7f4e87f59af2147b645b8fd8f31c53] | committer: Mark Thompson

avconv: Move rescale to stream timebase before monotonisation

If the stream timebase is coarser than the muxing timebase then the
monotonisation process may fail because adding one to the timestamp
need not actually produce a different timestamp after the rescale.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=82989bd98c7f4e87f59af2147b645b8fd8f31c53
---

 avconv.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/avconv.c b/avconv.c
index 94b6da2a8b..5c36761c1d 100644
--- a/avconv.c
+++ b/avconv.c
@@ -326,6 +326,8 @@ static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost)
         }
     }
 
+    av_packet_rescale_ts(pkt, ost->mux_timebase, ost->st->time_base);
+
     if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS) &&
         ost->last_mux_dts != AV_NOPTS_VALUE &&
         pkt->dts < ost->last_mux_dts + !(s->oformat->flags & AVFMT_TS_NONSTRICT)) {
@@ -349,7 +351,6 @@ static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost)
     ost->packets_written++;
 
     pkt->stream_index = ost->index;
-    av_packet_rescale_ts(pkt, ost->mux_timebase, ost->st->time_base);
 
     ret = av_interleaved_write_frame(s, pkt);
     if (ret < 0) {
@@ -1006,7 +1007,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
             vid = 1;
         }
         /* compute min output value */
-        pts = (double)ost->last_mux_dts * av_q2d(ost->mux_timebase);
+        pts = (double)ost->last_mux_dts * av_q2d(ost->st->time_base);
         if ((pts < ti1) && (pts > 0))
             ti1 = pts;
     }



More information about the ffmpeg-cvslog mailing list