X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=mux.cpp;fp=mux.cpp;h=d0c17fdfdc89665ab717db0fc182308f07751ae9;hb=3173d8e9b8c66be0a6cb08d7a102297456f4e7a3;hp=534d56abd8e0dfb7fd667d9fb60788b83049f409;hpb=8e709b0411645fca8b66035ee6db1eba68039b13;p=nageru 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); }