[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 20:32:48 EEST 2021


Alex,

Sorry, still lost.

I’m trying to tackle this problem because I’m experiencing it. I know that depending on the computer specs and other factors, the rendering engine is producing less frames than the desired because I have a frame rate counter.

Please take into account that while Im referring to specific lines of muxing.c I have already a program based on muxing.c that is receiving the produced frames and muxing them. I’ve based myself on the muxing.c example and the modifications were very little.

This is the first time I’m actually trying to change pts value.

My modifications were on the equivalent to line 331 -> https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/muxing.c#L331 <https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/muxing.c#L331>

However, there is also a rescale at line 107 -> https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/muxing.c#L107 <https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/muxing.c#L107>

I’m not assigning dts myself. 

Does anyone know an example that shows how to tackle this problem?

Thanks!

Nuno

> On 2 Sep 2021, at 18:18, Alexandr Kasyan <a.kasyan at ntechlab.com> wrote:
> 
> Nuno, 
> 
> 1. When you are muxing a stream you already have some options -- either the pts is correct for packets or timestamp is being sent in some way, thus the formula.
> 2. The crash is because you did not set DTS properly, assign it the same value))
> 3. DTS already contains something and more to say, you are using the muxing.c example. What makes you think fps is going to produce the wrong playing speed? Have you tested the output? Maybe everything works without pts changing? (Asking 'coz you are very likely to modify the example for the purpose)
> 4. For the file to be correct you are very likely supposed to shift PTS so that it starts from zero. Don't remember if you extract it or set the start. Experiment with AVStream->start_time and pts/dts so that the resulting file plays and navigates (!! check it) correctly in VLC or MPC HC.
> 
> 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/98a2c26d/attachment.htm>


More information about the Libav-user mailing list