Force avcodec_receive_packet to return packet

Viewed 139

There are related answers but they do not answer my question. I am encoding intra only mpeg1video using FFmpeg api and I would like to get packets out of the encoder without delay starting from the very first frame, but I get AVERROR(EAGAIN) from avcodec_receive_packet. I read this:

At the beginning of decoding or encoding, the codec might accept multiple input frames/packets without returning a frame, until its internal buffers are filled

Is there a way to remedy this e.g. may be by changing internal buffer size ?

1 Answers

With libx264 encoder, try setting small value for rc-lookahead, keyint/min-keyint or vbv-bufsize. Eg: setting rc-lookahead=5 to make encoder to expect only 5 frames before outputting the first encoded packet. Note that this might increase encoded packet's size.

Hope you find similar options with mpeg1video encoder.

Related