[FFmpeg-devel] [PATCH] ffmpeg: flush_encoders should not treat avcodec_send_frame return AVERROR_EOF as fatal

Jason Stevens jay at wizardofthenet.com
Fri Oct 19 15:27:36 EEST 2018


this fixes AV_CODEC_CAP_DELAY encoders going into FATAL error and exiting on quit or finish encoding once they go into draining mode and send_frame() returns AVERROR_EOF

Signed-off-by: Jason Stevens <jay at wizardofthenet.com>
---
 fftools/ffmpeg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index da4259a9a8..f30ed946c0 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1939,7 +1939,7 @@ static void flush_encoders(void)
 
                 while ((ret = avcodec_receive_packet(enc, &pkt)) == AVERROR(EAGAIN)) {
                     ret = avcodec_send_frame(enc, NULL);
-                    if (ret < 0) {
+                    if (ret < 0 && ret != AVERROR_EOF) {
                         av_log(NULL, AV_LOG_FATAL, "%s encoding failed: %s\n",
                                desc,
                                av_err2str(ret));
-- 
2.19.1



More information about the ffmpeg-devel mailing list