<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">I have a process that generates video frames in real time. I’m muxing the generated video frames stream in a video file. </div><div class=""><br class=""></div><div class="">The frames are supposed to be generated at FPS, however, depending on the hardware capacity it might produce less than FPS.</div><div class=""><br class=""></div><div class="">When we start the video stream context we say:</div><div class=""><br class=""></div><div class="">
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><!--StartFragment--><span style="color: rgb(0, 196, 0);" class="">AVRational</span><span style="color: rgb(79, 79, 79);" class=""> </span>r<span style="color: rgb(79, 79, 79);" class=""> </span>=<span style="color: rgb(79, 79, 79);" class=""> </span>{<span style="color: rgb(79, 79, 79);" class=""> </span><span style="color: rgb(229, 16, 229);" class="">1</span>,<span style="color: rgb(79, 79, 79);" class=""> </span>FPS<span style="color: rgb(79, 79, 79);" class=""> </span>};</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class="">ost->st->time_base<span style="color: rgb(79, 79, 79);" class=""> </span><span style="color: rgb(106, 106, 106);" class="">=</span><span style="color: rgb(79, 79, 79);" class=""> </span>r;<!--EndFragment--></pre><div class=""><br class=""></div></div><div class="">This specifies that the video is going to be at FPS but if less frames are fed, the playback will be faster because it will still reproduce at FPS. </div><div class=""><br class=""></div><div class="">This is also a problem if we want to add audio to the stream and get it in sync with the video.</div><div class=""><br class=""></div><div class=""><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class="">I’m sure this is a common problem. </span>I wonder what strategies are used to workaround this cases?</div><div class=""><br class=""></div><div class="">Thank you!</div><div class=""><br class=""></div><div class="">Best regards,</div><div class=""><br class=""></div><div class="">Nuno</div><div class=""><br class=""></div><div class=""><br class=""></div></body></html>