kdenlive to mmg/mkv and bombono

revision 53e3b106fa82ac552b83d970390a22ec2cd942e8

raw

README.rst

XSLT files to convert kdenlive files to mkv chapters for mmg (mkvmerge gui), and to DVD chapters (bombono).

raw

kdenlive-to-bombono-parts.xsl

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:output indent="yes"/>
 
 <xsl:template match="/">
  <Parts>
      <xsl:for-each select="mlt/kdenlivedoc/guides/guide">
        <!-- support german files with comma as decimal separator-->
        <xsl:variable name="time" select="translate(@time,',','.')"/>
        <Part Name="{@comment}"><xsl:value-of select="$time"/></Part>
      </xsl:for-each>
  </Parts>
 </xsl:template>
 
</xsl:stylesheet> 
 
raw

kdenlive-to-mkv-chapters.xsl

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <!-- Convert kdenlive guide markers into MKV chapters.
 
      this works with kdenlive 16.12.
      Earlier versions were different;
      they had mlt/kdenlivedoc/guides/guide tags
      which are not generated anymore
 -->
 <xsl:output indent="yes"/>
 
 <xsl:template match="/">
  <Chapters>
   <EditionEntry>
      <xsl:for-each select="mlt/playlist/property[substring(@name, 0, 16) = 'kdenlive:guide.']">
      <!-- we need to sort manually, they can appear in any order -->
        <xsl:sort data-type="number" select="translate(substring(@name, 16),',','.')"/>
 
        <xsl:variable name="timeorig" select="substring(@name, 16)"/>
        <!-- support german files with comma as decimal separator-->
        <xsl:variable name="time" select="translate($timeorig,',','.')"/>
 
        <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:text>:</xsl:text>
          <xsl:value-of select="format-number($minutes, '00')"/>
          <xsl:text>:</xsl:text>
          <xsl:value-of select="format-number($seconds, '00.000')"/>
        </xsl:variable>
           
        <ChapterAtom>
          <ChapterDisplay>
            <ChapterString>
              <xsl:if test=".!='Hilfslinie'">
                <xsl:value-of select="."/>
              </xsl:if>
            </ChapterString>
            <ChapterLanguage>ger</ChapterLanguage>
          </ChapterDisplay>
          <ChapterFlagHidden>
            <xsl:choose>
              <xsl:when test=".='Hilfslinie'">1</xsl:when>
              <xsl:otherwise>0</xsl:otherwise>
            </xsl:choose>
          </ChapterFlagHidden>
          <ChapterFlagEnabled>1</ChapterFlagEnabled>
          <ChapterTimeStart>
            <xsl:value-of select="$timecode"/>
          </ChapterTimeStart>
        </ChapterAtom>
      </xsl:for-each>
 
   </EditionEntry>
  </Chapters>
 </xsl:template>
 
</xsl:stylesheet> 

History