Skip to content

Commit

Permalink
Use zero-delay encode for nvenc.
Browse files Browse the repository at this point in the history
  • Loading branch information
Themaister committed Oct 22, 2023
1 parent f8fc916 commit 41db628
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions video/ffmpeg_encode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,7 @@ bool VideoEncoder::Impl::init_video_codec()
AVDictionary *opts = nullptr;

bool is_x264 = strcmp(options.encoder, "libx264") == 0;
bool is_nvenc = strstr(options.encoder, "nvenc") != nullptr;

if (options.realtime || !is_x264)
{
Expand All @@ -878,6 +879,11 @@ bool VideoEncoder::Impl::init_video_codec()
if (options.realtime_options.threads)
av_dict_set_int(&opts, "threads", options.realtime_options.threads, 0);
}
else if (is_nvenc)
{
// Codec delay. We want blocking realtime.
av_dict_set_int(&opts, "delay", 0, 0);
}
}
else
{
Expand Down

0 comments on commit 41db628

Please sign in to comment.