[FFmpeg-devel] [PATCH] lavf: rescale duration for chained muxers.

Nicolas George nicolas.george at normalesup.org
Wed Feb 27 17:48:57 CET 2013


Fix trac ticket #2300 because the duration of the segments
was computed using the timestamp of the last packet plus its
duration using the 1/90000 default time base instead of using
the chained muxer time base.

Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
 libavformat/utils.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 9bd2d0c..0aa2671 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3967,6 +3967,10 @@ int ff_write_chained(AVFormatContext *dst, int dst_stream, AVPacket *pkt,
         local_pkt.dts = av_rescale_q(pkt->dts,
                                      src->streams[pkt->stream_index]->time_base,
                                      dst->streams[dst_stream]->time_base);
+    if (pkt->duration)
+        local_pkt.duration = av_rescale_q(pkt->duration,
+                                          src->streams[pkt->stream_index]->time_base,
+                                          dst->streams[dst_stream]->time_base);
     return av_write_frame(dst, &local_pkt);
 }
 
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list