<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="">Hi,<div class=""><br class=""></div><div class="">I’m still finding the solution to this problem.</div><div class=""><br class=""></div><div class="">I have tried to summarise the problem the best way I could in a stack overflow question, with code snippets:</div><div class=""><br class=""></div><div class=""><a href="https://stackoverflow.com/questions/69109263/how-to-compensate-frame-rate-underrun-while-muxing-video-to-mp4-container-with-l" class="">https://stackoverflow.com/questions/69109263/how-to-compensate-frame-rate-underrun-while-muxing-video-to-mp4-container-with-l</a></div><div class=""><br class=""></div><div class="">Lib-av is definitively a complex topic with a lot of background knowledge and history that we can’t simply catch up in a snap. </div><div class=""><br class=""></div><div class="">Thanks for your help and comprehension</div><div class=""><br class=""></div><div class="">Best regards,</div><div class=""><br class=""></div><div class="">Nuno<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 5 Sep 2021, at 19:55, Nuno Santos <<a href="mailto:nuno.santos@imaginando.pt" class="">nuno.santos@imaginando.pt</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Alex,<br class=""><br class="">Thanks for your reply. <br class=""><br class="">I’m still puzzled how to do this.<br class=""><br class="">I’ve just tried to do this in the get_video_frame of muxing.c example<br class=""><br class="">ost->frame->pkt_dts = av_rescale_q(timestamp, AVRational{1, 1000}, ost->st->time_base);<br class="">ost->frame->pts = ost->frame->pkt_dts;<br class=""><br class="">But the program crashes even more quickly:<br class=""><br class="">[mp4 @ 0x7fc9a6242600] pts (817920) < dts (841472) in stream 0<br class=""><br class=""><br class="">There is another place in the muxing.c example that uses a rescale function, av_packet_rescale_ts actually, on the write_frame function. But this function is used for both video and audio frames writing. Since the problem with frame producing is only for video, I would say that the rescale must be on the video side only, so it kind makes sense doing this adjustment on the get_video_frame function.<br class=""><br class="">Any tips? <br class=""><br class="">Thanks!<br class=""><br class="">Regards,<br class=""><br class="">Nuno<br class=""><br class=""><blockquote type="cite" class="">On 2 Sep 2021, at 22:06, Alexandr Kasyan <<a href="mailto:a.kasyan@ntechlab.com" class="">a.kasyan@ntechlab.com</a>> wrote:<br class=""><br class="">Nuno, <br class=""><br class="">I was too wordy. Assign dts, make dts = pts, they come together in the case.<br class="">Is it getting better or do you still need a better way to calculate pts?<br class=""><br class="">Regards, Alex<br class="">_______________________________________________<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=""></blockquote><br class=""></div></div></blockquote></div><br class=""></div></body></html>