diff --git a/libavformat/mux.c b/libavformat/mux.c index 29ab3f5dc2..1153ab69a8 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -508,6 +508,8 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt) if (!pkt) { if (s->oformat->flags & AVFMT_ALLOW_FLUSH) { ret = s->oformat->write_packet(s, NULL); + if (s->flush_packets && s->pb && s->pb->error >= 0) + avio_flush(s->pb); if (ret >= 0 && s->pb && s->pb->error < 0) ret = s->pb->error; return ret;