Provided by: mkvtoolnix_45.0.0-2_amd64
名前
mkvpropedit - 再MUXすることなく、既存のMatroskaファイルのプロパティを修正する
書式
mkvpropedit [options] {source-filename} {actions}
説明
このプログラムは、既存のMatroskaファイルを解析し、そのプロパティのいくつかを修正します。そ して、それらの修正を既存のファイルに書き込みます。プロパティの中で変更可能なのは、セグメン ト情報エレメント(例えばタイトル)と、トラックヘッダ(例えば言語コードや'デフォルトトラッ ク'フラグ、トラック名)です。 オプション: -l, --list-property-names 既知の編集可能なプロパティの名前、型(文字列、整数、真偽値等)、短い説明を一覧表示しま す。その後、プログラムは終了します。よって、source-filenameパラメータを指定する必要は ありません。 -p, --parse-mode mode 解析モードを設定します。'mode'パラメータは'fast'(デフォルト)と'full'のどちらかを指定で きます。'fast'モードはファイル全体を解析するのではなく、メタシークエレメントを使って ソースファイル内の必要なエレメントを探します。99%の場合これで十分です。しかし、メタ シークエレメントを含まないファイルや破損したファイルに対しては'full'解析モードを指定す る必要があるかもしれません。'full'スキャンには数分かかることがありますが、'fast'スキャ ンには数秒しかかかりません。 Actions that deal with track and segment info properties: -e, --edit selector このオプション以降のadd、set、deleteアクションが適用されるMatroskaファイルセクショ ン(セグメント情報または特定のトラックのヘッダ)を指定します。このオプションは、複数のエ レメントを修正するために、複数回指定することができます。 デフォルトでは、mkvpropedit(1)はセグメント情報のセクションを編集します。 文法の完全な説明は、エディットセレクタのセクションを参照してください。 -a, --add name=value nameで指定された名前のプロパティをvalueで指定した値で追加します。プロパティは、既にそ の名前のプロパティが存在する場合も追加されます。ほとんどのプロパティは一意的で、複数回 追加できないことに注意してください。 -s, --set name=value 見付けた全ての、プロパティ名がnameであるプロパティの値を、valueに設定します。そのよう なプロパティが存在しないときは、プロパティは追加されます。 -d, --delete name 見付けた全ての、プロパティ名がnameであるプロパティを削除します。いくつかのプロパティは 必須で、削除できないことに注意してください。 Actions that deal with tags and chapters: -t, --tags selector:filename ファイル名からのタグを、このファイル中のタグに追加、あるいは置換します。もしファイル名 が空白なら、タグを削除します。mkvpropedit(1)は、mkvmerge(1)が読み込むのと同じXMLタグ フォーマットを読み込みます。 セレクタは、all、global、またはtrackのうちどれか一つを指定してください。allを指定する と、mkvpropedit(1)はファイル中の全てのタグを置換あるいは削除します。globalを指定する と、グローバルタグだけが置換あるいは削除されます。 trackを指定すると、mkvpropedit(1)は特定のトラックのタグを置換します。また、filenameか ら読み込まれたタグは、同じトラックに割り当てられます。edit selectorsが指定されるのと同 じ様に(下を参照してください)、トラックは指定されます。(see below), e.g. --tags track:a1:new-audio-tags.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 filename ファイル名からのチャプタを、このファイル中のタグに追加、あるいは置換します。もしファイ ル名が空白なら、チャプタを削除します。mkvpropedit(1)は、mkvmerge(1)が読み込むのと同 じXMLまたはシンプルチャプタフォーマットを読み込みます。 Actions for handling attachments: --add-attachment filename Adds a new attachment from filename. 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 Deletes one or more attachments that match selector. The selector can have one of four forms. They're explained below in the section attachment selectors. Options for attachment actions: --attachment-name name Sets the name to use for the following --add-attachment or --replace-attachment operation. --attachment-mime-type mime-type Sets the MIME type to use for the following --add-attachment or --replace-attachment operation. --attachment-description description Sets the description to use for the following --add-attachment or --replace-attachment operation. その他のオプション: --command-line-charset 文字コード コマンドライン文字列の文字コードを指定します。デフォルトは、システムの現在のロケールの 文字コードになります。 --output-charset 文字コード 出力する文字コードを指定します。デフォルトは、システムの現在のロケールの文字コードにな ります。 -r, --redirect-output file-name 全てのメッセージをコンソールではなくfile-nameで指定したファイルに書き出します。出力リ ダイレクトによっても同じことが簡単にできますが、このオプションが必要な場合もありま す。ターミナルがファイルに書き込む前に出力を処理してしまう場合などで す。--output-charsetによって指定された文字コードは尊重されます。 --ui-language コード 指定したコード言語(例 日本語なら「ja_JP」)での翻訳を強制します。codeに「list」を指定 すると、利用可能な翻訳の一覧を出力します。 --abort-on-warnings 最初の警告が発された後プログラムを停止するよう伝えます。プログラムの終了コードは1にな ります。 --debug 項目 特定の機能のデバッグをオンにします。このオプションは開発者にのみ有用です。 --engage 機能 実験的機能をオンにします。利用可能な機能のリストはmkvpropedit --engage listで得られま す。これらの機能は通常の状況で利用されることは意図されていません。 --gui-mode GUIモードに切り替えます。このモードではGUI操作の状況を伝える特殊な形式の行が出力されま す。これらの通知は「#GUI#通知内容」という形式に従います。「#GUI#通知内 容#キー1=値1#キー2=値2...」のようにキー・値の組が通知内容に続くことがあります。通知内 容やキーは翻訳されることなく、常に英語で出力されます。 -v, --verbose 出力が冗長になり、Matroskaのエレメントにとって重要なこと全てを、読み込まれるつどに表示 していきます。 -h, --help コマンド書式情報を出力して終了します。 -V, --version バージョン情報を出力して終了します。 @オプションファイル.json オプションファイルから追加のコマンドライン引数を読み込みます。このようなファイルに対応 している形式の詳細についてはmkvmerge(1)のマニュアルページ「オプションファイル」節をご 覧ください。
エディット選択子
--editオプションは、以降のadd、set及びdeleteアクションが適用されるMatroskaファイルセクショ ン(セグメント情報または特定のトラックヘッダ)を設定します。これは次の--editオプションが見付 かるまでずっと有効です。このオプションへの引数はエディット選択子と呼ばれます。 デフォルトでは、mkvpropedit(1)はセグメント情報のセクションを編集します。 セグメント情報 セグメント情報は次の3つの単語によって選択されます。'info'、'segment_info'また は'segmentinfo'です。これはセグメントタイトルやセグメントUIDなどのプロパティを格納していま す。 トラックヘッダ トラックヘッダはもうちょっとだけ複雑なセレクタで選択されます。全ての場合でセレクタ は'track:'で始まります。トラックヘッダプロパティには、言語コード、'デフォルトトラック'フラ グやトラック名のようなエレメントがあります。 track:n パラメータnが数字であれば、n番目のトラックが選択されます。トラックの順番 は、mkvmerge(1)に--identifyオプションを指定すると出力されるものと同じです。 Numbering starts at 1. track:tn パラメータが一文字の英字tで始まり、次にnが続く場合、あるトラックタイプでn番目のトラッ クが選択されます。トラックタイプパラメータtは、オーディオトラックを示す'a'、ボタント ラックを示す'b'、字幕トラックを示す's'、ビデオトラックを示す'v'の四つのうちの一つでな ければなりません。トラックの順番はmkvmerge(1)の--identifyオプションで出力される順番と 同じです。 Numbering starts at 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). 注意 トラックエディットセレクタの性質から、いくつかのセレクタが同じトラックヘッダにマッチするこ とがあります。このような場合、それらのエディットセレクタへの全てのアクションは一つにまとめ られ、コマンドラインに指定された順番に実行されます。
添付ファイル選択子
An attachment selector is used with the two actions --replace-attachment and --delete-attachment. It can have one of the following four forms: 1. Selection by attachment ID. In this form the selector is simply a number, the attachment's ID as output by mkvmerge(1)'s identification command. 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.
例
下に'movie.mkv'というファイルを編集する例を示します。この例では、セグメントタイトルを設定 し、オーディオトラックと字幕トラックの言語コードを修正します。この例は、最初の--editオプ ションが見付かる前の全てのオプションはデフォルトで結局セグメント情報エレメントを編集するの で、最初の--editオプションを省略して短縮できることに注意してください。 $ 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)とは違い、'デフォルトトラックフラグ'が違うトラッ クで'1'に設定されているからといって自動的に他のトラックの'デフォルトトラックフラグ'を'0'に 設定はしない、という点に注意してください。 $ mkvpropedit movie.mkv --edit track:s1 --set flag-default=0 --edit track:s2 --set flag-default=1 ファイル中で2番目の字幕トラックのタグを置換するには、以下のようにします: $ 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 '' フォントファイル(VL-PGothic-Regular.ttf)を添付ファイルとして追加する。 $ mkvpropedit movie.mkv --add-attachment VL-PGothic-Regular.ttf フォントファイル(89719823.ttf)を添付ファイルとして追加し、それがVL Pゴシックであるという 情報を提供する。 $ mkvpropedit movie.mkv --attachment-name VL-PGothic-Regular.ttf --attachment-description 'VL PゴシックのTrueTypeフォント' --attachment-mime-type application/x-truetype-font --add-attachment 89719823.ttf 附属のフォントファイル(ipagp.ttf)を別のもの(VL-PGothic-Regular.ttf)に置き換える。 $ mkvpropedit movie.mkv --attachment-name VL-PGothic-Regular.ttf --attachment-description 'VL PゴシックのTrueTypeフォント' --replace-attachment name:ipagp.ttf:VL-PGothic-Regular.ttf 2番目の添付ファイルを、それが何であれ削除する。 $ mkvpropedit movie.mkv --delete-attachment 2 MIMEタイプによって全ての附属フォントを削除する。 $ mkvpropedit movie.mkv --delete-attachment mime-type:application/x-truetype-font
返り値
mkvpropedit(1)は下の3つの返り値を返します。 • 0 -- この返り値は変更が成功したことを示します。 • 1 -- この返り値は、一つ以上の警告が出力されましたが、抽出が続行されたことを意味しま す。警告は '警告:' という文字列を先頭につけて出力されます。出力ファイルが無事であるか どうかは、場合によります。出力ファイルを確認することを強く推奨します。 • 2 -- この返り値は、エラーが発生し、エラーメッセージを表示した直後にmkvpropedit(1)が終 了したことを示します。エラーメッセージは不正なコマンドラインやファイルI/Oエラー、壊れ たファイルなど様々です。
テキストファイルと文字コード変換
MKVToolNixスイートの全てのツールが文字コード変換・入出力に係る文字コード・コマンドライン及 びコンソール上の文字コードをどのように処理するかについての詳細な議論について は、mkvmerge(1) man ページの同名の節を参照して下さい。
環境変数
mkvpropedit(1)はシステムのロケールを決めるデフォルトの変数(例:LANGやLC_*系)を使用しま す。追加の変数は以下の通りです: MKVPROPEDIT_DEBUG,MKVTOOLNIX_DEBUGとその短縮形MTX_DEBUG その内容は、あたかも--debugオプション経由で渡されたかのように扱われます。 MKVPROPEDIT_ENGAGE,MKVTOOLNIX_ENGAGEとその短縮形MTX_ENGAGE その内容は、あたかも--engageオプション経由で渡されたかのように扱われます。
関連項目
mkvmerge(1), mkvinfo(1), mkvextract(1), mkvtoolnix-gui(1)
ウェブ
最新のバージョンは、常時MKVToolNixのホームページ[1]から取得できます。
著者
Bunkus Moritz[FAMILY Given] <moritz@bunkus.org> 開発者
注記
1. MKVToolNixのホームページ https://mkvtoolnix.download/