<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 4. 7. 2022., at 08:04, Jake Eastwood <<a href="mailto:cheloveck2.0@gmail.com" class="">cheloveck2.0@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">How should I validate pts/dts after demuxing and then after decoding?<div class=""><br class=""></div><div class="">For me it is significant to have valid pts all the time for days and possibly weeks of continuous streaming.</div><div class=""><br class=""></div><div class="">After demuxing I check:</div><div class="">1) dts <= pts</div><div class="">2) prev_packet_dts < next_packet_pts</div><div class="">3) I also discard packets with <span style="color:rgb(144,139,37);background-color:rgb(43,43,43);font-family:"JetBrains Mono",monospace;font-size:9.8pt" class="">AV_NOPTS_VALUE</span> and wait for packets with proper pts, because I don't know video duration at this case.</div><div class="">* pts of packets can be not increasing because of I-P-B frames</div><div class="">Is it all right?</div><div class=""><br class=""></div><div class="">What about decoded AVFrames?</div><div class="">1) Should 'pts' be increasing all the time?</div><div class="">2) Why at some point 'pts' could lag behind 'dts'?</div><div class="">3) Why <span style="color:rgb(147,115,165);background-color:rgb(43,43,43);font-family:"JetBrains Mono",monospace;font-size:9.8pt" class="">pict_type</span> is a parameter of AVFrame? Should be at AVPacket, because AVPacket is a compressed frame, not the opposite?</div></div>
_______________________________________________<br class="">Libav-user mailing list<br class=""><a href="mailto:Libav-user@ffmpeg.org" class="">Libav-user@ffmpeg.org</a><br class="">https://ffmpeg.org/mailman/listinfo/libav-user<br class=""><br class="">To unsubscribe, visit link above, or email<br class="">libav-user-request@ffmpeg.org with subject "unsubscribeā€¯.<br class=""></div></blockquote></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Hello Jake,</div><div class=""><br class=""></div><div class="">PTS is a time when frame is presented to you, while DTS is a time when AVPacket is decoded into a frame so other AVFrames (P/B) can possibly be reconstructed using information from that AVFrame. PTS cannot be less then DTS, but it can be the same. Packets cannot be presented before they are decoded. Its possible that DTS has a negative value, which makes no difference in decoding.</div><br class=""><div class="">But its not clear, at least for me, what exactly are you hoping to achieve by validating if they are correct or not, is there a specific player issue that you are experiencing? Players usually handle invalid PTS information by creating them using framerate of the video. Attempting to do this by yourself can be very tricky especially when you do it for days or months. For example it can introduce audio sync issues.</div><div class=""><br class=""></div><div class="">Kind regards,</div><div class="">Strahinja</div><div class=""><br class=""></div><div class=""><br class=""></div></body></html>