<?xml version="1.0" encoding="utf-8"?>

<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"
[
<!ENTITY product "mkvpropedit">
<!ENTITY version "13.0.0">
<!ENTITY date "2017-06-25">

<!ENTITY mkvmerge "<citerefentry><refentrytitle>mkvmerge</refentrytitle><manvolnum>1</manvolnum></citerefentry>">
<!ENTITY mkvinfo "<citerefentry><refentrytitle>mkvinfo</refentrytitle><manvolnum>1</manvolnum></citerefentry>">
<!ENTITY mkvextract "<citerefentry><refentrytitle>mkvextract</refentrytitle><manvolnum>1</manvolnum></citerefentry>">
<!ENTITY mkvpropedit "<citerefentry><refentrytitle>mkvpropedit</refentrytitle><manvolnum>1</manvolnum></citerefentry>">
<!ENTITY mtxgui "<citerefentry><refentrytitle>mkvtoolnix-gui</refentrytitle><manvolnum>1</manvolnum></citerefentry>">

<!ENTITY matroska "<productname>Matroska</productname>">
<!ENTITY oggvorbis "<productname>OggVorbis</productname>">
<!ENTITY xml "<abbrev>XML</abbrev>">

]>

<refentry lang="en" id="mkvextract">
 <refentryinfo>
  <productname>&product;</productname>
  <date>&date;</date>
  <authorgroup>
   <author>
    <contrib>Developer</contrib>
    <firstname>Moritz</firstname>
    <surname>Bunkus</surname>
    <email>moritz@bunkus.org</email>
   </author>
  </authorgroup>
 </refentryinfo>
 <refmeta>
  <refentrytitle>&product;</refentrytitle>
  <manvolnum>1</manvolnum>
  <refmiscinfo class="version">&version;</refmiscinfo>
  <refmiscinfo class="date">&date;</refmiscinfo>
  <refmiscinfo class="source">MKVToolNix</refmiscinfo>
  <refmiscinfo class="manual">User Commands</refmiscinfo>
 </refmeta>

 <refnamediv>
  <refname>&product;</refname>
  <refpurpose>Modify properties of existing &matroska; files without a complete remux</refpurpose>
 </refnamediv>

 <refsynopsisdiv id="mkvpropedit.synopsis">
  <title>Synopsis</title>
  <cmdsynopsis>
   <command>mkvpropedit</command>
   <arg>options</arg>
   <arg choice="req">source-filename</arg>
   <arg choice="req">actions</arg>
  </cmdsynopsis>
 </refsynopsisdiv>

 <refsect1 id="mkvpropedit.description">
  <title>Description</title>
  <para>
   This program analyses an existing &matroska; file and modifies some of its properties. Then it writes those modifications to the existing
   file. Among the properties that can be changed are the segment information elements (e.g. the title) and the track headers (e.g. the
   language code, 'default track' flag or the name).
  </para>

  <para>
   Options:
  </para>

  <variablelist>
   <varlistentry id="mkvpropedit.description.list_property_names">
    <term><option>-l</option>, <option>--list-property-names</option></term>
    <listitem>
     <para>
      Lists all known and editable property names, their type (string, integer, boolean etc) and a short description. The program exits
      afterwards. Therefore the <parameter>source-filename</parameter> parameter does not have to be supplied.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="mkvpropedit.description.parse_mode">
    <term><option>-p</option>, <option>--parse-mode</option> <parameter>mode</parameter></term>
    <listitem>
     <para>
      Sets the parse mode. The parameter '<parameter>mode</parameter>' can either be '<literal>fast</literal>' (which is also the default)
      or '<literal>full</literal>'. The '<literal>fast</literal>' mode does not parse the whole file but uses the meta seek elements for
      locating the required elements of a source file. In 99% of all cases this is enough. But for files that do not contain meta seek
      elements or which are damaged the user might have to set the '<literal>full</literal>' parse mode. A full scan of a file can take a
      couple of minutes while a fast scan only takes seconds.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>

  <para>
   Actions that deal with track and segment info properties:
  </para>

  <variablelist>
   <varlistentry id="mkvpropedit.description.edit">
    <term><option>-e</option>, <option>--edit</option> <parameter>selector</parameter></term>
    <listitem>
     <para>
      Sets the &matroska; file section (segment information or a certain track's headers) that all following <link
      linkend="mkvpropedit.description.add">add</link>, <link linkend="mkvpropedit.description.set">set</link> and <link
      linkend="mkvpropedit.description.delete">delete</link> actions operate on. This option can be used multiple times in order to make
      modifications to more than one element.
     </para>

     <para>
      By default &mkvpropedit; will edit the segment information section.
     </para>

     <para>
      See the section about <link linkend="mkvpropedit.edit_selectors">edit selectors</link> for a full description of the syntax.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="mkvpropedit.description.add">
    <term><option>-a</option>, <option>--add</option> <parameter>name</parameter>=<parameter>value</parameter></term>
    <listitem>
     <para>
      Adds a property <parameter>name</parameter> with the value <parameter>value</parameter>. The property will be added even if such a
      property exists already. Note that most properties are unique and cannot occur more than once.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="mkvpropedit.description.set">
    <term><option>-s</option>, <option>--set</option> <parameter>name</parameter>=<parameter>value</parameter></term>
    <listitem>
     <para>
      Sets all occurrences of the property <parameter>name</parameter> to the value <parameter>value</parameter>. If no such property exists
      then it will be added.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="mkvpropedit.description.delete">
    <term><option>-d</option>, <option>--delete</option> <parameter>name</parameter></term>
    <listitem>
     <para>
      Deletes all occurrences of the property <parameter>name</parameter>. Note that some properties are required and cannot be deleted.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>

  <para>
   Actions that deal with tags and chapters:
  </para>

  <variablelist>
   <varlistentry id="mkvpropedit.description.tags">
    <term><option>-t</option>, <option>--tags</option> <parameter>selector</parameter>:<parameter>filename</parameter></term>
    <listitem>
     <para>
      Add or replace tags in the file with the ones from <filename>filename</filename> or remove them if <filename>filename</filename> is
      empty. &mkvpropedit; reads the same XML tag format that &mkvmerge; reads as well.
     </para>

     <para>
      The <parameter>selector</parameter> must be one of the words <constant>all</constant>, <constant>global</constant> or
      <constant>track</constant>. For <constant>all</constant> &mkvpropedit; will replace or remove all tags in a file. With
      <constant>global</constant> only global tags will be replaced or removed.
     </para>

     <para>
      With <constant>track</constant> &mkvpropedit; will replace tags for a specific track. Additionally the tags read from
      <filename>filename</filename> will be assigned to the same track. The track is specified in the same way <link
      linkend="mkvpropedit.edit_selectors">edit selectors</link> are specified (see below), e.g. <code>--tags
      track:a1:new-audio-tags.xml</code>.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="mkvpropedit.description.add_track_statistics_tags">
    <term><option>--add-track-statistics-tags</option></term>
    <listitem>
     <para>
      Calculates statistics for all tracks in a file and adds new statistics tags for them. If the file already contains such tags then they'll be updated.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="mkvpropedit.description.delete_track_statistics_tags">
    <term><option>--delete-track-statistics-tags</option></term>
    <listitem>
     <para>
      Deletes all existing track statistics tags from a file. If the file doesn't contain track statistics tags then it won't be modified.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="mkvpropedit.description.chapters">
    <term><option>-c</option>, <option>--chapters</option> <parameter>filename</parameter></term>
    <listitem>
     <para>
      Add or replace chapters in the file with the ones from <filename>filename</filename> or remove them if <filename>filename</filename> is
      empty. &mkvpropedit; reads the same XML and simple chapter formats that &mkvmerge; reads as well.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>

  <para>
   Actions for handling attachments:
  </para>

  <variablelist>
   <varlistentry id="mkvpropedit.description.add_attachment">
    <term><option>--add-attachment</option> <parameter>filename</parameter></term>
    <listitem>
     <para>
      Adds a new attachment from <parameter>filename</parameter>.
     </para>

     <para>
      If the option <option>--attachment-name</option> has been used prior to this option then its value is used as the new attachment's
      name. Otherwise it is derived from <parameter>filename</parameter>.
     </para>

     <para>
      If the option <option>--attachment-mime-type</option> has been used prior to this option then its value is used as the new
      attachment's MIME type. Otherwise it is auto-detected from the content of <parameter>filename</parameter>.
     </para>

     <para>
      If the option <option>--attachment-description</option> has been used prior to this option then its value is used as the new
      attachment's description. Otherwise no description will be set.
     </para>

     <para>
      If the option <option>--attachment-uid</option> has been used prior to this option then its value is used as the new attachment's
      UID. Otherwise a random UID will be generated automatically.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="mkvpropedit.description.replace_attachment">
    <term><option>--replace-attachment</option> <parameter>selector</parameter><literal>:</literal><parameter>filename</parameter></term>
    <listitem>
     <para>
      Replaces one or more attachments that match <parameter>selector</parameter> with the file <parameter>filename</parameter>. If more
      than one existing attachment matches <parameter>selector</parameter> then all of their contents will be replaced by the content of
      <parameter>filename</parameter>.
     </para>

     <para>
      The <parameter>selector</parameter> can have one of four forms. They're exlained below in the section <link
      linkend="mkvpropedit.attachment_selectors">attachment selectors</link>.
     </para>

     <para>
      If the option <option>--attachment-name</option> has been used prior to this option then its value is set as the new name for each
      modified attachment. Otherwise the names aren't changed.
     </para>

     <para>
      If the option <option>--attachment-mime-type</option> has been used prior to this option then its value is set as the new MIME type
      for each modified attachment. Otherwise the MIME types aren't changed.
     </para>

     <para>
      If the option <option>--attachment-description</option> has been used prior to this option then its value is set as the new
      description for each modified attachment. Otherwise the descriptions aren't changed.
     </para>

     <para>
      If the option <option>--attachment-uid</option> has been used prior to this option then its value is set as the new UID for each
      modified attachment. Otherwise the UIDs aren't changed.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="mkvpropedit.description.update_attachment">
    <term><option>--update-attachment</option> <parameter>selector</parameter></term>
    <listitem>
     <para>
      Sets the properties of one or more attachments that match <parameter>selector</parameter>. If more than one existing attachment
      matches <parameter>selector</parameter> then all of their properties will be updated.
     </para>

     <para>
      The <parameter>selector</parameter> can have one of four forms. They're exlained below in the section <link
      linkend="mkvpropedit.attachment_selectors">attachment selectors</link>.
     </para>

     <para>
      If the option <option>--attachment-name</option> has been used prior to this option then its value is set as the new name for each
      modified attachment. Otherwise the names aren't changed.
     </para>

     <para>
      If the option <option>--attachment-mime-type</option> has been used prior to this option then its value is set as the new MIME type
      for each modified attachment. Otherwise the MIME types aren't changed.
     </para>

     <para>
      If the option <option>--attachment-description</option> has been used prior to this option then its value is set as the new
      description for each modified attachment. Otherwise the descriptions aren't changed.
     </para>

     <para>
      If the option <option>--attachment-uid</option> has been used prior to this option then its value is set as the new UID for each
      modified attachment. Otherwise the UIDs aren't changed.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="mkvpropedit.description.delete_attachment">
    <term><option>--delete-attachment</option> <parameter>selector</parameter></term>
    <listitem>
     <para>
      Deletes one or more attachments that match <parameter>selector</parameter>.
     </para>

     <para>
      The <parameter>selector</parameter> can have one of four forms. They're exlained below in the section <link
      linkend="mkvpropedit.attachment_selectors">attachment selectors</link>.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>

  <para>
   Options for attachment actions:
  </para>

  <variablelist>
   <varlistentry id="mkvpropedit.description.attachment_name">
    <term><option>--attachment-name</option> <parameter>name</parameter></term>
    <listitem>
     <para>
      Sets the name to use for the following <option>--add-attachment</option> or <option>--replace-attachment</option> operation.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="mkvpropedit.description.attachment_mime_type">
    <term><option>--attachment-mime-type</option> <parameter>mime-type</parameter></term>
    <listitem>
     <para>
      Sets the MIME type to use for the following <option>--add-attachment</option> or <option>--replace-attachment</option> operation.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="mkvpropedit.description.attachment_description">
    <term><option>--attachment-description</option> <parameter>description</parameter></term>
    <listitem>
     <para>
      Sets the description to use for the following <option>--add-attachment</option> or <option>--replace-attachment</option> operation.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>

  <para>
   Other options:
  </para>

  <variablelist>
   <varlistentry id="mkvpropedit.description.command_line_charset">
    <term><option>--command-line-charset</option> <parameter>character-set</parameter></term>
    <listitem>
     <para>
      Sets the character set to convert strings given on the command line from. It defaults to the character set given by system's current
      locale.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="mkvpropedit.description.output_charset">
    <term><option>--output-charset</option> <parameter>character-set</parameter></term>
    <listitem>
     <para>
      Sets the character set to which strings are converted that are to be output.  It defaults to the character set given by system's
      current locale.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="mkvpropedit.description.redirect_output">
    <term><option>-r</option>, <option>--redirect-output</option> <parameter>file-name</parameter></term>
    <listitem>
     <para>
      Writes all messages to the file <parameter>file-name</parameter> instead of to the console.  While this can be done easily with
      output redirection there are cases in which this option is needed: when the terminal reinterprets the output before writing it to a
      file.  The character set set with <link
      linkend="mkvpropedit.description.output_charset"><option>--output-charset</option></link> is honored.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="mkvpropedit.description.ui_language">
    <term><option>--ui-language</option> <parameter>code</parameter></term>
    <listitem>
     <para>
      Forces the translations for the language <parameter>code</parameter> to be used (e.g.  '<literal>de_DE</literal>' for the German
      translations). Entering '<literal>list</literal>' as the <parameter>code</parameter> will cause the program to output a list of
      available translations.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="mkvpropedit.description.debug">
    <term><option>--debug</option> <parameter>topic</parameter></term>
    <listitem>
     <para>
      Turn on debugging for a specific feature. This option is only useful for developers.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="mkvpropedit.description.engage">
    <term><option>--engage</option> <parameter>feature</parameter></term>
    <listitem>
     <para>
      Turn on experimental features. A list of available features can be requested with <command>mkvpropedit --engage list</command>. These
      features are not meant to be used in normal situations.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="mkvpropedit.description.gui_mode">
    <term><option>--gui-mode</option></term>
    <listitem>
     <para>
      Turns on GUI mode. In this mode specially-formatted lines may be output that can tell a controlling GUI what's happening. These
      messages follow the format '<literal>#GUI#message</literal>'. The message may be followed by key/value pairs as in
      '<literal>#GUI#message#key1=value1#key2=value2…</literal>'. Neither the messages nor the keys are ever translated and always output
      in English.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><option>-v</option>, <option>--verbose</option></term>
    <listitem>
     <para>
      Be verbose and show all the important &matroska; elements as they're read.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><option>-h</option>, <option>--help</option></term>
    <listitem>
     <para>
      Show usage information and exit.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><option>-V</option>, <option>--version</option></term>
    <listitem>
     <para>
      Show version information and exit.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><option>--check-for-updates</option></term>
    <listitem>
     <para>
       Checks online for new releases by downloading the URL <ulink
       url="http://mkvtoolnix-releases.bunkus.org/latest-release.xml">http://mkvtoolnix-releases.bunkus.org/latest-release.xml</ulink>. Four
       lines will be output in <literal>key=value</literal> style: the URL from where the information was retrieved (key
       <literal>version_check_url</literal>), the currently running version (key <literal>running_version</literal>), the latest release's
       version (key <literal>available_version</literal>) and the download URL (key <literal>download_url</literal>).
     </para>

     <para>
      Afterwards the program exists with an exit code of 0 if no newer release is available, with 1 if a newer release is available and with
      2 if an error occured (e.g. if the update information could not be retrieved).
     </para>

     <para>
      This option is only available if the program was built with support for libcurl.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><option>@</option><parameter>options-file.json</parameter></term>
    <listitem>
     <para>
      Reads additional command line arguments from the file <parameter>options-file</parameter>. For a full explanation on the supported
      formats for such files see the section called "Option files" in the &mkvmerge; man page.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>
 </refsect1>

 <refsect1 id="mkvpropedit.edit_selectors">
  <title>Edit selectors</title>
  <para>
   The <link linkend="mkvpropedit.description.edit"><option>--edit</option></link> option sets the &matroska; file section (segment
   information or a certain track's headers) that all following <link linkend="mkvpropedit.description.add">add</link>, <link
   linkend="mkvpropedit.description.set">set</link> and <link linkend="mkvpropedit.description.delete">delete</link> actions operate
   on. This stays valid until the next <link linkend="mkvpropedit.description.edit"><option>--edit</option></link> option is found. The
   argument to this option is called the edit selector.
  </para>

  <para>
   By default &mkvpropedit; will edit the segment information section.
  </para>

  <refsect2 id="mkvpropedit.edit_selectors.segment_info">
   <title>Segment information</title>
   <para>
    The segment information can be selected with one of these three words: '<literal>info</literal>', '<literal>segment_info</literal>' or
    '<literal>segmentinfo</literal>'. It contains properties like the segment title or the segment <abbrev>UID</abbrev>.
   </para>
  </refsect2>

  <refsect2 id="mkvpropedit.edit_selectors.track_headers">
   <title>Track headers</title>
   <para>
    Track headers can be selected with a slightly more complex selector. All variations start with '<literal>track:</literal>'. The track
    header properties include elements like the language code, 'default track' flag or the track's name.
   </para>

   <variablelist>
    <varlistentry>
     <term><option>track:</option><parameter>n</parameter></term>
     <listitem>
      <para>
       If the parameter <parameter>n</parameter> is a number then the <parameter>n</parameter>th track will be selected. The track order is
       the same that &mkvmerge;'s <option>--identify</option> option outputs.
      </para>

      <para>
       Numbering starts at 1.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>track:</option><parameter>t</parameter><parameter>n</parameter></term>
     <listitem>
      <para>
       If the parameter starts with a single character <parameter>t</parameter> followed by a <parameter>n</parameter> then the
       <parameter>n</parameter>th track of a specific track type will be selected. The track type parameter <parameter>t</parameter> must be
       one of these four characters: '<literal>a</literal>' for an audio track, '<literal>b</literal>' for a button track,
       '<literal>s</literal>' for a subtitle track and '<literal>v</literal>' for a video track. The track order is the same that
       &mkvmerge;'s <option>--identify</option> option outputs.
      </para>

      <para>
       Numbering starts at 1.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>track:</option>=<parameter>uid</parameter></term>
     <listitem>
      <para>
       If the parameter starts with a '<literal>=</literal>' followed by a number <parameter>uid</parameter> then the track whose track
       <abbrev>UID</abbrev> element equals this <parameter>uid</parameter>. Track <abbrev>UIDs</abbrev> can be obtained with &mkvinfo;.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>track:</option>@<parameter>number</parameter></term>
     <listitem>
      <para>
       If the parameter starts with a '<literal>@</literal>' followed by a number <parameter>number</parameter> then the track whose track
       number element equals this <parameter>number</parameter>. Track number can be obtained with &mkvinfo;.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </refsect2>

  <refsect2 id="mkvpropedit.edit_selectors.notes">
   <title>Notes</title>
   <para>
    Due to the nature of the track edit selectors it is possible that several selectors actually match the same track headers. In such cases
    all actions for those edit selectors will be combined and executed in the order in which they're given on the command line.
   </para>
  </refsect2>
 </refsect1>

 <refsect1 id="mkvpropedit.attachment_selectors">
  <title>Attachment selectors</title>

  <para>
   An attachment selector is used with the two actions <link
   linkend="mkvpropedit.description.replace_attachment"><option>--replace-attachment</option></link> and <link
   linkend="mkvpropedit.description.delete_attachment"><option>--delete-attachment</option></link>. It can have one of the following four
   forms:
  </para>

  <orderedlist>
   <listitem>
    <para>
     Selection by attachment ID. In this form the selector is simply a number, the attachment's ID as output by &mkvmerge;'s
     identification command.
    </para>
   </listitem>

   <listitem>
    <para>
     Selection by attachment UID (unique ID). In this form the selector is the equal sign <literal>=</literal> followed by a number, the
     attachment's unique ID as output by &mkvmerge;'s verbose identification command.
    </para>
   </listitem>

   <listitem>
    <para>
     Selection by attachment name. In this form the selector is the literal word <literal>name:</literal> followed by the existing
     attachment's name. If this selector is used with <option>--replace-attachment</option> then colons within the name to match must be
     escaped as <literal>\c</literal>.
    </para>
   </listitem>

   <listitem>
    <para>
     Selection by MIME type. In this form the selector is the literal word <literal>mime-type:</literal> followed by the existing
     attachment's MIME type. If this selector is used with <option>--replace-attachment</option> then colons within the MIME type to match
     must be escaped as <literal>\c</literal>.
    </para>
   </listitem>
  </orderedlist>
 </refsect1>

 <refsect1 id="mkvpropedit.examples">
  <title>Examples</title>
  <para>
   The following example edits a file called '<literal>movie.mkv</literal>'. It sets the segment title and modifies the language code of an
   audio and a subtitle track. Note that this example can be shortened by leaving out the first <link
   linkend="mkvpropedit.description.edit"><option>--edit</option></link> option because editing the segment information element is the
   default for all options found before the first <link linkend="mkvpropedit.description.edit"><option>--edit</option></link> option anyway.
  </para>

  <screen>$ mkvpropedit movie.mkv --edit info --set "title=The movie" --edit track:a1 --set language=fre --edit track:a2 --set language=ita</screen>

  <para>
   The second example removes the 'default track flag' from the first subtitle track and sets it for the second one. Note that
   &mkvpropedit;, unlike &mkvmerge;, does not set the 'default track flag' of other tracks to '0' if it is set to '1' for a different track
   automatically.
  </para>

  <screen>$ mkvpropedit movie.mkv --edit track:s1 --set flag-default=0 --edit track:s2 --set flag-default=1</screen>

  <para>
   Replacing the tags for the second subtitle track in a file looks like this:
  </para>

  <screen>$ mkvpropedit movie.mkv --tags track:s2:new-subtitle-tags.xml</screen>

  <para>
   Removing all tags requires leaving out the file name:
  </para>

  <screen>$ mkvpropedit movie.mkv --tags all:</screen>

  <para>
   Replacing the chapters in a file looks like this:
  </para>

  <screen>$ mkvpropedit movie.mkv --chapters new-chapters.xml</screen>

  <para>
   Removing all chapters requires leaving out the file name:
  </para>

  <screen>$ mkvpropedit movie.mkv --chapters ''</screen>

  <para>
   Adding a font file (<literal>Arial.ttf</literal>) as an attachment:
  </para>

  <screen>$ mkvpropedit movie.mkv --add-attachment Arial.ttf</screen>

  <para>
   Adding a font file (<literal>89719823.ttf</literal>) as an attachment and providing some information as it really is just Arial:
  </para>

  <screen>$ mkvpropedit movie.mkv --attachment-name Arial.ttf --attachment-description 'The Arial font as a TrueType font' --attachment-mime-type application/x-truetype-font --add-attachment 89719823.ttf</screen>

  <para>
   Replacing one attached font (<literal>Comic.ttf</literal>) file with another one (<literal>Arial.ttf</literal>):
  </para>

  <screen>$ mkvpropedit movie.mkv --attachment-name Arial.ttf --attachment-description 'The Arial font as a TrueType font' --replace-attachment name:Comic.ttf:Arial.ttf</screen>

  <para>
   Deleting the second attached file, whatever it may be:
  </para>

  <screen>$ mkvpropedit movie.mkv --delete-attachment 2</screen>

  <para>
   Deleting all attached fonts by MIME type:
  </para>

  <screen>$ mkvpropedit movie.mkv --delete-attachment mime-type:application/x-truetype-font</screen>
 </refsect1>

 <refsect1>
  <title>Exit codes</title>

  <para>
   &mkvpropedit; exits with one of three exit codes:
  </para>

  <itemizedlist>
   <listitem>
    <para>
     <constant>0</constant> -- This exit codes means that the modification has completed successfully.
    </para>
   </listitem>

   <listitem>
    <para>
     <constant>1</constant> -- In this case &mkvpropedit; has output at least one warning, but the modification did continue.  A warning is
     prefixed with the text '<literal>Warning:</literal>'.  Depending on the issues involved the resulting files might be ok or not.  The
     user is urged to check both the warning and the resulting files.
    </para>
   </listitem>

   <listitem>
    <para>
     <constant>2</constant> -- This exit code is used after an error occurred.  &mkvpropedit; aborts right after outputting the error message.
     Error messages range from wrong command line arguments over read/write errors to broken files.
    </para>
   </listitem>
  </itemizedlist>
 </refsect1>

 <refsect1 id="mkvinfo.text_files_and_charsets">
  <title>Text files and character set conversions</title>

  <para>
   For an in-depth discussion about how all tools in the MKVToolNix suite handle character set conversions, input/output encoding, command
   line encoding and console encoding please see the identically-named section in the &mkvmerge; man page.
  </para>
 </refsect1>

 <refsect1 id="mkvpropedit.escaping">
  <title>Escaping special chars in text</title>
  <para>
   There are a few places in which special characters in text must or should be escaped. The rules for escaping are simple: each character
   that needs escaping is replaced with a backslash followed by another character.
  </para>

  <para>
   The rules are: ' ' (a space) becomes '\s', '&quot;' (double quotes) becomes '\2', ':' becomes '\c', '#' becomes '\h' and '\' (a single backslash) itself becomes '\\'.
  </para>
 </refsect1>

 <refsect1 id="mkvpropedit.environment_variables">
  <title>Environment variables</title>

  <para>
   &mkvpropedit; uses the default variables that determine the system's locale (e.g. <varname>LANG</varname> and the <varname>LC_*</varname>
   family). Additional variables:
  </para>

  <variablelist>
   <varlistentry>
    <term><varname>MKVPROPEDIT_DEBUG</varname>, <varname>MKVTOOLNIX_DEBUG</varname> and its short form <varname>MTX_DEBUG</varname></term>
    <listitem>
     <para>The content is treated as if it had been passed via the <link
     linkend="mkvpropedit.description.debug"><option>--debug</option></link> option.</para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><varname>MKVPROPEDIT_ENGAGE</varname>, <varname>MKVTOOLNIX_ENGAGE</varname> and its short form <varname>MTX_ENGAGE</varname></term>
    <listitem>
     <para>The content is treated as if it had been passed via the <link
     linkend="mkvpropedit.description.engage"><option>--engage</option></link> option.</para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><varname>MKVPROPEDIT_OPTIONS</varname>, <varname>MKVTOOLNIX_OPTIONS</varname> and its short form <varname>MTX_OPTIONS</varname></term>
    <listitem>
     <para>The content is split on white space. The resulting partial strings are treated as if it had been passed as command line
     options. If you need to pass special characters (e.g. spaces) then you have to escape them (see <link
     linkend="mkvpropedit.escaping">the section about escaping special characters in text</link>).</para>
    </listitem>
   </varlistentry>
  </variablelist>
 </refsect1>

 <refsect1 id="mkvpropedit.seealso">
  <title>See also</title>
  <para>
   &mkvmerge;, &mkvinfo;, &mkvextract;, &mtxgui;
  </para>
 </refsect1>

 <refsect1 id="mkvpropedit.www">
  <title>WWW</title>
  <para>
   The latest version can always be found at <ulink url="https://mkvtoolnix.download/">the MKVToolNix homepage</ulink>.
  </para>
 </refsect1>

</refentry>
