mkvpropedit -- Змінити властивості існуючих файлів Matroska(tm) без повного перезбирання

Table of contents

1. Короткий опис

mkvpropedit options {source-filename} {actions}

2. Опис

Ця програма аналізує існуючий файл Matroska(tm) і змінює деякі його властивості. Потім він записує ці зміни в існуючий файл. Серед властивостей, які можна змінити, є елементи інформації про сегменти (наприклад, назва) і заголовки доріжок (наприклад, код мови, прапор «доріжка за замовчуванням» або назва).

Налаштування:

Option Description
-l, --list-property-names

Lists all known and editable property names, their type (string, integer, boolean etc) and a short description. The program exits afterwards. Therefore the source-filename parameter does not have to be supplied.

-p, --parse-mode mode

Sets the parse mode. The parameter 'mode' can either be 'fast' (which is also the default) or 'full'. The 'fast' 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 'full' parse mode. A full scan of a file can take a couple of minutes while a fast scan only takes seconds.

Дії, які впливають на інформаційні властивості доріжки та сегменту:

Option Description
-e, --edit selector

Sets the Matroska(tm) file section (segment information or a certain track's headers) that all following add, set and delete actions operate on. This option can be used multiple times in order to make modifications to more than one element.

За замовчуванням mkvpropedit(1) відредагує розділ інформації про сегмент.

Дивіться розділ про редагування селекторів для повного опису синтаксу.

-a, --add name=value

Adds a property name with the value value. The property will be added even if such a property exists already. Note that most properties are unique and cannot occur more than once.

-s, --set name=value

Sets all occurrences of the property name to the value value. If no such property exists then it will be added.

-d, --delete name

Deletes all occurrences of the property name. Note that some properties are required and cannot be deleted.

Дії, які впливають на теги та глави:

Option Description
-t, --tags selector:filename

Add or replace tags in the file with the ones from filename or remove them if filename is empty. mkvpropedit(1) reads the same XML tag format that mkvmerge(1) reads as well.

The selector must be one of the words all, global or track. For all mkvpropedit(1) will replace or remove all tags in a file. With global only global tags will be replaced or removed.

With track mkvpropedit(1) will replace tags for a specific track. Additionally the tags read from filename will be assigned to the same track. The track is specified in the same way edit selectors are specified (see below), e.g. --tags track:a1:new-audio-tags.xml.

--add-track-statistics-tags

Обчислює статистику для всіх доріжок у файлі та додає для них нові теги статистики. Якщо файл уже містить такі теги, вони будуть оновлені.

--delete-track-statistics-tags

Видаляє всі наявні теги статистики доріжки з файлу. Якщо файл не містить тегів статистики відстеження, він не буде змінено.

-c, --chapters filename

Add or replace chapters in the file with the ones from filename or remove them if filename is empty. mkvpropedit(1) reads the same XML and simple chapter formats that mkvmerge(1) reads as well.

Дії для обробки вкладень:

Option Description
--add-attachment filename

TID:outname

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

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

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

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 selector:filename

Replaces one or more attachments that match selector with the file filename. If more than one existing attachment matches selector then all of their contents will be replaced by the content of filename.

The selector can have one of four forms. They're explained below in the section attachment selectors.

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.

The selector can have one of four forms. They're explained below in the section attachment selectors.

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 selector

Видаляє одне або кілька вкладень, які відповідають селектору.

The selector can have one of four forms. They're explained below in the section attachment selectors.

Опції дій з вкладенням:

Option Description
--attachment-name name

Встановлює назву для наступної операції --add-attachment або --replace-attachment.

--attachment-mime-type mime-type

Встановлює тип MIME для використання для наступної операції --add-attachment або --replace-attachment .

--attachment-description description

Встановлює опис для наступної операції --add-attachment або --replace-attachment.

Інші опції:

Option Description
--disable-language-ietf

Normally when the user requests changes to the 'language' track header property, mkvpropedit(1) will apply the same change to the new LanguageIETF track header element in addition to the legacy Language element. If this option is used, the change is only applied to the legacy Language element.

Ця опція не впливає на зміни, запитувані через властивість 'language-ietf' заголовка треку.

--command-line-charset character-set

Встановлює набір символів заданого в командному рядку для конвертації. Типово використовується набір символів згідно поточної локалі системи.

--output-charset character-set

Встановлює вихідний набір символів заданого в командному рядку для конвертації. Типово використовується набір символів згідно поточної локалі системи.

-r, --redirect-output file-name

Записує всі повідомлення у файл file-name, замість консолі. Хоча це можна легко зробити за допомогою переспрямування виводу, є випадки, коли ця опція потрібна: коли термінал повторно інтерпретує вихід перед записом його у файл. Набір символів встанвлений з --output-charset враховується.

--ui-language code

Задає примусове використання мовного перекладу code інтерфейсу (наприклад, 'de_DE' для німецького перекладу). Після введення list' як code програма відобразить список доступних перекладів.

--abort-on-warnings

Повідомляє програмі припинити роботу після першого попередження. Код виходу з програми буде 1.

--debug topic

Увімкнути налагодження для певної функції. Ця опція корисна лише для розробників.

--engage feature

Вмикає експериментальні функції. Список доступних функцій можна запросити за допомогою mkvpropedit --engage list. Ці функції не призначені для використання в звичайних ситуаціях.

--gui-mode

Вмикає режим графічного інтерфейсу. У цьому режимі можуть бути виведені спеціально відформатовані рядки, які можуть повідомляти керуючому графічному інтерфейсу, що відбувається. Ці повідомлення мають формат '#GUI#message'. За повідомленням можуть слідувати пари ключ/значення, як у '#GUI#message#key1=value1#key2=value2…'. Ані повідомлення, ані ключі ніколи не перекладаються і завжди виводяться англійською.

-v, --verbose

Задає відображення розширеної інформації про важливі елементи Matroska(tm).

-h, --help

Відображається інформація про використання додатку і відбувається завершення роботи додатку.

-V, --version

Відображається інформація про версію додатку і відбувається завершення роботи додатку.

@options-file.json

Читає додаткові аргументи командного рядка з файлу options-file. Повне пояснення про підтримувані формати для таких файлів див. розділ "Файли опцій" у посібнику користувача mkvmerge(1).

3. Редагувати селектори

The --edit option sets the Matroska(tm) file section (segment information or a certain track's headers) that all following add, set and delete actions operate on. This stays valid until the next --edit option is found. The argument to this option is called the edit selector.

За замовчуванням mkvpropedit(1) відредагує розділ інформації про сегмент.

3.1. Інформація про сегменти

The segment information can be selected with one of these three words: 'info', 'segment_info' or 'segmentinfo'. It contains properties like the segment title or the segment UID.

3.2. Заголовки доріжки

Track headers can be selected with a slightly more complex selector. All variations start with 'track:'. The track header properties include elements like the language code, 'default track' flag or the track's name.

Option Description
track:n

If the parameter n is a number then the nth track will be selected. The track order is the same that mkvmerge(1)'s --identify option outputs.

Нумерування починається з 1.

track:tn

If the parameter starts with a single character t followed by a n then the nth track of a specific track type will be selected. The track type parameter t must be one of these four characters: 'a' for an audio track, 'b' for a button track, 's' for a subtitle track and 'v' for a video track. The track order is the same that mkvmerge(1)'s --identify option outputs.

Нумерування починається з 1.

track:=uid

If the parameter starts with a '=' followed by a number uid, the track whose track UID element equals the given uid will be selected. Track UIDs can be obtained with mkvinfo(1).

track:@number

If the parameter starts with a '@' followed by a number number, the track whose track number element equals this number will be selected. Track numbers can be obtained with mkvinfo(1).

3.3. Примітки

Через природу селекторів редагування доріжок можливо, що кілька селекторів дійсно відповідають одному і тому заголовку доріжки. У таких випадках усі дії для цих селекторів редагування будуть об’єднані та виконані в тому порядку, у якому вони вказані в командному рядку.

4. Вкладення

An attachment selector is used with the two actions --replace-attachment and --delete-attachment. It can have one of the following four forms:

  1. Вибір за ідентифікатором вкладення. У цій формі селектор — це просто число, ідентифікатор вкладення, який виводить команда ідентифікації mkvmerge(1).

  2. Selection by attachment UID (unique ID). In this form the selector is the equal sign = followed by a number, the attachment's unique ID as output by mkvmerge(1)'s verbose identification command.

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

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

5. Приклади

The following example edits a file called 'movie.mkv'. 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 --edit option because editing the segment information element is the default for all options found before the first --edit option anyway.

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

Другий приклад видаляє «прапор доріжка за замовчуванням» з першої доріжки субтитрів і встановлює його для другої. Зауважте, що mkvpropedit(1), на відміну від mkvmerge(1), не встановлює «прапор доріжка за замовчуванням» для інших доріжок на «0», якщо для деякої доріжки автоматично встановлено значення «1».

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

Заміна тегів для другої доріжки субтитрів у файлі виглядає так:

$ mkvpropedit movie.mkv --tags track:s2:new-subtitle-tags.xml

Щоб видалити всі теги, потрібно залишити ім’я файлу:

$ mkvpropedit movie.mkv --tags all:

Заміна глав у файлі виглядає так:

$ mkvpropedit movie.mkv --chapters new-chapters.xml

Щоб видалити всі глави, потрібно залишити ім’я файлу:

$ mkvpropedit movie.mkv --chapters ''

Додавання файла шрифта (Arial.ttf) у якості вкладення:

$ mkvpropedit movie.mkv --add-attachment Arial.ttf

Додавання файла шрифта (89719823.ttf) у якості вкладення і надання деякої інформації, оскільки це насправді просто Arial:

$ 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

Заміна одного файла шрифту вкладення (Comic.ttf) іншим (Arial.ttf):

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

Видалення другого вкладеного файлу, яким би він не був:

$ mkvpropedit movie.mkv --delete-attachment 2

Видалення всіх вкладених шрифтів за типом MIME:

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

6. Коди завершення

mkvpropedit; завершає роботу з одним з трьох кодів виходу:

7. Текстові файли та перетворення набору символів

Для детального ознайомлення з тим, як усі інструменти в пакеті MKVToolNix виконують перетворення набору символів, кодування введення/виводу, кодування командного рядка та консольне кодування, будь ласка, перегляньте розділ з ідентичною назвою в посібнику користувача mkvmerge(1)

8. Змінні середовища

mkvpropedit(1) використовує змінні за замовчуванням, які визначають локаль системи (сімейства типу LANG і LC_*). Додаткові змінні:

Option Description
MKVPROPEDIT_DEBUG, MKVTOOLNIX_DEBUG і їх коротка форма MTX_DEBUG

Вміст розглядається так, ніби його було передано за допомогою параметра --debug.

MKVPROPEDIT_ENGAGE, MKVTOOLNIX_ENGAGE і їх коротка форма MTX_ENGAGE

Вміст розглядається так, ніби його було передано за допомогою параметра --engage.

9. Дивіться також

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

10. WWW

Остання версія завжди може бути знайдена на веб-сторінці MKVToolNix.