<div dir="ltr"><div dir="ltr">On Wed, May 11, 2022 at 6:24 AM Aleksei Komarov <<a href="mailto:abkomarov@gmail.com">abkomarov@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div>I'm encoding VFR frame sequence to Constant Frame Rate output stream (in real-time)</div><div>E.g. to maintain 60 fps I have to DUPLICATE frames from 30 fps stream (or any VFR video streams).<br>To do this I`m copying the same frame binary data and feed it to avcodec_receive_packet() once again. (It works but is not optimal)<br>What is the proper way to tell the encoder that the new frame is the same as the last one besides timestamp data (PTS/DTS). In other words how to duplicate last frame in the stream without reencoding the frame again?<br></div><div>I've seen  this type of video ( generated by OBS ) where MANY frames were really duplicated, where pkt_size=48 or lower! <br></div></div></blockquote><div><br></div>I'm just shooting in the dark, but what if you don't focus on the AVFrame data but on saving a copy of the AVPacket of the previous frame after it is encoded? In that way, you could avoid calling the whole encoding process again. Just guessing.<br clear="all"></div><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>--<br>  Gustav Gonzalez<br>  <a href="mailto:xtingray@gmail.com" target="_blank">xtingray@gmail.com</a><br><br></div></div></div></div>