From 3173d8e9b8c66be0a6cb08d7a102297456f4e7a3 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Tue, 19 Apr 2016 21:50:15 +0200 Subject: [PATCH] Scale duration correctly. --- mux.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mux.cpp b/mux.cpp index 534d56a..d0c17fd 100644 --- a/mux.cpp +++ b/mux.cpp @@ -94,9 +94,11 @@ void Mux::add_packet(const AVPacket &pkt, int64_t pts, int64_t dts) if (pkt.stream_index == 0) { pkt_copy.pts = av_rescale_q(pts, AVRational{1, TIMEBASE}, avstream_video->time_base); pkt_copy.dts = av_rescale_q(dts, AVRational{1, TIMEBASE}, avstream_video->time_base); + pkt_copy.duration = av_rescale_q(pkt.duration, AVRational{1, TIMEBASE}, avstream_video->time_base); } else if (pkt.stream_index == 1) { pkt_copy.pts = av_rescale_q(pts, AVRational{1, TIMEBASE}, avstream_audio->time_base); pkt_copy.dts = av_rescale_q(dts, AVRational{1, TIMEBASE}, avstream_audio->time_base); + pkt_copy.duration = av_rescale_q(pkt.duration, AVRational{1, TIMEBASE}, avstream_audio->time_base); } else { assert(false); } -- 2.39.2