[Libav-user] about DTS PTS

YIRAN LI mrfun.china at gmail.com
Tue Feb 13 03:20:31 EET 2018


Hi guys,

In av_write_frame()->compute_muxer_pkt_fields()

we have
 if (pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts <
pkt->dts) {
        av_log(s, AV_LOG_ERROR,
               "pts (%s) < dts (%s) in stream %d\n",
               av_ts2str(pkt->pts), av_ts2str(pkt->dts),
               st->index);
        return AVERROR(EINVAL);
    }

May I know why we need DTS <= PTS. I understand a frame need to be decoded
before it can be shown.

Say we has packets in [DTS, PTS]: [10, 0], [11, 2], [12, 3]

If decoding and display reference different clocks, DTS and PTS can be
totally decoupled and above is a valid sequence packets.

If DTS and PTS reference a same clock which means first packet needed to be
decoded at starttime + 10 but display at starttime + 0, of couse it's
invalid. So ffmpeg interprets DTS, PTS this way?


Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20180213/6c058267/attachment.html>


More information about the Libav-user mailing list