141 ui(new
Ui::VideoExportOptionsDialog),
142 m_d(new
Private(containerType, validEncoders))
146 ui->intOpenH264bitrate->setRange(100, 10000);
147 ui->intOpenH264bitrate->setValue(5000);
148 ui->intOpenH264bitrate->setSuffix(i18nc(
"kilo-bits-per-second, video bitrate suffix",
"kbps"));
150 ui->intCRFH264->setRange(0, 51);
151 ui->intCRFH264->setValue(28);
153 ui->intCRFH265->setRange(0, 51);
154 ui->intCRFH265->setValue(28);
165 ui->intBitrate->setRange(10, 50000);
166 ui->intBitrate->setValue(5000);
167 ui->intBitrate->setSuffix(i18nc(
"kilo-bits-per-second, video bitrate suffix",
"kbps"));
171 ui->vp9PreserveTransparency->setEnabled(containerType ==
WEBM || containerType ==
MKV);
173 ui->gifReserveTransparent->setChecked(
true);
174 ui->gifLoop->setChecked(
true);
175 ui->gifTransDiff->setChecked(
true);
181 ui->intPaletteuseBayerScaleGIF->setRange(0, 5);
182 ui->intPaletteuseBayerScaleGIF->setValue(2);
184 ui->apngLoop->setChecked(
true);
188 ui->intCompressWEBP->setRange(0, 6);
189 ui->intCompressWEBP->setValue(4);
191 ui->intQscaleWEBP->setRange(0, 100);
192 ui->intQscaleWEBP->setValue(75);
196 ui->webpLoop->setChecked(
true);
205 ui->cmbTuneH264->setVisible(
false);
206 ui->lblTuneH264->setVisible(
false);
208 ui->cmbTuneH265->setVisible(
false);
209 ui->lblTuneH265->setVisible(
false);
216 connect(
ui->cmbProfileH265,
217 SIGNAL(currentIndexChanged(
int)),
222 connect(
ui->cmbPaletteuseDitherGIF,
223 SIGNAL(currentIndexChanged(
int)),
229 m_d->hdrMetadataOptions = hdrOptions;
249 cfg->setProperty(
"Openh264Bitrate",
ui->intOpenH264bitrate->value());
251 cfg->setProperty(
"h264PresetIndex",
ui->cmbPresetH264->currentIndex());
252 cfg->setProperty(
"h264ConstantRateFactor",
ui->intCRFH264->value());
253 cfg->setProperty(
"h264ProfileIndex",
ui->cmbProfileH264->currentIndex());
254 cfg->setProperty(
"h264TuneIndex",
ui->cmbTuneH264->currentIndex());
256 cfg->setProperty(
"h265PresetIndex",
ui->cmbPresetH265->currentIndex());
257 cfg->setProperty(
"h265ConstantRateFactor",
ui->intCRFH265->value());
258 cfg->setProperty(
"h265ProfileIndex",
ui->cmbProfileH265->currentIndex());
259 cfg->setProperty(
"h265TuneIndex",
ui->cmbTuneH265->currentIndex());
260 cfg->setProperty(
"h265UseHDRMetadata",
ui->chkUseHDRMetadata->isChecked());
262 cfg->setProperty(
"TheoraBitrate",
ui->intBitrate->value());
263 cfg->setProperty(
"vp9PreserveTransparency",
ui->vp9PreserveTransparency->isChecked());
264 cfg->setProperty(
"vp9Lossless",
ui->vp9Lossless->isChecked());
265 cfg->setProperty(
"vp9Mbits",
ui->vp9Mbits->value());
266 cfg->setProperty(
"CustomLineValue",
ui->txtCustomLine->text());
269 cfg->setPrefixedProperties(
"hdrMetadata/",
m_d->hdrMetadataOptions.toProperties());
364 const QString codec =
m_d->encoders[index].id();
365 if (codec ==
"libopenh264") {
367 }
else if (codec ==
"libx264") {
369 }
else if (codec ==
"libx265") {
371 }
else if (codec ==
"libtheora") {
373 }
else if (codec ==
"libvpx-vp9") {
375 }
else if (codec ==
"gif") {
377 }
else if (codec ==
"apng") {
379 }
else if (codec ==
"libwebp") {
381 }
else if (codec ==
"prores_ks") {
437 ui->intOpenH264bitrate->setValue(cfg->getInt(
"Openh264Bitrate", 5000));
439 ui->cmbPresetH264->setCurrentIndex(cfg->getInt(
"h264PresetIndex", 5));
440 ui->intCRFH264->setValue(cfg->getInt(
"h264ConstantRateFactor", 23));
441 ui->cmbProfileH264->setCurrentIndex(cfg->getInt(
"h264ProfileIndex", 0));
442 ui->cmbTuneH264->setCurrentIndex(cfg->getInt(
"h264TuneIndex", 1));
444 ui->cmbPresetH265->setCurrentIndex(cfg->getInt(
"h265PresetIndex", 5));
445 ui->intCRFH265->setValue(cfg->getInt(
"h265ConstantRateFactor", 23));
446 ui->cmbProfileH265->setCurrentIndex(cfg->getInt(
"h265ProfileIndex", 0));
447 ui->cmbTuneH265->setCurrentIndex(cfg->getInt(
"h265TuneIndex", 1));
448 ui->chkUseHDRMetadata->setChecked(cfg->getBool(
"h265UseHDRMetadata",
false));
450 ui->intBitrate->setValue(cfg->getInt(
"TheoraBitrate", 5000));
451 ui->vp9PreserveTransparency->setChecked(cfg->getBool(
"vp9PreserveTransparency",
false));
452 ui->vp9Lossless->setChecked(cfg->getBool(
"vp9Lossless",
false));
453 ui->vp9Mbits->setValue(cfg->getInt(
"vp9Mbits", 2));
455 m_d->currentCustomLine = cfg->getString(
"CustomLineValue", QString());
456 ui->chkCustomLine->setChecked(!
m_d->currentCustomLine.isEmpty());
459 const QString codecId = cfg->getString(
"CodecId",
"");
462 ui->cmbCodec->setCurrentIndex(index);
473 options <<
"-c:v" <<
"libopenh264";
474 options <<
"-b:v" << QString::number(
ui->intOpenH264bitrate->value()) +
"k";
476 options <<
"-crf" << QString::number(
ui->intCRFH264->value());
478 const int presetIndex =
ui->cmbPresetH264->currentIndex();
479 options <<
"-preset" <<
m_d->presetsXH264[presetIndex].id();
481 const int profileIndex =
ui->cmbProfileH264->currentIndex();
482 options <<
"-profile:v" <<
m_d->profilesXH264[profileIndex].id();
484 if (
m_d->profilesXH264[profileIndex].id() ==
"high422") {
485 options <<
"-pix_fmt" <<
"yuv422p";
486 }
else if (
m_d->profilesXH264[profileIndex].id() ==
"high444") {
487 options <<
"-pix_fmt" <<
"yuv444p";
489 options <<
"-pix_fmt" <<
"yuv420p";
497 const bool enableHDR =
498 ui->chkUseHDRMetadata->isEnabled() &&
499 ui->chkUseHDRMetadata->isChecked();
502 options <<
"-colorspace" <<
"bt2020nc"
503 <<
"-color_trc" <<
"smpte2084"
504 <<
"-color_primaries" <<
"bt2020";
507 options <<
"-c:v" <<
"libx265";
508 options <<
"-crf" << QString::number(
ui->intCRFH265->value());
510 const int presetIndex =
ui->cmbPresetH265->currentIndex();
511 options <<
"-preset" <<
m_d->presetsXH264[presetIndex].id();
513 const int profileIndex =
ui->cmbProfileH265->currentIndex();
514 options <<
"-profile:v" <<
m_d->profilesXH265[profileIndex].id();
516 if (
m_d->profilesXH265[profileIndex].id() ==
"main") {
517 options <<
"-pix_fmt" <<
"yuv420p";
518 }
else if (
m_d->profilesXH265[profileIndex].id() ==
"main10") {
519 options <<
"-pix_fmt" <<
"yuv420p10le";
525 const QString metadataLine =
m_d->hdrMetadataOptions.generateFFMpegOptions();
526 options << metadataLine.split(
" ");
530 options <<
"-b" << QString::number(
ui->intBitrate->value()) +
"k";
532 options <<
"-c:v" <<
"prores_ks"
533 <<
"-profile:v" <<
"4"
534 <<
"-pix_fmt" <<
"yuva444p10le";
537 const bool preserveTransparency = (
m_d->containerType ==
WEBM ||
m_d->containerType ==
MKV)
538 &&
ui->vp9PreserveTransparency->isChecked();
539 options <<
"-pix_fmt" << (preserveTransparency ?
"yuva420p" :
"yuv420p");
540 if (
ui->vp9Lossless->isChecked()) {
541 options <<
"-lossless" <<
"1";
543 options <<
"-b:v" << QString::number(
ui->vp9Mbits->value()) +
"M";
546 const QString ditherFilterString =
m_d->paletteDitherGIF[
ui->cmbPaletteuseDitherGIF->currentIndex() ].id();
548 options <<
"-f" <<
"gif"
549 <<
"-loop" << (
ui->gifLoop->isChecked() ?
"0":
"-1" )
550 <<
"-gifflags" << (
ui->gifTransDiff->isChecked() ?
"+transdiff":
"-transdiff" )
551 <<
"-palettegen" << QString(
"palettegen=stats_mode=%1%2")
552 .arg(
m_d->paletteGenModeGIF[
ui->cmbPalettegenStatsModeGIF->currentIndex() ].id())
553 .arg(
":reserve_transparent=" + QString(
ui->gifReserveTransparent->isChecked() ?
"1":
"0"))
554 <<
"-lavfi" << QString(
"[0:v][1:v]paletteuse=dither=%1%2%3")
555 .arg(ditherFilterString)
556 .arg(ditherFilterString ==
"bayer" ? (QString(
":bayer_scale=%1").arg(
ui->intPaletteuseBayerScaleGIF->value()) ):
"" )
557 .arg(
":diff_mode=" +
m_d->paletteDiffModeGIF[
ui->cmbPaletteuseDiffModeGIF->currentIndex() ].id() );
560 const int predIndex =
ui->cmbPredAPNG->currentIndex();
562 options <<
"-f" <<
"apng"
563 <<
"-pred" <<
m_d->predAPNG[predIndex].id()
564 <<
"-plays" << (
ui->apngLoop->isChecked() ?
"0":
"1" );
567 const int presetIndex =
ui->cmbPresetWEBP->currentIndex();
569 options <<
"-f" <<
"webp"
570 <<
"-lossless" << (
ui->webpLossless->isChecked() ?
"1":
"0" )
571 <<
"-compression_level" << QString::number(
ui->intCompressWEBP->value())
572 <<
"-q:v" << QString::number(
ui->intQscaleWEBP->value())
573 <<
"-preset" <<
m_d->presetsWEBP[presetIndex].id()
574 <<
"-loop" << (
ui->webpLoop->isChecked() ?
"0":
"1" );