[Libav-user] How to calculate pts/dts ???

Paul B Mahol onemda at gmail.com
Mon Jan 2 11:35:51 EET 2023


On Thu, Dec 29, 2022 at 9:45 AM wolverin via Libav-user <
libav-user at ffmpeg.org> wrote:

> I'm transcoding live video from MJPEG to H264 using ffmpeg library in my
> C/C++ project
>
> Help me figure out how to calculate the pts/dts correctly, using various
> av_rescale* functions did not give the correct values and I tried my simple
> version, but the number of frames per second is different all the time and
> of course these values are approximate
>
> int64_t * pcnt
>
> pPktOut->pos = (*pcnt);
> pPktOut->pts = pPktOut->pos * pFmtCtxOut->streams[0]->time_base.den  /
> pCdcCtxOut->time_base.den;
>

This does not make any sense.

Time base is rational and thus both numerator and denumerator should be
used.


> pPktOut->dts = pPktOut->pts;
>
> (*pcnt)++;
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/libav-user
>
> To unsubscribe, visit link above, or email
> libav-user-request at ffmpeg.org with subject "unsubscribe".
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20230102/7364540f/attachment.htm>


More information about the Libav-user mailing list