The mkvtoolnix application "mkvmerge" has a nice chapter editor - *if* you already have all the chapters in a suitable textfile format.
I've decided to use kdenlive as visual editor for this job and use its "marker" feature.
The task is as follows:
a) open the video file in kdenlive
b) navigate through the video and add markers as needed
c) save the kdenlive project file
d) use a XSLT file to transform the .kdenlive XML file to a mkvmerge compatible chapters XML.
Here is the XSLT I've written to extract the kdenlive markers:
Code: Select all
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<Chapters>
<EditionEntry>
<xsl:for-each select="mlt/kdenlivedoc/markers/marker">
<xsl:variable name="seconds" select="@time mod 60" />
<xsl:variable name="minutes" select="floor(@time div 60) mod 60" />
<xsl:variable name="hours" select="floor((@time div 60) div 60)" />
<!-- hh:mm:ss.msec -->
<xsl:variable name="timecode">
<xsl:value-of select="format-number($hours, '00')"/>:<xsl:value-of select="format-number($minutes, '00')"/>:<xsl:value-of select="format-number($seconds, '00.000')"/>
</xsl:variable>
<ChapterAtom>
<ChapterDisplay>
<ChapterString>
<xsl:value-of select="@comment"/>
</ChapterString>
</ChapterDisplay>
<ChapterFlagHidden>0</ChapterFlagHidden>
<ChapterFlagEnabled>1</ChapterFlagEnabled>
<ChapterTimeStart>
<xsl:value-of select="$timecode"/>
</ChapterTimeStart>
</ChapterAtom>
</xsl:for-each>
</EditionEntry>
</Chapters>
</xsl:template>
</xsl:stylesheet>