On Mon, Aug 21, 2023 at 10:30 AM Denis Gottardello <[email protected]>
wrote:
>
> 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?
>
If you really want to do it that way you need to use floating point
calculations, or use fixed point arithmetic (av_rescale*)
to convert seconds to microseconds.
>
> Best regards.
>
>
> --
>
> +39.347.4070897
>
> http://www.labcsp.com
>
> http://www.denisgottardello.it
>
> GMT+1
>
> Skype: mrdebug
> _______________________________________________
> Libav-user mailing list
> [email protected]
> https://ffmpeg.org/mailman/listinfo/libav-user
>
> To unsubscribe, visit link above, or email
> [email protected] with subject "unsubscribe".
>
_______________________________________________
Libav-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/libav-user
To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".