mkvextract -- estrai le tracce da Matroska(tm) negli altri file

Table of contents

1. Sinossi

mkvextract {nome-file sorgente} {modalità1} opzioni extraction-spec1 modalità2 opzioni extraction-spec2 …

2. Descrizione

Questo programma estrae parti specifiche da un file Matroska(tm) in altri formati utilizzabili. Il primo argomento è il nome del file sorgente che deve essere un file Matroska(tm).

Tutti gli altri argomenti abilitano una certa modalità di estrazione, cambiano le opzioni per la modalità corrente attiva o specificano cosa estrarre in che file. Modalità multiple possono essere richiamate abilitando la possibilità di estrarre cose diverse in un solo comando. La maggior parte delle opzioni possono essere usate solo in certe modalità con poche opzioni applicabili a tutte le modalità.

Supportata l'estrazione di tracce, tag, allegati, capitoli, CUE sheets, marcature orarie e cues.

2.1. Opzioni comuni

Le opzioni seguenti sono disponibili in tutte le modalità e sono descritte in questa sezione.

Option Description
-f, --parse-fully

Imposta la modalità di analisi in 'totale'. La modalità di base non analizza l'intero file ma usa gli elementi di meta-ricerca per localizzare gli elementi richiesti del file sorgente. Nel 99% dei casi questo basta. Ma per file che non contengono elementi di meta-ricerca o che sono danneggiati è possibile utilizzare questa modalità. Una scansione totale può impiegare una manciata di minuti mentre una scansione rapida ci mette qualche secondo.

--command-line-charset character-set

Imposta il set caratteri per convertire le stringhe date dalla riga di comando. Di base è impostato dalla lingua di sistema.

--output-charset character-set

Imposta il set caratteri per le stringhe convertite date in output. Di base è impostato dalla lingua di sistema.

-r, --redirect-output file-name

Scrive tutti i messaggi nel file file-name invece che sul terminale. Mentre questo può essere fatto con la redirezione dell'output ci sono casi che questa opzione può essere necessaria: quando il terminale reinterpreta l'output prima di scriverlo in un file. Il set caratteri impostato con--output-charset è onorato.

--flush-on-close

Indica al programma di scaricare tutti i dati memorizzati nella memoria nello storage quando si chiudono i file aperti in scrittura. Questo può essere usato per prevenire la perdita di dati in caso di interruzioni di corrente o per eludere determinati problemi nel sistema operativo o nei driver. Il rovescio della medaglia è che il multiplexing richiederà più tempo poiché mkvmerge attenderà fino a quando tutti i dati non saranno stati scritti nella memoria prima di uscire. Vedi riferimenti #2469 e #2480 nel tracker bug MKVToolNix per discussioni approfondite su pro e contro.

--ui-language code

Forza le traduzioni per la lingua code da usare (per esempio: 'it_IT' per le traduzioni in Italiano). Immettendo 'list' come code mostrerà la lista delle traduzioni disponibili.

--abort-on-warnings

Indica al programma di interrompere dopo il primo avviso. Il codice di uscita del programma sarà 1.

--debug argomento

Abilita il debug per una funzionalità. Questa opzione è utile per gli sviluppatori.

--engage funzionalità

Abilita le funzionalità sperimentali. La lista delle funzionalità disponibili può essere mostrata col comando mkvextract --engage list. Queste funzionalità non sono previste per l'utilizzo normale del programma.

--gui-mode

Mostra la GUI (interfaccia grafica). In questa modalità a terminale ci saranno delle righe specifiche su cosa sta succedendo. Questi messaggi seguiranno il formato '#GUI#messaggio'. Il messaggio può essere seguito da delle coppie chiave/valore come '#GUI#messaggio#chiave1=valore1#chiave2=valore2…'. Né i messaggi e né le chiavi saranno mai tradotte e l'output sarà sempre in Inglese.

-v, --verbose

Sii prolisso e mostra tutti gli elementi Matroska(tm) importanti quando vengono letti.

-h, --help

Mostra l'aiuto ed esci.

-V, --version

Mostra la versione ed esci.

@options-file.json

Legge gli argomenti a riga di comando dal file options-file. Per una spiegazione completa sul formato supportato vedere la sezione "File di Opzioni" nel manuale di mkvmerge(1).

2.2. Modalità di estrazione traccia

Sintassi: mkvextract nomefile-sorgente tracce [opzioni] TID1:nomefile-destinazione1 [TID2:nomefile-destinazione2 ...]

Le seguenti opzioni sono disponibili per ogni traccia nella modalità di estrazione 'tracks. Devono apparire davanti alla traccia specifica (vedi giù) a cui deve essere applicata.

Option Description
-c character-set

Imposta il set di caratteri da convertire nella traccia dei sottotitoli. È valido se l'ID della traccia successiva è un sottotitolo. Di base è UTF-8.

--blockadd livello

Tieni solo il i BlockAdditions su questo livello. Di base è su tutti i livelli. Questa opzione riguarda solo certi tipi di codec tipo il WAVPACK4.

--cuesheet

Causa mkvextract(1) di estrarre un CUE sheet dalle informazioni del capitolo e dai dati tag per la seguente traccia in un file il cui nome è il nome della traccia con l'estensione '.cue'.

--raw

Estrae i dati raw in un file senza dati contenitore. Differentemente dall'opzione --fullraw, questa opzione non causa che i contenuti dell'elementoCodecPrivate vengano scritti nel file. Questa modalità funziona con tutti i CodecID, pure quelli che mkvextract(1) non supporta, ma il risultato potrebbe non essere utilizzabile.

--fullraw

Estrae i dati raw in un file senza dati contenitore. I contenuti dell'elemento CodecPrivate saranno scritti nel file per primi se la traccia contiene quell'elemento header. Questa modalità funziona con tutti i CodecID, pure quelli che mkvextract(1) non supporta, ma il risultato potrebbe non essere utilizzabile.

TID:outname

Causa l'estrazione della traccia con ID TID nel file outname se quella traccia esiste file file sorgente. Questa opzione può essere usata più volte. Gli ID della traccia sono gli stessi dell'output dato dal risultato mkvmerge(1) --identify.

Ogni nome in output deve essere univoco. Le eccezioni sono le tracce RealAudio e RealVideo. Se viene utilizzato lo stesso nome per tracce differenti, quelle tracce verranno salvate nello stesso file. Per esempio:

$ mkvextract input.mkv tracks 0:video.h264 2:output-two-vobsub-tracks.idx 3:output-two-vobsub-tracks.idx

2.3. Modalità di estrazione allegati

Sintassi: mkvextract file-sorgente allegati [opzioni] AID1:filediuscita1 [AID2:filediuscita2 ...]

Option Description
AID:filediuscita

Provoca l'estrazione dell'allegato con l'ID AID nel file nomefiledestinazione se tale allegato esiste nel file sorgente. Se nomedestinazione viene lasciato vuoto, allora il nome dell'allegato all'interno della sorgente Matroska(tm) al suo posto verrà usato il file. Questa opzione può essere data più volte. Gli ID degli allegati sono gli stessi di quelli generati dall'opzione --identify di mkvmerge(1).

2.4. Modalità di estrazione capitoli

Sintassi: mkvextract file-sorgente capitoli [opzioni] file-di-uscita.xml

Option Description
-s, --simple

Esporta le informazioni del capitolo nel formato semplificato dagli strumenti OGM (CAPITOLO01=..., NOMECAPITOLO01=...). In questa modalità alcune informazioni devono venire scartate. L'output predefinito dei capitoli è in formato XML.

--simple-language lingua

Se il formato semplificato è abilitato allora mkvextract(1) creerà una voce singola per ogni capitolo trovato, anche se un capitolo atom contiene più di un nome per capitolo. Di base mkvextract(1) userà il primo capitolo trovato per ogni atom a prescindere dalla lingua.

Usando questa opzione si dà la possibilità all'utente di determinare quali nomi dei capitoli vengono usati se l'atom contiene più di un nome per capitolo. Il parametro lingua deve essere ISO 639-1 oppure ISO 639-2.

I capitoli vengono salvati in un file specifico. Il formato predefinito è XML formato usato da mkvmerge(1). Se nessun capitolo viene trovato, questo file non verrà creato.

2.5. Modalità di estrazione tag

Sintassi: mkvextract nomefile-sorgente tags [opzioni] filename-di-output.xml

I tag vengono salvati in un file specifico. Il formato predefinito è XML formato usato da mkvmerge(1). Se nessun tag viene trovato, questo file non verrà creato.

2.6. Modalità di estrazione cue sheet

Sintassi: mkvextract file-sorgente file-cue[opzioni] file-di-uscita.cue

Il file cue verrà salvato in un file specifico. Se nessun capitolo o tag vengono trovati nel file, questo file non verrà creato.

2.7. Modalità di estrazione marche temporali

Sintassi: mkvextract file-sorgente marcatemporale_v2 [opzioni] TID1:file-destinazione1 [TID2:file-destinazione2 ...]

Option Description
TID:outname

Causes extraction of the timestamps 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.

Esempio:

$ mkvextract input.mkv timestamps_v2 1:ts-track1.txt 2:ts-track2.txt

2.8. Modalità di estrazione cue

Sintassi: mkvextract nomefile-sorgente cue [opzioni] TID1:file-destinazione1 [TID2:file-destinazione2 ...]

Option Description
TID:nome-file-destinazione

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.

Esempio:

timestamp=00:00:13.305000000 duration=- cluster_position=757741 relative_position=11

Le chiavi possibili sono:

Option Description
data/ora

The cue point's timestamp with nanosecond precision. The format is HH:MM:SS.nnnnnnnnn. This element is always set.

durata

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(tm) file where the cluster containing the referenced element starts.

Note:

Inside the Matroska(tm) 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.

Note:

Inside the Matroska(tm) 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.

Esempio:

$ mkvextract input.mkv cues 1:cues-track1.txt 2:cues-track2.txt

3. Esempi

Extracting both chapters and tags in their respective XML formats at the same time:

$ mkvextract movie.mkv chapters movie-chapters.xml tags movie-tags.xml

Extracting a couple of tracks and their respective timestamps at the same time:

$ mkvextract "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:

$ mkvextract "My Movie.mkv" chapters --simple "My Chapters.txt" tracks -c MS-ANSI "2:My Subtitles.srt"

4. Text files and character set conversions

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.

5. Formati di uscita dei file

The decision about the output format is based on the track type, not on the extension used for the output file name. The following track types are supported at the moment:

Option Description
A_AAC/MPEG2/*, A_AAC/MPEG4/*, A_AAC

All AAC files will be written into an AAC file with ADTS headers before each packet. The ADTS headers will not contain the deprecated emphasis field.

A_AC3, A_EAC3

These will be extracted to raw AC-3 files.

A_ALAC

Le tracce ALAC sono scritte su file CAF.

A_DTS

Questi verrrano estratti su file grezzi DTS.

A_FLAC

Le tracce FLAC verranno scritte su file grezzi FLAC.

A_MPEG/L2

I flussi MPEG-1 Audio Layer II verranno estratti su file grezzi MP2.

A_MPEG/L3

Questi verrrano estratti su file grezzi MP3.

A_OPUS

Le tracce Opus(tm) verranno scritte su file OggOpus(tm).

A_PCM/INT/LIT, A_PCM/INT/BIG

I dati grezzi PCM verranno scritti su file WAV. I dati Big-endian verranno convertiti in dati little-endian.

A_REAL/*

RealAudio(tm) tracks are written to RealMedia(tm) files.

A_TRUEHD, A_MLP

These will be extracted to raw TrueHD/MLP files.

A_TTA1

TrueAudio(tm) tracks are written to TTA files. Please note that due to Matroska(tm)'s limited timestamp precision the extracted file's header will be different regarding two fields: data_length (the total number of samples in the file) and the CRC.

A_VORBIS

Vorbis audio will be written into an OggVorbis(tm) file.

A_WAVPACK4

WavPack(tm) 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(tm) streams will be written within an Ogg(tm) container.

S_TEXT/SSA, S_TEXT/ASS, S_SSA, S_ASS

SSA and ASS text subtitles will be written as SSA/ASS files respectively.

S_TEXT/UTF8, S_TEXT/ASCII

Simple text subtitles will be written as SRT files.

S_VOBSUB

VobSub(tm) 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 video tracks are written to H.264 elementary streams which can be processed further with e.g. MP4Box(tm) from the GPAC(tm) package.

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(tm) from the GPAC(tm) package.

V_MS/VFW/FOURCC

Fixed FPS video tracks with this CodecID are written to AVI files.

V_REAL/*

RealVideo(tm) tracks are written to RealMedia(tm) files.

V_THEORA

Theora(tm) streams will be written within an Ogg(tm) container

V_VP8, V_VP9

VP8 / VP9 tracks are written to IVF files.

Tag

Tags are converted to a XML format. This format is the same that mkvmerge(1) supports for reading tags.

Allegati

Attachments are written to the output file as they are. No conversion whatsoever is done.

Capitoli

Chapters are converted to a XML format. This format is the same that mkvmerge(1) supports for reading chapters. Alternatively a stripped-down version can be output in the simple OGM style format.

Marche temporali

Timestamps are first sorted and then output as a timestamp v2 format compliant file ready to be fed to mkvmerge(1). The extraction to other formats (v1, v3 and v4) is not supported.

6. Codici d'uscita

mkvextract(1) esce con uno di tre codici di uscita:

7. Variabili d'ambiente

mkvextract(1) uses the default variables that determine the system's locale (e.g. LANG and the LC_* family). Additional variables:

Option Description
MKVEXTRACT_DEBUG, MKVTOOLNIX_DEBUG and its short form MTX_DEBUG

The content is treated as if it had been passed via the --debug option.

MKVEXTRACT_ENGAGE, MKVTOOLNIX_ENGAGE and its short form MTX_ENGAGE

The content is treated as if it had been passed via the --engage option.

8. Vedi anche

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

9. WWW

La versioen aggironata è sempre disponibile nel sito web MKVToolNix.