From 321116f6f578e0e36cf8e87803e6f16dfec8f1f5 Mon Sep 17 00:00:00 2001 From: Quackdoc <74831516+Quackdoc@users.noreply.github.com> Date: Thu, 3 Feb 2022 20:24:52 -0500 Subject: [PATCH 1/4] DNxHD gui reworked hopefully this should work with a clean history --- app/codec/exportformat.cpp | 2 +- app/dialog/export/codec/CMakeLists.txt | 2 + app/dialog/export/codec/dnxhdsection.cpp | 66 ++++++++++++++++++++++++ app/dialog/export/codec/dnxhdsection.h | 40 ++++++++++++++ app/dialog/export/exportvideotab.cpp | 6 +++ app/dialog/export/exportvideotab.h | 2 + 6 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 app/dialog/export/codec/dnxhdsection.cpp create mode 100644 app/dialog/export/codec/dnxhdsection.h diff --git a/app/codec/exportformat.cpp b/app/codec/exportformat.cpp index 59561d50b7..b5421f9366 100644 --- a/app/codec/exportformat.cpp +++ b/app/codec/exportformat.cpp @@ -117,7 +117,7 @@ QList ExportFormat::GetVideoCodecs(ExportFormat::Format f) case kFormatTIFF: return {ExportCodec::kCodecTIFF}; case kFormatQuickTime: - return {ExportCodec::kCodecH264, ExportCodec::kCodecH264rgb, ExportCodec::kCodecH265, ExportCodec::kCodecProRes, ExportCodec::kCodecCineform}; + return {ExportCodec::kCodecH264, ExportCodec::kCodecH264rgb, ExportCodec::kCodecH265, ExportCodec::kCodecProRes, ExportCodec::kCodecCineform, ExportCodec::kCodecDNxHD}; case kFormatWebM: return {ExportCodec::kCodecVP9}; case kFormatOgg: diff --git a/app/dialog/export/codec/CMakeLists.txt b/app/dialog/export/codec/CMakeLists.txt index 1669edd70e..a678d5a160 100644 --- a/app/dialog/export/codec/CMakeLists.txt +++ b/app/dialog/export/codec/CMakeLists.txt @@ -22,6 +22,8 @@ set(OLIVE_SOURCES dialog/export/codec/codecsection.h dialog/export/codec/codecstack.cpp dialog/export/codec/codecstack.h + dialog/export/codec/dnxhdsection.cpp + dialog/export/codec/dnxhdsection.h dialog/export/codec/h264section.cpp dialog/export/codec/h264section.h dialog/export/codec/imagesection.cpp diff --git a/app/dialog/export/codec/dnxhdsection.cpp b/app/dialog/export/codec/dnxhdsection.cpp new file mode 100644 index 0000000000..cf9a845521 --- /dev/null +++ b/app/dialog/export/codec/dnxhdsection.cpp @@ -0,0 +1,66 @@ +/*** + Olive - Non-Linear Video Editor + Copyright (C) 2021 Olive Team + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + You should have received a copy of the GNU General Public License + along with this program. If not, see . +***/ + +#include "dnxhdsection.h" + +#include +#include + +namespace olive { + +DNxHDSection::DNxHDSection(QWidget *parent) : + CodecSection(parent) +{ + QGridLayout *layout = new QGridLayout(this); + + layout->setMargin(0); + + int row = 0; + + layout->addWidget(new QLabel(tr("preset:")), row, 0); + + preset_combobox_ = new QComboBox(); + + /* Correspond to the following indexes for FFmpeg + * + *-profile E..V....... (from 0 to 5) (default dnxhd) + * dnxhd 0 E..V....... + * dnxhr_444 5 E..V....... + * dnxhr_hqx 4 E..V....... + * dnxhr_hq 3 E..V....... + * dnxhr_sq 2 E..V....... + * dnxhr_lb 1 E..V....... + * + */ + + preset_combobox_->addItem(tr("dnxhd")); + preset_combobox_->addItem(tr("dnxhr_lb")); + preset_combobox_->addItem(tr("dnxhr_sq")); + preset_combobox_->addItem(tr("dnxhr_hq")); + preset_combobox_->addItem(tr("dnxhr_hqx")); + preset_combobox_->addItem(tr("dnxhr_444")); + + //Default to "medium" + preset_combobox_->setCurrentIndex(3); + + layout->addWidget(preset_combobox_, row, 1); +} + +void DNxHDSection::AddOpts(EncodingParams *params) +{ + params->set_video_option(QStringLiteral("profile"), QString::number(preset_combobox_->currentIndex())); +} + +} diff --git a/app/dialog/export/codec/dnxhdsection.h b/app/dialog/export/codec/dnxhdsection.h new file mode 100644 index 0000000000..06ff69eb13 --- /dev/null +++ b/app/dialog/export/codec/dnxhdsection.h @@ -0,0 +1,40 @@ +/*** + Olive - Non-Linear Video Editor + Copyright (C) 2021 Olive Team + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + You should have received a copy of the GNU General Public License + along with this program. If not, see . +***/ + +#ifndef DNXHDSECTION_H +#define DNXHDSECTION_H + +#include + +#include "codecsection.h" + +namespace olive { + +class DNxHDSection : public CodecSection +{ + Q_OBJECT +public: + DNxHDSection(QWidget *parent = nullptr); + + virtual void AddOpts(EncodingParams* params) override; + +private: + QComboBox *preset_combobox_; + +}; + +} + +#endif // DNXHDSECTION_H diff --git a/app/dialog/export/exportvideotab.cpp b/app/dialog/export/exportvideotab.cpp index d99cc59b09..f8e60f261a 100644 --- a/app/dialog/export/exportvideotab.cpp +++ b/app/dialog/export/exportvideotab.cpp @@ -188,6 +188,9 @@ QWidget *ExportVideoTab::SetupCodecSection() cineform_section_ = new CineformSection(); codec_stack_->addWidget(cineform_section_); + dnxhd_section_ = new DNxHDSection(); + codec_stack_->addWidget(dnxhd_section_); + row++; QPushButton* advanced_btn = new QPushButton(tr("Advanced")); @@ -246,6 +249,9 @@ void ExportVideoTab::VideoCodecChanged() case ExportCodec::kCodecCineform: SetCodecSection(cineform_section_); break; + case ExportCodec::kCodecDNxHD: + SetCodecSection(dnxhd_section_); + break; default: SetCodecSection(ExportCodec::IsCodecAStillImage(codec) ? image_section_ : nullptr); } diff --git a/app/dialog/export/exportvideotab.h b/app/dialog/export/exportvideotab.h index 4a952fb15f..38e0f2eb7f 100644 --- a/app/dialog/export/exportvideotab.h +++ b/app/dialog/export/exportvideotab.h @@ -29,6 +29,7 @@ #include "dialog/export/codec/cineformsection.h" #include "dialog/export/codec/codecstack.h" #include "dialog/export/codec/h264section.h" +#include "dialog/export/codec/dnxhdsection.h" #include "dialog/export/codec/imagesection.h" #include "node/color/colormanager/colormanager.h" #include "widget/colorwheel/colorspacechooser.h" @@ -162,6 +163,7 @@ public slots: H264Section* h264_section_; H264Section* h265_section_; CineformSection *cineform_section_; + DNxHDSection *dnxhd_section_; ColorSpaceChooser* color_space_chooser_; From b158b808a8652fe1ecf5150a885b08b3c9818345 Mon Sep 17 00:00:00 2001 From: Quackdoc <74831516+Quackdoc@users.noreply.github.com> Date: Thu, 3 Feb 2022 22:38:27 -0500 Subject: [PATCH 2/4] mxf support --- app/codec/ffmpeg/ffmpegencoder.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/app/codec/ffmpeg/ffmpegencoder.cpp b/app/codec/ffmpeg/ffmpegencoder.cpp index 6be4e6d736..452ee19efd 100644 --- a/app/codec/ffmpeg/ffmpegencoder.cpp +++ b/app/codec/ffmpeg/ffmpegencoder.cpp @@ -721,6 +721,7 @@ bool FFmpegEncoder::SetupCodecContext(AVStream* stream, AVCodecContext* codec_ct if (codec->type == AVMEDIA_TYPE_VIDEO) { stream->avg_frame_rate = codec_ctx->framerate; + stream->time_base = av_add_q(codec_ctx->time_base, {0, 1}); } return true; From 096193ae1fea9042d57b5114ac6f48195e872c02 Mon Sep 17 00:00:00 2001 From: Quackdoc <74831516+Quackdoc@users.noreply.github.com> Date: Thu, 3 Feb 2022 22:51:44 -0500 Subject: [PATCH 3/4] hide dnxhd profile dnxhd profile requires specific conditions to be met that need more attention put into it. and we can use dnxhr for most cases anyways. --- app/dialog/export/codec/dnxhdsection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/dialog/export/codec/dnxhdsection.cpp b/app/dialog/export/codec/dnxhdsection.cpp index cf9a845521..3c787af24b 100644 --- a/app/dialog/export/codec/dnxhdsection.cpp +++ b/app/dialog/export/codec/dnxhdsection.cpp @@ -45,7 +45,7 @@ DNxHDSection::DNxHDSection(QWidget *parent) : * */ - preset_combobox_->addItem(tr("dnxhd")); + //preset_combobox_->addItem(tr("dnxhd")); preset_combobox_->addItem(tr("dnxhr_lb")); preset_combobox_->addItem(tr("dnxhr_sq")); preset_combobox_->addItem(tr("dnxhr_hq")); @@ -60,7 +60,7 @@ DNxHDSection::DNxHDSection(QWidget *parent) : void DNxHDSection::AddOpts(EncodingParams *params) { - params->set_video_option(QStringLiteral("profile"), QString::number(preset_combobox_->currentIndex())); + params->set_video_option(QStringLiteral("profile"), QString::number(preset_combobox_->currentIndex() + 1)); } } From eef46ecf4d17bbcdfb3e7e4afc4c1a9aea28e504 Mon Sep 17 00:00:00 2001 From: Quackdoc <74831516+Quackdoc@users.noreply.github.com> Date: Thu, 3 Feb 2022 23:10:52 -0500 Subject: [PATCH 4/4] change default to dnxhr_sq, add tooltip --- app/dialog/export/codec/dnxhdsection.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/dialog/export/codec/dnxhdsection.cpp b/app/dialog/export/codec/dnxhdsection.cpp index 3c787af24b..048a11df0e 100644 --- a/app/dialog/export/codec/dnxhdsection.cpp +++ b/app/dialog/export/codec/dnxhdsection.cpp @@ -29,10 +29,14 @@ DNxHDSection::DNxHDSection(QWidget *parent) : int row = 0; - layout->addWidget(new QLabel(tr("preset:")), row, 0); + layout->addWidget(new QLabel(tr("Profile:")), row, 0); preset_combobox_ = new QComboBox(); + preset_combobox_->setToolTip(tr("While using DNxHD you may need to manually change pixel format. \n\n" + "dnxhr_hqx profile will need you to manually specify pixel format `422p10le` in the advanced menu. \n\n" + "dnxhr_444 profile will need you to manually specify pixel format `444p10le` or `gbrp10le` in the advanced menu.")); + /* Correspond to the following indexes for FFmpeg * *-profile E..V....... (from 0 to 5) (default dnxhd) @@ -52,8 +56,8 @@ DNxHDSection::DNxHDSection(QWidget *parent) : preset_combobox_->addItem(tr("dnxhr_hqx")); preset_combobox_->addItem(tr("dnxhr_444")); - //Default to "medium" - preset_combobox_->setCurrentIndex(3); + + preset_combobox_->setCurrentIndex(1); layout->addWidget(preset_combobox_, row, 1); }