<div dir="ltr">I'm a bit confused with decoding/encoding api. I've read <a href="https://ffmpeg.org/doxygen/3.1/group__lavc__encdec.html">this</a> documentation and it says "<span style="font-family:roboto,sans-serif;font-size:14px;line-height:22px">Receive output in a loop. Periodically call one of the avcodec_receive_*()...</span>". <div><br></div><div>avcodec_receive_frame() docs say "<span style="font-family:roboto,sans-serif;font-size:14px;line-height:22px">the function will always call av_frame_unref(frame) before doing anything else." The same goes for </span><span style="line-height:1.5">avcodec_receive_packet(). </span></div><div><br></div><div>So, for example, I will write such code:</div><div><br></div><div>AVCodecContext *codecContext;</div><div>AVPacket *packet;</div><div>AVFrame *frame;</div><div>// allocating codec context, getting packet</div><div>.................................</div><div>//</div><div><div>avcodec_send_packet(codecContext, packet);</div><div>while(avcodec_receive_frame(codecContext, frame) == 0)</div></div><div>{</div><div>}</div><div><br></div><div>Will this code be functioning right? </div></div>