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

wolverin wolverin82 at mail.ru
Thu Dec 29 10:45:37 EET 2022


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;
pPktOut->dts = pPktOut->pts;
 
(*pcnt)++;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20221229/8af2e39a/attachment.htm>


More information about the Libav-user mailing list