Number of threads used by ffmeg configurable
This commit is contained in:
@@ -20,6 +20,8 @@ video_t video {
|
|||||||
24, // gop_size
|
24, // gop_size
|
||||||
35, // crf
|
35, // crf
|
||||||
|
|
||||||
|
4, // threads
|
||||||
|
|
||||||
"baseline"s, // profile
|
"baseline"s, // profile
|
||||||
"superfast"s, // preset
|
"superfast"s, // preset
|
||||||
"zerolatency"s // tune
|
"zerolatency"s // tune
|
||||||
@@ -118,6 +120,7 @@ void parse_file(const char *file) {
|
|||||||
int_f(vars, "max_b_frames", video.max_b_frames);
|
int_f(vars, "max_b_frames", video.max_b_frames);
|
||||||
int_f(vars, "gop_size", video.gop_size);
|
int_f(vars, "gop_size", video.gop_size);
|
||||||
int_f(vars, "crf", video.crf);
|
int_f(vars, "crf", video.crf);
|
||||||
|
int_f(vars, "threads", video.threads);
|
||||||
string_f(vars, "profile", video.profile);
|
string_f(vars, "profile", video.profile);
|
||||||
string_f(vars, "preset", video.preset);
|
string_f(vars, "preset", video.preset);
|
||||||
string_f(vars, "tune", video.tune);
|
string_f(vars, "tune", video.tune);
|
||||||
|
|||||||
2
config.h
2
config.h
@@ -11,6 +11,8 @@ struct video_t {
|
|||||||
int gop_size;
|
int gop_size;
|
||||||
int crf; // higher == more compression and less quality
|
int crf; // higher == more compression and less quality
|
||||||
|
|
||||||
|
int threads; // Number threads used by ffmpeg
|
||||||
|
|
||||||
std::string profile;
|
std::string profile;
|
||||||
std::string preset;
|
std::string preset;
|
||||||
std::string tune;
|
std::string tune;
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ gop_size = 24
|
|||||||
# Higher value means more compression, but less quality
|
# Higher value means more compression, but less quality
|
||||||
crf = 28
|
crf = 28
|
||||||
|
|
||||||
|
# Number of threads used by ffmpeg to encode the video
|
||||||
|
# threads = 4
|
||||||
|
|
||||||
|
|
||||||
# See x264 --fullhelp for the different presets
|
# See x264 --fullhelp for the different presets
|
||||||
# profile = baseline
|
# profile = baseline
|
||||||
# preset = superfast
|
# preset = superfast
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ void encodeThread(
|
|||||||
|
|
||||||
ctx->slices = config.slicesPerFrame;
|
ctx->slices = config.slicesPerFrame;
|
||||||
ctx->thread_type = FF_THREAD_SLICE;
|
ctx->thread_type = FF_THREAD_SLICE;
|
||||||
ctx->thread_count = std::min(config.slicesPerFrame, 4);
|
ctx->thread_count = config::video.threads;
|
||||||
|
|
||||||
|
|
||||||
AVDictionary *options {nullptr};
|
AVDictionary *options {nullptr};
|
||||||
|
|||||||
Reference in New Issue
Block a user