<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 29, 2022 at 9:45 AM wolverin via Libav-user <<a href="mailto:libav-user@ffmpeg.org">libav-user@ffmpeg.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div><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></div></div></blockquote><div><br></div><div>This does not make any sense.</div><div><br></div><div>Time base is rational and thus both numerator and denumerator should be used.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><div><div>pPktOut->dts = pPktOut->pts;</div></div><div> </div><div><div>(*pcnt)++;</div></div></div></div>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".<br>
</blockquote></div></div>