[Libav-user] What decoding/encoding function return value mean I need to flush?

DeHackEd git at dehacked.net
Sun Sep 25 18:57:37 EEST 2016

On 09/24/2016 09:40 PM, M N wrote:
> What error code for the 4 functions: avcodec_send_packet, avcodec_receive_frame, avcodec_send_frame, avcodec_receive_packet, means I should flush (End of stream situation)? And can someone put a simple example to show us how flushing is done?

Flushing is an action done by you. When your video encoding/decoding job is done (you're at the end of the input) you
begin flushing.

Many codecs will read multiple AVFrames before they begin outputting AVPackets (or vice versa for decoders) for bitrate
calculation, out-of-order processing or other reasons. When you're finished with your video you flush the codec by
sending it a NULL AVFrame/Packet in which case all the buffered AVPacket/AVFrames you expect to receive will come out.

Maybe you mean the error code AVERROR(EAGAIN) which means that you've either over-filled the input or over-drained the
output. In over-filled input situation your input was not actually processed. See documentation in libavcodec/avcodec.h

> Thanks in advance!
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user

More information about the Libav-user mailing list