export: allow users to override the thread count
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user