Skip to content

Commit 6711c9c

Browse files
committed
Minor improvements
1 parent f63c1e0 commit 6711c9c

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/FFmpegWriter.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -463,16 +463,13 @@ void FFmpegWriter::SetOption(StreamType stream, std::string name, std::string va
463463
c->bit_rate = 0;
464464
av_opt_set_int(c->priv_data, "crf", std::min(std::stoi(value),63), 0);
465465
if (strstr(info.vcodec.c_str(), "svt_av1") != NULL) {
466-
//av_opt_set_int(c->priv_data, "qp", std::min(std::stoi(value),63), 0);
467466
av_opt_set_int(c->priv_data, "preset", 6, 0);
468467
av_opt_set_int(c->priv_data, "forced-idr",1,0);
469468
}
470469
if (strstr(info.vcodec.c_str(), "rav1e") != NULL) {
471-
//av_opt_set_int(c->priv_data, "qp", std::min(std::stoi(value),255), 0);
472470
av_opt_set_int(c->priv_data, "speed", 7, 0);
473471
av_opt_set_int(c->priv_data, "tile-rows", 2, 0);
474472
av_opt_set_int(c->priv_data, "tile-columns", 4, 0);
475-
//av_opt_set(c->priv_data, "tile-row", "", 0);
476473
}
477474
break;
478475
#endif
@@ -524,25 +521,30 @@ void FFmpegWriter::SetOption(StreamType stream, std::string name, std::string va
524521
switch (c->codec_id) {
525522
case AV_CODEC_ID_AV1 :
526523
c->bit_rate = 0;
527-
av_opt_set_int(c->priv_data, "qp", std::min(std::stoi(value),63), 0);
528524
if (strstr(info.vcodec.c_str(), "svt_av1") != NULL) {
529525
av_opt_set_int(c->priv_data, "qp", std::min(std::stoi(value),63), 0);
530526
av_opt_set_int(c->priv_data, "preset", 6, 0);
531527
av_opt_set_int(c->priv_data, "forced-idr",1,0);
532528
}
533-
if (strstr(info.vcodec.c_str(), "rav1e") != NULL) {
529+
else if (strstr(info.vcodec.c_str(), "rav1e") != NULL) {
530+
// Set number of tiles to a fixed value
531+
// TODO Let user choose number of tiles
534532
av_opt_set_int(c->priv_data, "qp", std::min(std::stoi(value),255), 0);
535533
av_opt_set_int(c->priv_data, "speed", 7, 0);
536-
av_opt_set_int(c->priv_data, "tile-rows", 2, 0);
537-
av_opt_set_int(c->priv_data, "tile-columns", 4, 0);
538-
//av_opt_set(c->priv_data, "tile-row", "", 0);
534+
av_opt_set_int(c->priv_data, "tile-rows", 2, 0); // number of rows
535+
av_opt_set_int(c->priv_data, "tile-columns", 4, 0); // number of columns
539536
}
540-
if (strstr(info.vcodec.c_str(), "aom") != NULL) {
541-
// Hack to set tiles; libaom doesn have qp only crf
537+
else if (strstr(info.vcodec.c_str(), "aom") != NULL) {
538+
// Set number of tiles to a fixed value
539+
// TODO Let user choose number of tiles
540+
// libaom doesn't have qp only crf
542541
av_opt_set_int(c->priv_data, "crf", std::min(std::stoi(value),63), 0);
543542
av_opt_set_int(c->priv_data, "tile-rows", 1, 0); // log2 of number of rows
544543
av_opt_set_int(c->priv_data, "tile-columns", 2, 0); // log2 of number of columns
545544
}
545+
else {
546+
av_opt_set_int(c->priv_data, "crf", std::min(std::stoi(value),63), 0);
547+
}
546548
break;
547549
}
548550
#endif

0 commit comments

Comments
 (0)