[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
Sun Sep 5 21:55:28 EEST 2021


Alex,

Thanks for your reply. 

I’m still puzzled how to do this.

I’ve just tried to do this in the get_video_frame of muxing.c example

ost->frame->pkt_dts = av_rescale_q(timestamp, AVRational{1, 1000}, ost->st->time_base);
ost->frame->pts = ost->frame->pkt_dts;

But the program crashes even more quickly:

[mp4 @ 0x7fc9a6242600] pts (817920) < dts (841472) in stream 0


There is another place in the muxing.c example that uses a rescale function, av_packet_rescale_ts actually, on the write_frame function. But this function is used for both video and audio frames writing. Since the problem with frame producing is only for video, I would say that the rescale must be on the video side only, so it kind makes sense doing this adjustment on the get_video_frame function.

Any tips? 

Thanks!

Regards,

Nuno

> On 2 Sep 2021, at 22:06, Alexandr Kasyan <a.kasyan at ntechlab.com> wrote:
> 
> Nuno, 
> 
> I was too wordy. Assign dts, make dts = pts, they come together in the case.
> Is it getting better or do you still need a better way to calculate pts?
> 
> 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".



More information about the Libav-user mailing list