From 93128937cff178d566ed890d550dd8e777e89a16 Mon Sep 17 00:00:00 2001 From: Dan Dennedy Date: Thu, 13 Jan 2022 22:38:51 -0800 Subject: [PATCH 1/4] Export WebM with alpha channel --- src/core/io/video/video_format.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/io/video/video_format.cpp b/src/core/io/video/video_format.cpp index 22204fb5..0dcd3b8a 100644 --- a/src/core/io/video/video_format.cpp +++ b/src/core/io/video/video_format.cpp @@ -392,7 +392,10 @@ class Video if ( ost.codec->pix_fmts == nullptr ) throw av::Error(QObject::tr("Could not determine pixel format")); // get_format() for some reason returns an invalid value - ost.codec_context->pix_fmt = ost.codec->pix_fmts[0]; + if (ost.codec->id == AV_CODEC_ID_VP9 || ost.codec->id == AV_CODEC_ID_VP8) + ost.codec_context->pix_fmt = AV_PIX_FMT_YUVA420P; + else + ost.codec_context->pix_fmt = ost.codec->pix_fmts[0]; // just for testing, we also add B-frames if ( ost.codec_context->codec_id == AV_CODEC_ID_MPEG2VIDEO ) @@ -813,7 +816,7 @@ std::unique_ptr glaxnimate::io::video::VideoFormat return std::make_unique(app::settings::SettingList{ // slug label description default min max app::settings::Setting{"bit_rate", tr("Bitrate"), tr("Video bit rate"), 5000, 0, 10000}, - app::settings::Setting{"background", tr("Background"), tr("Background color"), QColor{}}, + app::settings::Setting{"background", tr("Background"), tr("Background color"), QColorConstants::Transparent}, app::settings::Setting{"width", tr("Width"), tr("If not 0, it will overwrite the size"), document->main()->width.get(), 0, 10000}, app::settings::Setting{"height", tr("Height"), tr("If not 0, it will overwrite the size"), document->main()->height.get(),0, 10000}, app::settings::Setting{"verbose", tr("Verbose"), tr("Show verbose information on the conversion"), false}, From 47ae3e017be9f472deab04bcdab5c195cb05fcc1 Mon Sep 17 00:00:00 2001 From: "Mattia \"Glax\" Basaglia" Date: Fri, 14 Jan 2022 07:26:37 +0000 Subject: [PATCH 2/4] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86d6123c..59e094be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ * Fixed parsing SVG paths * Added support for loading basic animated SVG paths * Fixed importing solid layers from lottie + * Added transparency support when exporting to WebM * UI: * Added simplified Chinese translation * Added British English translation From bf7d3297218caadb4777c75f36bbb367b1bc5a51 Mon Sep 17 00:00:00 2001 From: "Mattia \"Glax\" Basaglia" Date: Fri, 14 Jan 2022 10:31:54 +0000 Subject: [PATCH 3/4] Use QColor constructor instead of QColorConstants --- src/core/io/video/video_format.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/io/video/video_format.cpp b/src/core/io/video/video_format.cpp index 0dcd3b8a..e43b2162 100644 --- a/src/core/io/video/video_format.cpp +++ b/src/core/io/video/video_format.cpp @@ -816,7 +816,7 @@ std::unique_ptr glaxnimate::io::video::VideoFormat return std::make_unique(app::settings::SettingList{ // slug label description default min max app::settings::Setting{"bit_rate", tr("Bitrate"), tr("Video bit rate"), 5000, 0, 10000}, - app::settings::Setting{"background", tr("Background"), tr("Background color"), QColorConstants::Transparent}, + app::settings::Setting{"background", tr("Background"), tr("Background color"), QColor(0, 0, 0, 0))}, app::settings::Setting{"width", tr("Width"), tr("If not 0, it will overwrite the size"), document->main()->width.get(), 0, 10000}, app::settings::Setting{"height", tr("Height"), tr("If not 0, it will overwrite the size"), document->main()->height.get(),0, 10000}, app::settings::Setting{"verbose", tr("Verbose"), tr("Show verbose information on the conversion"), false}, From f90a37202d4318a56dfce1d727e355b27a9dba83 Mon Sep 17 00:00:00 2001 From: Dan Dennedy Date: Fri, 14 Jan 2022 10:52:18 -0800 Subject: [PATCH 4/4] Fix compilation error on Setting constructor --- src/core/io/video/video_format.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/io/video/video_format.cpp b/src/core/io/video/video_format.cpp index e43b2162..f3665324 100644 --- a/src/core/io/video/video_format.cpp +++ b/src/core/io/video/video_format.cpp @@ -816,7 +816,7 @@ std::unique_ptr glaxnimate::io::video::VideoFormat return std::make_unique(app::settings::SettingList{ // slug label description default min max app::settings::Setting{"bit_rate", tr("Bitrate"), tr("Video bit rate"), 5000, 0, 10000}, - app::settings::Setting{"background", tr("Background"), tr("Background color"), QColor(0, 0, 0, 0))}, + app::settings::Setting{"background", tr("Background"), tr("Background color"), QColor(0, 0, 0, 0)}, app::settings::Setting{"width", tr("Width"), tr("If not 0, it will overwrite the size"), document->main()->width.get(), 0, 10000}, app::settings::Setting{"height", tr("Height"), tr("If not 0, it will overwrite the size"), document->main()->height.get(),0, 10000}, app::settings::Setting{"verbose", tr("Verbose"), tr("Show verbose information on the conversion"), false},