Commit 645953a1 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Warn the user when rendering an animation to gif with framerate > 50

This also disables the video options button if the current format
is gif, since there are no extra options for rendering to gif, and
removes the extra options for gif in the videosaver, so we don't
get unusable arguments like baseline profile for gif.

BUG:403873
parent c34c3cc0
......@@ -76,8 +76,6 @@ DlgAnimationRenderer::DlgAnimationRenderer(KisDocument *doc, QWidget *parent)
//m_page->intEnd->setMaximum(doc->image()->animationInterface()->fullClipRange().end());
m_page->intEnd->setValue(doc->image()->animationInterface()->playbackRange().end());
m_page->intHeight->setMinimum(1);
m_page->intHeight->setMaximum(10000);
m_page->intHeight->setValue(doc->image()->height());
......@@ -141,6 +139,8 @@ DlgAnimationRenderer::DlgAnimationRenderer(KisDocument *doc, QWidget *parent)
connect(m_page->shouldExportOnlyVideo, SIGNAL(toggled(bool)), this, SLOT(slotExportTypeChanged()));
connect(m_page->shouldExportAll, SIGNAL(toggled(bool)), this, SLOT(slotExportTypeChanged()));
connect(m_page->intFramesPerSecond, SIGNAL(valueChanged(int)), SLOT(frameRateChanged(int)));
// connect and cold init
connect(m_page->cmbRenderType, SIGNAL(currentIndexChanged(int)), this, SLOT(selectRenderType(int)));
selectRenderType(m_page->cmbRenderType->currentIndex());
......@@ -276,6 +276,10 @@ QString DlgAnimationRenderer::defaultVideoFileName(KisDocument *doc, const QStri
void DlgAnimationRenderer::selectRenderType(int index)
{
const QString mimeType = m_page->cmbRenderType->itemData(index).toString();
m_page->bnRenderOptions->setEnabled(mimeType != "image/gif");
m_page->lblGifWarning->setVisible((mimeType == "image/gif" && m_page->intFramesPerSecond->value() > 50));
QString videoFileName = defaultVideoFileName(m_doc, mimeType);
if (!m_page->videoFilename->fileName().isEmpty()) {
......@@ -385,6 +389,11 @@ KisAnimationRenderingOptions DlgAnimationRenderer::getEncoderOptions() const
options.ffmpegPath = m_page->ffmpegLocation->fileName();
options.frameRate = m_page->intFramesPerSecond->value();
if (options.frameRate > 50 && options.videoMimeType == "image/gif") {
options.frameRate = 50;
}
options.width = roundByTwo(m_page->intWidth->value());
options.height = roundByTwo(m_page->intHeight->value());
options.videoFileName = m_page->videoFilename->fileName();
......@@ -558,6 +567,12 @@ void DlgAnimationRenderer::slotExportTypeChanged()
resize(m_page->sizeHint());
}
void DlgAnimationRenderer::frameRateChanged(int framerate)
{
const QString mimeType = m_page->cmbRenderType->itemData(m_page->cmbRenderType->currentIndex()).toString();
m_page->lblGifWarning->setVisible((mimeType == "image/gif" && framerate > 50));
}
void DlgAnimationRenderer::slotLockAspectRatioDimensionsWidth(int width)
{
Q_UNUSED(width);
......
......@@ -73,12 +73,14 @@ private Q_SLOTS:
void slotExportTypeChanged();
void frameRateChanged(int framerate);
protected Q_SLOTS:
void slotButtonClicked(int button) override;
void slotDialogAccepted();
private:
void loadAnimationOptions(const KisAnimationRenderingOptions &options);
......
......@@ -262,7 +262,6 @@ KisImageBuilder_Result VideoSaver::encode(const QString &savedFilesMask, const K
<< "-i" << savedFilesMask
<< "-i" << palettePath
<< "-lavfi" << "[0:v][1:v] paletteuse"
<< additionalOptionsList
<< "-y" << resultFile;
// if we are exporting out at a different image size, we apply scaling filter
......
......@@ -290,6 +290,16 @@
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="lblGifWarning">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Warning:&lt;/span&gt; animated gif images cannot have a framerate higher than 50. The framerate will be reduced to 50 frames per second..&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment