Skip to content

Commit

Permalink
vcompress/lavc SVT: preset for HEVC > UHD@60
Browse files Browse the repository at this point in the history
The SVT HEVC compression has (for UG) an ugly feature that it caches
internally in some cases a huge amount of frames, leading to increased
latency and also memory consumption. The first problem is dealt with
at least with the warning (commit e3f64d5, 2024-04-12).

if running
`uv -t testcard:c=RG48:s=3840x2160:fps=240 -c lavc:enc=libsvt_hevc`
with default preset (7) the latency grew up to some 430 frames, triggering
the assertion in store_metadata().

Setting the preset (for the above command - it is size/FPS depending)
to 11 shrinks the amount of frames cached to some 40 frames, that seem
more acceptable.
  • Loading branch information
MartinPulec committed Apr 16, 2024
1 parent 0725294 commit 4fe23e9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/video_compress/libavcodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ using namespace std::string_literals;
namespace {
enum {
FLW_THRESH = 1920 * 1080 * 30, //< in px/sec
FLW_UHD_60 = 3840 * 2160 * 60,
HOUSEKEEP_INTERVAL = 100, //< for metadata_storage
};

Expand Down Expand Up @@ -1871,6 +1872,10 @@ static void configure_svt(AVCodecContext *codec_ctx, struct setparam_param *para
check_av_opt_set<int>(codec_ctx->priv_data, "tile_slice_mode", 1);
check_av_opt_set<int>(codec_ctx->priv_data, "umv", 0);
}
if (param->desc.width * param->desc.height * param->desc.fps > FLW_UHD_60) {
check_av_opt_set<const char *>(codec_ctx->priv_data,
"preset", "11");
}
} else if ("libsvtav1"s == codec_ctx->codec->name) {
const char *preset =
param->desc.width * param->desc.height * param->desc.fps <=
Expand Down

0 comments on commit 4fe23e9

Please sign in to comment.