Skip to content

Commit 63043e2

Browse files
committed
lavc: allow to set also nr of converion threads
1 parent 4c5cf6f commit 63043e2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/video_compress/libavcodec.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,8 @@ static void usage() {
393393
col() << "\t" << SBOLD("<crf>") << " specifies CRF factor (only for libx264/libx265)\n";
394394
col() << "\t" << SBOLD("<q>") << " quality (qmin, qmax) - range usually from 0 (best) to 50-100 (worst)\n";
395395
col() << "\t" << SBOLD("<subsampling") << "> may be one of 444, 422, or 420, default 420 for progresive, 422 for interlaced\n";
396-
col() << "\t" << SBOLD("<threads>") << " can be \"no\", or \"<number>[F][S][n]\" where 'F'/'S' indicate if frame/slice thr. should be used, both can be used (default slice), 'n' means none\n";
396+
col() << "\t" << SBOLD("<threads>") << " can be \"no\", or \"<number>[F][S][n]\" where 'F'/'S' indicate if frame/slice thr. should be used, both can be used (default slice), 'n' means none;\n";
397+
col() << "\t" << " " << " use a comma to add also number of conversion threads (eg. \"0S,8\"), default: number of logical cores\n";
397398
col() << "\t" << SBOLD("<slices>") << " number of slices to use (default: " << DEFAULT_SLICE_COUNT << ")\n";
398399
col() << "\t" << SBOLD("<gop>") << " specifies GOP size\n";
399400
col() << "\t" << SBOLD("<lavc_opt>") << " arbitrary option to be passed directly to libavcodec (eg. preset=veryfast), eventual colons must be backslash-escaped (eg. for x264opts)\n";
@@ -461,6 +462,10 @@ static int parse_fmt(struct state_video_compress_libav *s, char *fmt) {
461462
s->params.periodic_intra = strstr(item, "disable_") == item ? 0 : 1;
462463
} else if(strncasecmp("threads=", item, strlen("threads=")) == 0) {
463464
char *threads = item + strlen("threads=");
465+
if (strchr(threads, ',')) {
466+
s->conv_thread_count = stoi(strchr(threads, ',') + 1);
467+
*strchr(threads, ',') = '\0';
468+
}
464469
s->params.thread_mode = threads;
465470
} else if(strncasecmp("slices=", item, strlen("slices=")) == 0) {
466471
char *slices = strchr(item, '=') + 1;

0 commit comments

Comments
 (0)