[Libav-user] avcodec_receive_packet output for every input frame

Henri Zikken zikken at xs4all.nl
Thu Apr 5 12:57:51 EEST 2018

You can’t change this. The encoder needs to start it’s encoding and it needs input for this. However, 58 frames seems like a lot.


You can try this:


av_opt_set(context->priv_data, "tune", "zerolatency", 0);


to see if this improves the situation.


Also take a look at this:









Van: Libav-user <libav-user-bounces at ffmpeg.org> Namens Vittalprasad
Verzonden: donderdag 5 april 2018 11:03
Aan: libav-user at ffmpeg.org
Onderwerp: [Libav-user] avcodec_receive_packet output for every input frame


At the beginning of encoding, the H264 Encoder is accepting multiple input frames without returning a encoded stream, in my case it is accepting  58 input frames.

what changes are required  at encoder side to get output frame for every input frame, i.e o/p frame for i/p frame iteration?

below is encoder code.

ret = avcodec_send_frame(c_enc, frame);

        if (ret < 0)


                fprintf(stderr, "Error sending a frame for encoding\n");



 while (1) {

 ret = avcodec_receive_packet(c_enc, pkt);

        if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)



     ///dump encoded packet in to file



Thanks & Regards
Vittal Prasad B R

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20180405/b4390e11/attachment.html>

More information about the Libav-user mailing list