diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index 1757dccf24..454da98680 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -1649,6 +1649,10 @@ static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const ch else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && !ost->stream_copy) choose_pixel_fmt(st, st->codec, codec, st->codec->pix_fmt); avcodec_copy_context(ost->enc_ctx, st->codec); + if (ost->enc_ctx->priv_data) { + av_opt_free(ost->enc_ctx->priv_data); + av_freep(&ost->enc_ctx->priv_data); + } } avformat_close_input(&ic);