Provided by: mkvtoolnix_19.0.0-1_amd64 

名前
mkvextract - Matroska ファイルから、他の形式のファイルを抽出する
書式
mkvextract {source-filename} {mode1} [options] [extraction-spec1] [mode2] [options] [extraction-spec2]
[...]
説明
This program extracts specific parts from a Matroska file to other useful formats. The first argument is
the name of the source file which must be a Matroska file.
All other arguments either switch to a certain extraction mode, change options for the currently active
mode or specify what to extract into which file. Multiple modes can be used in the same invocation of
mkvextract allowing the extraction of multiple things in a single pass. Most options can only be used in
certain modes with a few options applying to all modes.
Currently supported is the extraction of tracks, tags, attachments, chapters, CUE sheets, timestamps and
cues.
共通オプション
以下のオプションは、全てのmodeで使用できるので、このセクションで一括して説明します。
-f, --parse-fully
解析モードを'full'に設定します。デフォルトのモードでは、ソースファイルの必要な要素を見つけるのにファ
イル全体を解析せずにメタシーク要素を使用します。99%のケースではこれで十分ですが、メタシーク要素が含ま
れていなかったり壊れていたりするファイルにはこのモードを使用しなければならないかもしれません。高速ス
キャンが数秒しかかからないのに対して、ファイルをフルスキャンするのには数分かかることがあります。
--command-line-charset character-set
コマンドライン文字列の文字コードを指定します。デフォルトは、システムの現在のロケールの文字コードにな
ります。
--output-charset character-set
出力する文字コードを指定します。デフォルトは、システムの現在のロケールの文字コードになります。
-r, --redirect-output file-name
全てのメッセージを、コンソールではなくfile-nameに書き出します。出力をリダイレクトすることで同じことが
容易に可能ですが、このオプションが必要になることもあります。ターミナルが出力を、ファイルに書き出す前
に処理してしまう場合などです。--output-charsetによって指定された文字コードは尊重されます。
--ui-language code
Forces the translations for the language code to be used (e.g. 'de_DE' for the German translations).
Entering 'list' as the code will cause the program to output a list of available translations.
--debug topic
特定の機能のデバッグをオンにします。このオプションは開発者にのみ有用です。
--engage feature
実験的機能をオンにします。利用可能な機能のリストは mkvextract --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のエレメントにとって重要なこと全てを、読み込まれるつどに表示していきます。
-h, --help
コマンド書式情報を出力して終了します。
-V, --version
バージョン情報を出力して終了します。
@options-file.json
Reads additional command line arguments from the file options-file. For a full explanation on the
supported formats for such files see the section called "Option files" in the mkvmerge(1) man page.
トラック抽出モード
Syntax: mkvextract source-filename tracks [options] TID1:dest-filename1 [TID2:dest-filename2 ...]
以下のコマンドラインオプションは、トラック抽出モードでは各トラック毎に指定することができます。これらのオ
プションは、作用するトラック指定子(下記参照)の前に指定しなければなりません。
-c character-set
直後の字幕トラックの出力文字コードを指定します。直後のトラックIDが指すのが、字幕トラックのときのみ有
効です。デフォルトはUTF-8になります。
--blockadd level
このレベルまでのBlockAdditionを保持します。デフォルトでは全て保持します。このオプションは、WAVPACK4な
どの特定のコーデックにのみ有効です。
--cuesheet
mkvextract(1)に、直後のトラックのチャプタ情報とタグデータからCUEシートを生成します。出力ファイルの名
前はトラックの出力名に'.cue'をつけたものになります。
--raw
コンテナ情報を含まない、rawデータをファイルに抽出します。--fullrawフラグとは違い、このフラグ
はCodecPrivate要素の内容はファイルに書き出しません。このモードは、mkvextract(1)がサポートしないものも
含めて全てのCodecIDで使用できますが、出力されたファイルは使用できないかもしれません。
--fullraw
コンテナ情報を含まない、rawデータをファイルに抽出します。トラックがCodecPrivate要素のヘッダ情報を含む
場合、その内容はファイルの先頭に書き出されます。このモードは、mkvextract(1)がサポートしないCodecIDに
も使用できますが、出力されたファイルは使用できないかもしれません。
TID:outname
IDがTIDであるトラックがソースファイルに存在すれば、outnameに抽出します。このオプションは複数回指定で
きます。トラックIDは、mkvmerge(1)に--identifyを指定して実行した際の出力に表示されるものと同じです。
各出力ファイル名は一回しか使用されません。RealAudio及びRealVideoトラックは例外です。もし、異なるト
ラックに同じファイル名が指定された場合、それらは同一のファイルに保存されます。例:
$ mkvextract input.mkv tracks 0:video.h264 2:output-two-vobsub-tracks.idx 3:output-two-vobsub-tracks.idx
添付ファイル抽出モード
Syntax: mkvextract source-filename attachments [options] AID1:outname1 [AID2:outname2 ...]
AID:outname
IDがAIDである添付ファイルがもしソースファイルに存在すれば抽出します。outnameが指定されない場
合、Matroskaに格納された添付ファイルの名前が使用されます。このオプションは複数回指定できます。添付
ファイルIDは、mkvmerge(1)に--identifyオプションを指定したときに出力されるものと同じです。
チャプタ抽出モード
Syntax: mkvextract source-filename chapters [options] output-filename.xml
-s, --simple
チャプタ情報をOGM toolsで使用される、シンプルフォーマット(CHAPTER01=..., CHAPTER01NAME=...)で出力しま
す。このモードでは、一部の情報は破棄されます。デフォルトでは、チャプタはXMLフォーマットで出力されま
す。
--simple-language language
If the simple format is enabled then mkvextract(1) will only output a single entry for each chapter
atom encountered even if a chapter atom contains more than one chapter name. By default mkvextract(1)
will use the first chapter name found for each atom regardless of its language.
Using this option allows the user to determine which chapter names are output if atoms contain more
than one chapter name. The language parameter must be an ISO 639-1 or ISO 639-2 code.
The chapters are written to specified output file. By default the XML format understood by mkvmerge(1) is
used. If no chapters are found in the file, the output file is not created.
タグ抽出モード
Syntax: mkvextract source-filename tags [options] output-filename.xml
The tags are written to specified output file in the XML format understood by mkvmerge(1). If no tags are
found in the file, the output file is not created.
CUEシート抽出モード
Syntax: mkvextract source-filename cuesheet [options] output-filename.cue
The cue sheet is written to specified output file. If no chapters or tags are found in the file, the
output file is not created.
タイムコード抽出モード
Syntax: mkvextract source-filename timestamps_v2 [options] TID1:dest-filename1 [TID2:dest-filename2 ...]
TID:outname
IDがTIDであるトラックがソースファイルに存在すれば、タイムコードをoutnameに抽出します。このオプション
は複数回指定できます。トラックIDは、mkvmerge(1)に--identifyを指定して実行した際の出力に表示されるもの
と同じです。
例:
$ mkvextract input.mkv timestamps_v2 1:ts-track1.txt 2:ts-track2.txt
Cues extraction mode
Syntax: mkvextract source-filename cues [options] TID1:dest-filename1 [TID2:dest-filename2 ...]
TID:dest-filename
Causes extraction of the cues for the track with the ID TID into the file outname if such a track
exists in the source file. This option can be given multiple times. The track IDs are the same as the
ones output by mkvmerge(1)'s --identify option and not the numbers contained in the CueTrack element.
The format output is a simple text format: one line per CuePoint element with key=value pairs. If an
optional element is not present in a CuePoint (e.g. CueDuration) then a dash will be output as the
value.
例:
timestamp=00:00:13.305000000 duration=- cluster_position=757741 relative_position=11
The possible keys are:
timestamp
The cue point's timestamp with nanosecond precision. The format is HH:MM:SS.nnnnnnnnn. This element
is always set.
duration
The cue point's duration with nanosecond precision. The format is HH:MM:SS.nnnnnnnnn.
cluster_position
The absolute position in bytes inside the Matroska file where the cluster containing the referenced
element starts.
注記
Inside the Matroska file the CueClusterPosition is relative to the segment's data start offset.
The value output by mkvextract(1)'s cue extraction mode, however, contains that offset already
and is an absolute offset from the beginning of the file.
relative_position
The relative position in bytes inside the cluster where the BlockGroup or SimpleBlock element the cue
point refers to starts.
注記
Inside the Matroska file the CueRelativePosition is relative to the cluster's data start offset.
The value output by mkvextract(1)'s cue extraction mode, however, is relative to the cluster's
ID. The absolute position inside the file can be calculated by adding cluster_position and
relative_position.
例:
$ mkvextract input.mkv cues 1:cues-track1.txt 2:cues-track2.txt
例
Extracting both chapters and tags in their respective XML formats at the same time:
$ mkvmerge movie.mkv chapters movie-chapters.xml tags movie-tags.xml
Extracting a couple of tracks and their respective timestamps at the same time:
$ mkvmerge "Another Movie.mkv" tracks 0:video.h265 "1:main audio.aac" "2:director's comments.aac" timestamps_v2 "0:timestamps video.txt" "1:timestamps main audio.txt" "2:timestamps director's comments.txt"
Extracting chapters in the Ogg/OGM format and re-encoding a text subtitle track to another character set:
$ mkvmerge "My Movie.mkv" chapters --simple "My Chapters.txt" tracks -c MS-ANSI "2:My Subtitles.srt"
テキストファイルと文字コード変換
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.
出力ファイルフォーマット
出力ファイルのフォーマットの決定は、トラックの種類によって決まり、出力ファイル名の拡張子は使用されませ
ん。現在、以下の種類のトラックがサポートされています。
A_AAC/MPEG2/*, A_AAC/MPEG4/*, A_AAC
全てのAACファイルは、ADTSヘッダを各パケットの前に追加されたうえでAACファイルに書き出されま
す。ADTSヘッダは、廃止予定であるエンファシスフィールドを含みません。
A_AC3, A_EAC3
These will be extracted to raw AC-3 files.
A_ALAC
ALAC tracks are written to CAF files.
A_DTS
These will be extracted to raw DTS files.
A_FLAC
FLAC tracks are written to raw FLAC files.
A_MPEG/L2
MPEG-1 Audio Layer II streams will be extracted to raw MP2 files.
A_MPEG/L3
These will be extracted to raw MP3 files.
A_OPUS
Opus tracks are written to OggOpus files.
A_PCM/INT/LIT, A_PCM/INT/BIG
Raw PCM data will be written to a WAV file. Big-endian integer data will be converted to
little-endian data in the process.
A_REAL/*
RealAudioトラックはRealMediaファイルに書き出されます。
A_TRUEHD, A_MLP
These will be extracted to raw TrueHD/MLP files.
A_TTA1
TrueAudioトラックはTTAファイルに書き出されます。Matroskaのタイムコード精度の上限のため、抽出された
ファイルのヘッダは、data_lengthフィールド(ファイルに含まれる総サンプル数)とCRCについては不正確になり
ます。
A_VORBIS
Vorbis audioはOggVorbisファイルに書き出されます。
A_WAVPACK4
WavPack tracks are written to WV files.
S_HDMV/PGS
PGS subtitles will be written as SUP files.
S_HDMV/TEXTST
TextST subtitles will be written as a special file format invented for mkvmerge(1) and mkvextract(1).
S_KATE
KateストリームはOggコンテナに格納されます。
S_TEXT/SSA, S_TEXT/ASS, S_SSA, S_ASS
SSA及びASSテキスト字幕は、それぞれSSA、ASSファイルに書き出されます。
S_TEXT/UTF8, S_TEXT/ASCII
シンプル・テキスト字幕はSRTファイルに書き出されます。
S_VOBSUB
VobSub subtitles will be written as SUB files along with the respective index files, as IDX files.
S_TEXT/USF
USF text subtitles will be written as USF files.
S_TEXT/WEBVTT
WebVTT text subtitles will be written as WebVTT files.
V_MPEG1, V_MPEG2
MPEG-1 and MPEG-2 video tracks will be written as MPEG elementary streams.
V_MPEG4/ISO/AVC
H.264/AVCビデオトラックは、H.264エレメンタリ・ストリームに書き出されます。これは例えばGPACパッケージ
に含まれる、MP4Boxなどにより処理できます。
V_MPEG4/ISO/HEVC
H.265 / HEVC video tracks are written to H.265 elementary streams which can be processed further with
e.g. MP4Box from the GPAC package.
V_MS/VFW/FOURCC
このCodecIDをもつ、固定FPSビデオトラックはAVIファイルに書き出されます。
V_REAL/*
RealVideoトラックは、RealMediaファイルに書き出されます。
V_THEORA
Theora streams will be written within an Ogg container
V_VP8, V_VP9
VP8 / VP9 tracks are written to IVF files.
タグ
タグは、XMLフォーマットに変換されます。このフォーマットはmkvmerge(1)でタグを読み込む際のフォーマット
と同じです。
添付ファイル
添付ファイルはそのままの形式で出力ファイルに書き出されます。変換等の処理は全く行われません。
チャプタ
チャプタはXMLフォーマットに変換されます。このフォーマットはmkvmerge(1)がチャプタを読み込む際のフォー
マットと同じです。他にも、簡略化されたOGMスタイルのフォーマットで出力することもできます。
タイムコード
タイムコードはまず整列された後に、mkvmerge(1)で読み込むことのできる timestamp v2 形式に準拠するファイ
ルに書き出されます。他の形式(v1, v3, v4)への抽出はサポートされていません。
返り値
mkvextract(1)は下の3つの返り値を返します。
• 0 -- この返り値は抽出が成功したことを意味します。
• 1 -- この返り値は、一つ以上の警告が出力されましたが、抽出が続行されたことを意味します。警告は '警告:'
という文字列を先頭につけて出力されます。出力ファイルが無事であるかどうかは、場合によります。出力ファ
イルを確認することを強く推奨します。
• 2 -- この返り値は、エラーが発生し、エラーメッセージを出力した後にmkvextract(1)が処理を中断したことを
示します。エラーメッセージは不正なコマンドラインやファイルI/Oエラー、壊れたファイルなど様々です。
テキスト中の特殊文字をエスケープする
特殊文字をエスケープしなければならない、あるいはすべき場所が少しだけあります。エスケープのルールは単純で
す:エスケープする必要のある各文字を、バックスラッシュ(Windows上の日本語フォントでは\記号)の後ろに違う
文字が1つついたものと入れ替えます。
ルール:' '(半角スペース)は'\s'に、'"'(ダブルクォーテーション)は'\2'に、':'は'\c'に、'#'は'\h'に、そ
して'\'それ自体は'\\'になります。
環境変数
mkvextract(1)はシステムのロケールを決めるデフォルトの変数(例:LANGやLC_*系)を使用します。追加の変数は以
下の通りです:
MKVEXTRACT_DEBUG, MKVTOOLNIX_DEBUG and its short form MTX_DEBUG
その内容は、あたかも--debugオプション経由で渡されたかのように扱われます。
MKVEXTRACT_ENGAGE, MKVTOOLNIX_ENGAGE and its short form MTX_ENGAGE
その内容は、あたかも--engageオプション経由で渡されたかのように扱われます。
MKVEXTRACT_OPTIONS, MKVTOOLNIX_OPTIONS and its short form MTX_OPTIONS
内容は空白で分割されます。得られた一部の文字列は、あたかもそれがコマンドラインオプションとして渡され
たかのように扱われます。もし特殊な文字(例:空白)を渡す必要があるなら、それらをエスケープする必要が
あります(テキスト中の特殊文字のエスケープについてのセクションをご覧ください)。
関連項目
mkvmerge(1), mkvinfo(1), mkvpropedit(1), mkvtoolnix-gui(1)
ウェブ
最新のバージョンは、常時MKVToolNixのホームページ[1]から取得できます。
著者
Bunkus Moritz[FAMILY Given] <moritz@bunkus.org>
開発者
注記
1. MKVToolNixのホームページ
https://mkvtoolnix.download/
MKVToolNix 19.0.0 2017-12-17 MKVEXTRACT(1)