From: Steinar H. Gunderson Date: Tue, 19 Apr 2016 19:50:15 +0000 (+0200) Subject: Scale duration correctly. X-Git-Tag: 1.3.0~69 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=3173d8e9b8c66be0a6cb08d7a102297456f4e7a3;p=nageru Scale duration correctly. --- 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); }