diff --git a/NEWS.md b/NEWS.md
index 5535d72d5..2b5a13381 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -19,9 +19,9 @@
* mkvmerge: AAC: implemented support for AAC with 960 samples per
frame. Implements #2031.
* mkvmerge: WAV reader: added support for Wave64 files. Implements #2042.
-* mkvmerge, mkvpropedit: added support for chapters in WebM files that is
- spec-compliant by removing all tag elements not supported by the WebM
- spec. Implements #2002.
+* mkvmerge, mkvpropedit, MKVToolNix GUI (chapter editor): added support for
+ chapters in WebM files that is spec-compliant by removing all tag elements
+ not supported by the WebM spec. Implements #2002.
* mkvpropedit: added support for tags in WebM files that is spec-compliant by
removing all tag elements not supported by the WebM spec.
diff --git a/src/mkvtoolnix-gui/chapter_editor/tab.cpp b/src/mkvtoolnix-gui/chapter_editor/tab.cpp
index 38ee43e66..f5bd493fa 100644
--- a/src/mkvtoolnix-gui/chapter_editor/tab.cpp
+++ b/src/mkvtoolnix-gui/chapter_editor/tab.cpp
@@ -577,7 +577,7 @@ Tab::load() {
d->savedState = currentState();
auto result = kax_analyzer_c::probe(to_utf8(d->fileName)) ? loadFromMatroskaFile()
: d->fileName.toLower().endsWith(Q(".mpls")) ? loadFromMplsFile()
- : loadFromChapterFile();
+ : loadFromChapterFile();
if (result.first)
chaptersLoaded(result.first, result.second);
@@ -705,7 +705,11 @@ Tab::saveToMatroskaImpl(bool requireNewFileName) {
if (doRequireNewFileName) {
auto defaultFilePath = !d->fileName.isEmpty() ? QFileInfo{d->fileName}.path() : Util::Settings::get().lastOpenDirPath();
- newFileName = Util::getOpenFileName(this, QY("Save chapters to Matroska file"), defaultFilePath, QY("Matroska files") + Q(" (*.mkv *.mka *.mks *.mk3d);;") + QY("All files") + Q(" (*)"));
+ newFileName = Util::getOpenFileName(this, QY("Save chapters to Matroska or WebM file"), defaultFilePath,
+ QY("Supported file types") + Q(" (*.mkv *.mka *.mks *.mk3d *.webm);;") +
+ QY("Matroska files") + Q(" (*.mkv *.mka *.mks *.mk3d);;") +
+ QY("WebM files") + Q(" (*.webm);;") +
+ QY("All files") + Q(" (*)"));
if (newFileName.isEmpty())
return false;
@@ -727,9 +731,14 @@ Tab::saveToMatroskaImpl(bool requireNewFileName) {
auto chapters = d->chapterModel->allChapters();
auto result = kax_analyzer_c::uer_success;
- if (chapters && (0 != chapters->ListSize()))
- result = d->analyzer->update_element(chapters, true);
- else
+ if (chapters && (0 != chapters->ListSize())) {
+ fix_mandatory_chapter_elements(chapters.get());
+ if (d->analyzer->is_webm())
+ remove_chapter_elements_unsupported_by_webm(*chapters);
+
+ result = d->analyzer->update_element(chapters, !d->analyzer->is_webm(), false);
+
+ } else
result = d->analyzer->remove_elements(EBML_ID(KaxChapters));
d->analyzer->close_file();
diff --git a/src/mkvtoolnix-gui/chapter_editor/tool.cpp b/src/mkvtoolnix-gui/chapter_editor/tool.cpp
index 34d7ae099..0468d040b 100644
--- a/src/mkvtoolnix-gui/chapter_editor/tool.cpp
+++ b/src/mkvtoolnix-gui/chapter_editor/tool.cpp
@@ -178,8 +178,9 @@ Tool::openFilesFromCommandLine(QStringList const &fileNames) {
void
Tool::selectFileToOpen() {
auto fileNames = Util::getOpenFileNames(this, QY("Open files in chapter editor"), Util::Settings::get().lastOpenDirPath(),
- QY("Supported file types") + Q(" (*.cue *.mpls *.mkv *.mka *.mks *.mk3d *.txt *.xml);;") +
+ QY("Supported file types") + Q(" (*.cue *.mpls *.mkv *.mka *.mks *.mk3d *.txt *.webm *.xml);;") +
QY("Matroska files") + Q(" (*.mkv *.mka *.mks *.mk3d);;") +
+ QY("WebM files") + Q(" (*.webm);;") +
QY("Blu-ray playlist files") + Q(" (*.mpls);;") +
QY("XML chapter files") + Q(" (*.xml);;") +
QY("Simple OGM-style chapter files") + Q(" (*.txt);;") +
diff --git a/src/mkvtoolnix-gui/forms/main_window/main_window.ui b/src/mkvtoolnix-gui/forms/main_window/main_window.ui
index c18dfd7f5..3baa7e863 100644
--- a/src/mkvtoolnix-gui/forms/main_window/main_window.ui
+++ b/src/mkvtoolnix-gui/forms/main_window/main_window.ui
@@ -413,7 +413,7 @@
:/icons/16x16/document-open.png:/icons/16x16/document-open.png
- &Open Matroska or chapter file
+ &Open Matroska, WebM or chapter file
Ctrl+O
@@ -450,7 +450,7 @@
- Save to &Matroska file
+ Save to &Matroska or WebM file