[Libav-user] Force avcodec_receive_packet to return packet

Anton Bilan bilananton at gmail.com
Sat Feb 20 09:58:52 EET 2021


Hello,

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 ?

I have read about avcodec_flush_buffers but alas mpeg1video encoder does
not have AV_CODEC_CAP_ENCODER_FLUSH.

If there is no either way what would be better: to send null frame to the
encoder and recreate context each frame or to send the same frame twice and
then discard it ?

Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20210220/68a56c8b/attachment.html>


More information about the Libav-user mailing list