export: allow users to override the thread count

This commit is contained in:
itsmattkc
2020-04-30 17:19:43 +10:00
parent aecfa842c3
commit ce42388d68
10 changed files with 141 additions and 15 deletions
+9 -1
View File
@@ -468,7 +468,15 @@ bool FFmpegEncoder::SetupCodecContext(AVStream* stream, AVCodecContext* codec_ct
}
AVDictionary* codec_opts = nullptr;
av_dict_set(&codec_opts, "threads", "auto", 0);
// Set thread count
if (params().video_threads() == 0) {
av_dict_set(&codec_opts, "threads", "auto", 0);
} else {
char thread_val[10];
sprintf_s(thread_val, 10, "%d", params().video_threads());
av_dict_set(&codec_opts, "threads", thread_val, 0);
}
// Try to open encoder
error_code = avcodec_open2(codec_ctx, codec, &codec_opts);