diff --git a/app/dialog/export/codec/h264section.cpp b/app/dialog/export/codec/h264section.cpp index 732aef3461..7bf7bd0959 100644 --- a/app/dialog/export/codec/h264section.cpp +++ b/app/dialog/export/codec/h264section.cpp @@ -74,6 +74,7 @@ H264Section::H264Section(int default_crf, QWidget *parent) : // These items must correspond to the CompressionMethod enum compression_box->addItem(tr("Constant Rate Factor")); + compression_box->addItem(tr("Lossless")); compression_box->addItem(tr("Target Bit Rate")); compression_box->addItem(tr("Target File Size")); @@ -87,6 +88,9 @@ H264Section::H264Section(int default_crf, QWidget *parent) : crf_section_ = new H264CRFSection(default_crf); compression_method_stack_->addWidget(crf_section_); + lossless_section_ = new H264LosslessSection(); + compression_method_stack_->addWidget(lossless_section_); + bitrate_section_ = new H264BitRateSection(); compression_method_stack_->addWidget(bitrate_section_); @@ -114,6 +118,10 @@ void H264Section::AddOpts(EncodingParams *params) // Simply set CRF value params->set_video_option(QStringLiteral("crf"), QString::number(crf_section_->GetValue())); + } else if (method == kLossless) { + + params->set_video_option(QStringLiteral("qp"), QString::number(0)); + } else { int64_t target_rate, max_rate, min_rate; @@ -237,6 +245,17 @@ H264BitRateSection::H264BitRateSection(QWidget *parent) : max_rate_->SetValue(32.0); } +H264LosslessSection::H264LosslessSection(QWidget *parent) : + QWidget(parent) +{ + QGridLayout* layout = new QGridLayout(this); + layout->setMargin(0); + + int row = 0; + + layout->addWidget(new QLabel(tr("For true lossless, verify the pixel format before exporting")), row, 0); +} + int64_t H264BitRateSection::GetTargetBitRate() const { return qRound64(target_rate_->GetValue() * 1000000.0); diff --git a/app/dialog/export/codec/h264section.h b/app/dialog/export/codec/h264section.h index 9fd984ae51..677982a1bd 100644 --- a/app/dialog/export/codec/h264section.h +++ b/app/dialog/export/codec/h264section.h @@ -50,6 +50,13 @@ class H264CRFSection : public QWidget }; +class H264LosslessSection : public QWidget +{ + Q_OBJECT +public: + H264LosslessSection(QWidget* parent = nullptr); +}; + class H264BitRateSection : public QWidget { Q_OBJECT @@ -98,6 +105,7 @@ class H264Section : public CodecSection public: enum CompressionMethod { kConstantRateFactor, + kLossless, kTargetBitRate, kTargetFileSize }; @@ -114,6 +122,8 @@ class H264Section : public CodecSection H264CRFSection* crf_section_; + H264LosslessSection* lossless_section_; + H264BitRateSection* bitrate_section_; H264FileSizeSection* filesize_section_;