On Thu, Dec 29, 2022 at 9:45 AM wolverin via Libav-user <
[email protected]> 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
> [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".

Reply via email to