From f029fa483d7ebbf0d3d2bfbb2df42ffb864735ba Mon Sep 17 00:00:00 2001 From: Martin Piatka Date: Thu, 3 Mar 2022 16:06:12 +0100 Subject: [PATCH] lavc: x265: Enable constrained intra This greatly decreases the time needed for decoder to display clear image after dropped packets. Open GOP is already implicitly disabled by intra-refresh, disabling it explicitly just hides the warning. --- src/video_compress/libavcodec.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video_compress/libavcodec.cpp b/src/video_compress/libavcodec.cpp index cc714b74e..a06f77947 100644 --- a/src/video_compress/libavcodec.cpp +++ b/src/video_compress/libavcodec.cpp @@ -1740,7 +1740,7 @@ static void configure_x264_x265(AVCodecContext *codec_ctx, struct setparam_param if ("libx264"s == codec_ctx->codec->name || "libx264rgb"s == codec_ctx->codec->name) { ret = av_opt_set(codec_ctx->priv_data, "intra-refresh", "1", 0); } else if ("libx265"s == codec_ctx->codec->name) { - x265_params += ":intra-refresh=1"; + x265_params += ":intra-refresh=1:constrained-intra=1:no-open-gop=1"; ret = av_opt_set(codec_ctx->priv_data, "x265-params", x265_params.c_str(), 0); } if (ret != 0) {