Provided by: mkvtoolnix_8.8.0-1_amd64 bug

名称

       mkvpropedit - 在不进行完整的重新混流的情况下修改现有 Matroska(TM) 文件的属性

概要

       mkvpropedit [选项] {源文件名} {操作}

说明

       此程序可分析现有 Matroska(TM) 文件,并修改其部分属性。然后它将将变更写入现有文件。可修改的
       属性包括剪辑信息元素(如标题)和轨道头部(如语言代码、'默认轨' 标记或轨道名称)。

       选项:

       -l, --list-property-names
           列出所有已知的可编辑的属性名称、它们的类型(字符串型、整数型、布尔型等等)及简短说
           明。程序随后将退出执行。因此不必提供 source-filename 参数。

       -p, --parse-mode 模式
           设置解析模式。参数 '模式' 可以为 'fast(快速)'(此项为默认值)或 'full(完
           整)'。'fast(快速)'模式不解析整个文件,而是使用元定位元素确定源文件中所需元素的位
           置。99% 的情况下这就足够了。但如果碰到不含元定位元素或者元定位元素损坏的文件,用户可能
           得考虑 'full(完整)' 解析模式。完整扫描文件可能要花费几分钟,而快速扫描只需要几秒钟。

       轨道、剪辑信息属性处理操作:

       -e, --edit 选择器
           设置后续的 添加、设置 或 删除 操作所针对的 Matroska(TM) 文件区域(即剪辑信息或某个轨道
           的头部)。此选项可多次使用,以同时修改多个元素。

           默认情况下,mkvpropedit(1) 将编辑剪辑信息区段。

           关于完整的语法说明请参见关于 编辑选择器 的段落。

       -a, --add 名称=数值
           添加名为 名称、值为 数值 的属性。即使已存在这样的属性,也将执行添加属性操作。注意大多
           数属性是唯一的,不能出现多个。

       -s, --set 名称=数值
           设置所有名为 名称 的属性的数值为 数值。如果不存在这样的属性,则将添加该属性。

       -d, --delete 名称
           删除所有名为 名称 的属性。注意部分属性是必需的,不能删除。

       标签及章节处理操作:

       -t, --tags 选择器:文件名
           用 文件名 中的标签添加或替换文件中的标签,或者如果 文件名 为空则移除标
           签。mkvpropedit(1) 读取的 XML 标签格式与 mkvmerge(1) 所读取的相同。

           选择器 必须是 allglobaltrack 之一。对于all 选择器,mkvpropedit(1) 将替换或移除文
           件中的所有标签。对于 global 选择器,将只替换或移除全局标签。

           对于 track 选择器,mkvpropedit(1) 将替换特定轨道的标签。读取自 文件名 的其他标签将分配
           给相同轨道。轨道与 编辑选择器 以相同格式指定 (参见下文),如 --tags track:a1:新音频标
           签.xml。

       --add-track-statistics-tags
           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.

       --delete-track-statistics-tags
           Deletes all existing track statistics tags from a file. If the file doesn't contain
           track statistics tags then it won't be modified.

       -c, --chapters 文件名
           用 文件名 中的标签添加或替换文件中的章节,或者如果 文件名 为空则移除章
           节。mkvpropedit(1) 读取的 XML 及简单章节格式与 mkvmerge(1) 所读取的相同。

       附件处理操作:

       --add-attachment 文件名文件名 添加新附件。

           若本选项之前使用了 --attachment-name 选项,则其值将用作新附件的名称。否则附件名称将从
           文件名 得出。

           若本选项之前使用了 --attachment-mime-type 选项,则其值将用作新附件的 MIME 类型。否则将
           根据 文件名 的内容自动侦测。

           若本选项之前使用了 --attachment-description 选项,则其值将用作新附件的描述。否则将不设
           置描述信息。

           If the option --attachment-uid 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.

       --replace-attachment 选择器:文件名
           用文件 文件名 替换与 选择器 相匹配的一或多个附件。如果有超过一个现有附件与 选择器 相匹
           配,则其所有内容均将被 文件名 的内容替代。

           选择器 可以有四种格式。各格式说明位于下文 附件选择器 段落。

           If the option --attachment-name 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.

           If the option --attachment-mime-type 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.

           If the option --attachment-description 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.

           If the option --attachment-uid 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.

       --update-attachment selector
           Sets the properties of one or more attachments that match selector. If more than one
           existing attachment matches selector then all of their properties will be updated.

           选择器 可以有四种格式。各格式说明位于下文 附件选择器 段落。

           If the option --attachment-name 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.

           If the option --attachment-mime-type 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.

           If the option --attachment-description 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.

           If the option --attachment-uid 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.

       --delete-attachment 选择器
           删除与 选择器 相匹配的一或多个附件。

           选择器 可以有四种格式。各格式说明位于下文 附件选择器 段落。

       附件操作选项:

       --attachment-name 名称
           设置接下来 --add-attachment--replace-attachment 操作要使用的名称。

       --attachment-mime-type mime 类型
           设置接下来 --add-attachment--replace-attachment 操作要使用的 MIME 类型。

       --attachment-description 描述
           设置接下来 --add-attachment--replace-attachment 操作要使用的描述。

       其他选项:

       --command-line-charset 字符集
           设定在命令行给出的字符串的字符集,用于转为其他字符集。默认为系统当前区域设置中所给定的
           字符集。

       --output-charset 字符集
           设置输出的字符串应被转换到何种字符集。默认为系统当前区域设置中所给定的字符集。

       -r, --redirect-output 文件名
           将所有信息写入文件 文件名 而不是输出到命令行。 尽管该操作可以用输出重定向轻松实现,但
           在某些情况下还需要靠它:如当终端在写入文件之前重新解释(覆盖输出)时。将优先使用通过
           --output-charset 设定的字符集。

       --ui-language 语言代码
           强制使用语言代码为 语言代码 的翻译(如 'de_DE' 对应德文翻译)。使用 LANG, LC_MESSAGESLC_ALL 这些环境变量更好。如果在 语言代码 处输入 'list',mkvextract(1) 将输出可用翻
           译列表。

       --debug 主题
           为特定功能开启调试。该选项仅对开发者有用。

       --engage 功能
           开启实验性功能。可用功能列表可通过 mkvpropedit --engage list 得到。这些功能在正常情况
           下不应该使用。

       --gui-mode
           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 '#GUI#message'.
           The message may be followed by key/value pairs as in
           '#GUI#message#key1=value1#key2=value2...'. Neither the messages nor the keys are ever
           translated and always output in English.

       -v, --verbose
           使输出信息更详尽,且每当读取到重要的 Matroska(TM) 元素时就将其显示。

       -h, --help
           显示用法信息并退出。

       -V, --version
           显示版本信息并退出。

       --check-for-updates
           联机下载 URL http://mkvtoolnix-releases.bunkus.org/latest-release.xml 以检查新版本。将
           以 键=值 的样式输出四行: 检索信息的 URL(键 version_check_url),当前运行的版本(键
           running_version),最新版本号(键 available_version)及其下载 URL(键 download_url)。

           若无更新版本可用,程序将以退出码 0 退出,若有更新版本可用,退出码为 1,若出现错误(如
           无法检索更新信息),退出码则为 2。

           此选项仅当程序附带 libcurl 支持编译时可用。

       @选项文件
           从文件 选项文件 中读取额外的命令行参数。首个非空白字符为井号 ('#') 的行将被当作注释对
           待,在处理过程中将被忽略。各行开头与结尾的空白将被除去。各行必须恰好仅含一个选项。

           有些字符可以转义,如当您需要使用 '#' 作为一个不是评论的行的开头。规则在关于转义文本的
           段落有描述。

           命令行 'mkvpropedit 源.mkv --edit track:a2 --set name=注释' 可以转换为下述选项文件:

               # 修改 源.mkv
               源.mkv
               # 编辑第二条音频轨道
               --edit
               track:a2
               # 并设置标题为 '评论'
               --set
               name=评论

编辑选择器

       --edit 选项设置后续的 添加, 设置 或 删除 操作所影响的 Matroska(TM) 文件区域(剪辑信息或者
       特定轨道的头部)。在出现另一个 --edit 选项之前,此选项将一直有效。此选项的参数就叫做编辑选
       择器。

       默认情况下,mkvpropedit(1) 将编辑剪辑信息区段。

   剪辑信息
       可以通过这三个词中的任意一个选择剪辑信息: 'info'、'segment_info' 或 'segmentinfo'。剪辑信
       息包含的属性包括剪辑标题、剪辑 UID 等。

   轨道头部
       可用于选择轨道头部的选择器稍显复杂:所有以 'track:' 开头的变体。轨道头部属性包括如语言代
       码、'默认轨' 标记、轨道名称等属性。

       track:n
           如果参数 n 为数字,则将选择第 n 条轨道。轨道顺序与 mkvmerge(1) 的 --identify 选项所输
           出的相同。

           编号从 1 开始。

       track:tn
           如果参数以字母 t 后接 n 开头,则将选择选定轨道类型中的第 n 条轨道。轨道类型参数 t 必须
           为下述四个字母中的一个: 'a' 代表音频轨道,'b' 代表按钮轨道,'s' 代表字幕轨道,'v' 代表
           视频轨道。轨道顺序与 mkvmerge(1) 的 --identify 选项所输出的相同。

           编号从 1 开始。

       track:=uid
           如果参数以 '=' 后接 uid 开头,则将选择轨道 UID 元素等于此 uid 的轨道。轨道 UID 可通过
           mkvinfo(1) 获取。

       track:@数字
           如果参数以 '@' 后接 数字 开头,则选择轨道号元素等于 数字 的轨道。轨道号可以通过
           mkvinfo(1) 获取。

   
       由于轨道编辑选择器的特性,一些选择器所匹配的轨道头部可能是相同的。在此情况下,这些编辑选择
       器的所有操作将被按照在命令行给出的顺序合并运行。

附件选择器

       附件选择器可与两项操作 --replace-attachment--delete-attachment 一起使用。它可以有以下
       四种格式:

        1. 按附件 ID 选择。本格式的选择器仅仅是数字,mkvmerge(1) 的识别命令所输出的附件 ID。

        2. 按附件 UID (唯一 ID) 选择。本格式的选择器为等号 = 后接数字,mkvmerge(1) 的详尽识别命令
           所输出的附件的唯一 ID。

        3. 按附件名称选择。本格式的选择器为文字 name: 后接现有附件名称。若本选择器与
           --replace-attachment 一同使用,则名称中的冒号必须用 \c 转义。

        4. 按 MIME 类型选择。本格式的选择器为文字 mime-type: 后接现有附件的 MIME 类型。若本选择器
           与 --replace-attachment 一同使用,则 MIME 类型中的冒号必须用 \c 转义。

示例

       下面的示例将编辑一个名为 '电影.mkv' 的文件。示例中将设置剪辑标题并修改一条音频轨和一条字幕
       轨的语言代码。附注,本示例可以简写,即省去 --edit 选项,因为在第一个 --edit 选项之前的所有
       选项默认编辑的就是剪辑信息元素。

           $ mkvpropedit 影片.mkv --edit info --set "title=一部影片" --edit track:a1 --set language=fre --edit track:a2 --set language=ita

       第二个示例,将 '默认轨标记' 从第一条字幕轨移除并设置到第二条字幕轨上。注意 mkvpropedit(1)
       与 mkvmerge(1) 不同,不会在将另一个轨道的 '默认轨标记'设为 '1' 的时候自动将其他轨道的标记
       设为 '0'。

           $ mkvpropedit 影片.mkv --edit track:s1 --set flag-default=0 --edit track:s2 --set flag-default=1

       像这样替换文件中第二个字幕轨的标签:

           $ mkvpropedit 影片.mkv --tags track:s2:新字幕标签.xml

       移除所有标签需要将文件名留空:

           $ mkvpropedit 影片.mkv --tags all:

       像这样替换文件中的章节:

           $ mkvpropedit 影片.mkv --chapters 新章节.xml

       移除所有章节需要将文件名留空:

           $ mkvpropedit 影片.mkv --chapters ''

       将字体文件 (Arial.ttf) 作为附件添加:

           $ mkvpropedit 影片.mkv --add-attachment Arial.ttf

       将字体文件 (89719823.ttf) 作为附件添加,并提供信息,因为它真的就是 Arial:

           $ mkvpropedit 影片.mkv --attachment-name Arial.ttf --attachment-description 'Arial 字体,TrueType 类型' --attachment-mime-type application/x-truetype-font --add-attachment 89719823.ttf

       将已经附加的字体 (Comic.ttf) 替换为另一个 (Arial.ttf):

           $ mkvpropedit 影片.mkv --attachment-name Arial.ttf --attachment-description 'Arial 字体,TrueType 类型' --replace-attachment name:Comic.ttf:Arial.ttf

       删除附加的第二个文件,不论它是什么:

           $ mkvpropedit 影片.mkv --delete-attachment 2

       按 MIME 类型删除所有附加字体:

           $ mkvpropedit 影片.mkv --delete-attachment mime-type:application/x-truetype-font

退出代码

       mkvpropedit(1) 退出时会返回以下三个退出代码中的一个:

       •   0 -- 此退出代码说明已成功完成修改。

       •   1 -- 这种情况下 mkvpropedit(1) 至少输出了一条警告信息,但修改并未因之中止。 警告信息以
           文字 '警告:' 为前缀。根据问题的不同,生成的文件可能是好的,也可能不是。 强烈建议用户检
           查警告信息以及生成的文件。

       •   2 -- 此退出代码用于错误发生之后。 mkvpropedit(1) 在输出错误信息后即中断处理。错误信息
           可能是错误的命令行参数,也可能是损坏文件的读取/写入错误。

文本文件与字符集转换

       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(1) man page.

文本中特殊字符的转义

       有时文本中的特殊字符必须或应该转义。转义规则很简单: 用反斜杠后接一字符替换需要转义的各字
       符。

       规则为: ' ' (空格) 变为 '\s'、'"' (双引号) 变为 '\2'、':' 变为 '\c'、'#' 变为 '\h',而 '\'
       (单个反斜杠) 自己则变为 '\\'。

环境变量

       mkvpropedit(1) 会使用决定系统区域设置的默认变量 (如 LANGLC_* 族)。其他变量包括:

       MKVPROPEDIT_DEBUG, MKVTOOLNIX_DEBUG and its short form MTX_DEBUG
           内容将被当作通过 --debug 选项传递的参数对待。

       MKVPROPEDIT_ENGAGE, MKVTOOLNIX_ENGAGE and its short form MTX_ENGAGE
           内容将被当作通过 --engage 选项传递的参数对待。

       MKVPROPEDIT_OPTIONS, MKVTOOLNIX_OPTIONS and its short form MTX_OPTIONS
           内容将在空白处切割。最终得到的字符串部分将按命令行选项的格式处理。如果您需要传递特殊字
           符 (如空白) 则需要转义 (参见关于转义文本中特殊字符的段落)。

参阅

       mkvmerge(1), mkvinfo(1), mkvextract(1), mkvtoolnix-gui(1)

网络

       最新版本总可以在 MKVToolNix 主页[1] 找到。

作者

       Moritz Bunkus <moritz@bunkus.org>
           开发者

备注

        1. MKVToolNix 主页
           https://mkvtoolnix.download/