diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 8fa1c3e370..1be4e55683 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -1192,7 +1192,8 @@ static int mpegts_write_end(AVFormatContext *s) MpegTSService *service; int i; - mpegts_write_flush(s); + if (s->pb) + mpegts_write_flush(s); for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i];