[Libav-user] AVFrame pts and av_usleep funciton.

Denis Gottardello info at denisgottardello.it
Mon Aug 21 11:30:01 EEST 2023


In order to implement a sleep function and wait the right time to display a frame I have written this code:

int framerate= pAVCodecContextVideo->framerate.num / pAVCodecContextVideo->framerate.den;
if (previous!= 0) {
    av_usleep((pAVFrame->pts - previous) / framerate);
}
previous= pAVFrame->pts;

but the value passed to av_usleep() is wrong.
How have I to calculate it?

Best regards.


-- 
+39.347.4070897
http://www.labcsp.com[1] 
http://www.denisgottardello.it[2] 
GMT+1
Skype: mrdebug

--------
[1] http://www.labcsp.com
[2] http://www.denisgottardello.it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20230821/27a4dfaf/attachment.htm>


More information about the Libav-user mailing list