From cc9c74ea877392a8ee44724a9c588802225503c3 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 16 Nov 2014 02:49:12 +0100 Subject: [PATCH] avformat/segment: export inner muxer timebase Fixes "Non-monotonous DTS in output stream 0:0" Fixes Ticket4020 Signed-off-by: Michael Niedermayer (cherry picked from commit ce80f9fee97160049687bbbef4eb31a68166c3ee) --- libavformat/segment.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavformat/segment.c b/libavformat/segment.c index f35bbef8dc..eb1cfee4f3 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -567,6 +567,7 @@ static int seg_write_header(AVFormatContext *s) AVFormatContext *oc = NULL; AVDictionary *options = NULL; int ret; + int i; seg->segment_count = 0; if (!seg->write_header_trailer) @@ -672,6 +673,13 @@ static int seg_write_header(AVFormatContext *s) } seg->segment_frame_count = 0; + av_assert0(s->nb_streams == oc->nb_streams); + for (i = 0; i < s->nb_streams; i++) { + AVStream *inner_st = oc->streams[i]; + AVStream *outer_st = s->streams[i]; + avpriv_set_pts_info(outer_st, inner_st->pts_wrap_bits, inner_st->time_base.num, inner_st->time_base.den); + } + if (oc->avoid_negative_ts > 0 && s->avoid_negative_ts < 0) s->avoid_negative_ts = 1;