[Libav-user] How to handle video muxing to file when real frame rate varies from the specified frame rate

Nuno Santos nuno.santos at imaginando.pt
Thu Sep 2 19:05:19 EEST 2021


Thanks for your reply.

This means that if I have a recording elapsed timer, I could pass the timestamp at the current recording time to make this? Or do you seen any other better way of doing it?

Right now, the pts is being defined as:

ost->frame->pts = ost->next_pts++;

Has per muxing.c example



> On 2 Sep 2021, at 13:43, Alexandr Kasyan <a.kasyan at ntechlab.com> wrote:
> Hi, Nuno!
> Well, one of the possible approaches is -- set the proper pts for AVPacket-s you're muxing. 
> The basic formula is: 
> uint64_t pts = av_rescale_q(timestamp_ms, AVRational{1, 1000}, time_base);
> It's usually time or PTS that's specified for packets (and frame's time is usually derived from that), so most of the players take that into account when feeding frames for display. 
> You can check if your muxing is played at the wrong speed in the first place, then adjust PTS in code if needed.
> __________________________________________
> Regards, Alex
> _______________________________________________
> 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/20210902/ee325088/attachment.htm>

More information about the Libav-user mailing list