<HTML><BODY><div>I'm transcoding live video from MJPEG to H264 using ffmpeg library in my C/C++ project</div><div> </div><div>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</div><div> </div><div>int64_t * pcnt</div><div> </div><div><div><div>pPktOut->pos = (*pcnt);</div><div>pPktOut->pts = pPktOut->pos * pFmtCtxOut->streams[0]->time_base.den  / pCdcCtxOut->time_base.den;</div><div>pPktOut->dts = pPktOut->pts;</div></div><div> </div><div><div>(*pcnt)++;</div></div></div></BODY></HTML>