]> git.sesse.net Git - nageru/commitdiff
Scale duration correctly.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 19 Apr 2016 19:50:15 +0000 (21:50 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 19 Apr 2016 19:50:15 +0000 (21:50 +0200)
mux.cpp

diff --git a/mux.cpp b/mux.cpp
index 534d56abd8e0dfb7fd667d9fb60788b83049f409..d0c17fdfdc89665ab717db0fc182308f07751ae9 100644 (file)
--- 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);
        }