mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-25 04:11:44 +00:00
290 lines
9.1 KiB
Groff
290 lines
9.1 KiB
Groff
.TH MKVMERGE "1" "April 2003" "mkvmerge v0.2" "User Commands"
|
|
.SH NAME
|
|
mkvmerge \- Merge multimedia streams into a Matroska file
|
|
.SH SYNOPSIS
|
|
.B mkvmerge
|
|
[\fIglobal options\fR] \-o \fIout\fR [\fIoptions\fR] <file1> [[\fIoptions\fR] <file2> ...] [@optionsfile]
|
|
.SH DESCRIPTION
|
|
.LP
|
|
This program takes the input from several media files and joins
|
|
their streams (all of them or just a selection) into a Matroska file.
|
|
.UR http://www.matroska.org/
|
|
.UE
|
|
.LP
|
|
Global options:
|
|
.TP
|
|
\fB\-v\fR, \fB\-\-verbose\fR
|
|
Increase verbosity.
|
|
.TP
|
|
\fB\-q\fR, \fB\-\-quiet\fR
|
|
Suppress status output.
|
|
.TP
|
|
\fB\-o\fR, \fB\-\-output\fR \fIout\fR
|
|
Write to the file '\fIout\fR'.
|
|
.TP
|
|
\fB\-\-cluster\-length \fR \fIn[ms]\fR
|
|
Put at most \fIn\fR data blocks into each cluster. If the number is
|
|
postfixed with 'ms' then put at most \fIn\fR milliseconds of data into
|
|
each cluster. The maximum length for a cluster is 65535ms. Programs will
|
|
only be able to seek to clusters, so creating larger clusters may lead to
|
|
imprecise seeking and/or processing.
|
|
.TP
|
|
\fB\-\-no\-cues\fR
|
|
Tells mkvmerge not to create and write the cue data which can be compared
|
|
to an index in an AVI. Matroska files can be played back without the cue
|
|
data, but seeking will probably be imprecise and slower. Use this only if
|
|
you're really desparate for space or for testing purposes. See also option
|
|
\fB\-\-cues\fR which can be specified for each input file.
|
|
.LP
|
|
Options that can be used for each input file:
|
|
.TP
|
|
\fB\-a\fR, \fB\-\-atracks\fR <\fIn\fR,\fIm\fR,...>
|
|
Copy the audio tracks \fIn\fR, \fIm\fR etc.
|
|
Default: copy all audio tracks.
|
|
.TP
|
|
\fB\-d\fR, \fB\-\-vtracks\fR <\fIn\fR,\fIm\fR,...>
|
|
Copy the video tracks \fIn\fR, \fIm\fR etc.
|
|
Default: copy all video tracks.
|
|
.TP
|
|
\fB\-s\fR, \fB\-\-stracks\fR <\fIn\fR,\fIm\fR,...>
|
|
Copy the subtitle tracks \fIn\fR, \fIm\fR etc.
|
|
Default: copy all subtitle tracks.
|
|
.TP
|
|
\fB\-A\fR, \fB\-\-noaudio\fR
|
|
Don't copy any audio track from this file.
|
|
.TP
|
|
\fB\-D\fR, \fB\-\-novideo\fR
|
|
Don't copy any video track from this file.
|
|
.TP
|
|
\fB\-T\fR, \fB\-\-nosubs\fR
|
|
Don't copy any subtitle track from this file.
|
|
.TP
|
|
\fB\-y\fR, \fB\-\-sync\fR <\fId\fR[,\fIo\fR[/\fIp\fR]]>
|
|
Synchronize manually, delay the audio track by \fId\fR ms.
|
|
.br
|
|
\fId\fR > 0: Pad with silent samples.
|
|
.br
|
|
\fId\fR < 0: Remove samples from the beginning.
|
|
.br
|
|
\fIo\fR/\fIp\fR: adjust the timestamps by \fIo\fR/\fIp\fR to fix
|
|
linear drifts. \fIp\fR defaults to 1000 if omitted. Both \fIo\fR and
|
|
\fIp\fR can be floating point numbers.
|
|
.br
|
|
Defaults: no manual synch correction (which is the same as \fId\fR = 0 and
|
|
\fIo\fR/\fIp\fR = 1.0).
|
|
.TP
|
|
\fB\-f\fR, \fB\-\-fourcc\fR <\fIFourCC\fR>
|
|
Forces the FourCC to the specified value. Works only for video tracks.
|
|
.TP
|
|
\fB\-\-cues\fR <\fInone\fR|\fIiframes\fR|\fIall\fR>
|
|
Controls for which tracks cue (index) entries are created. \fInone\fR inhibits
|
|
the creation of cue entries for all tracks contained in the following
|
|
source files. For \fIiframes\fR only blocks with no backward or forward
|
|
references ( = I frames in video tracks) are put into the cue sheet. \fIall\fR
|
|
causes \fBmkvmerge\fR to create cue entries for all blocks which will make
|
|
the file very big.
|
|
.br
|
|
The default is \fIiframes\fR for video tracks and \fInone\fR for all others.
|
|
See also option \fB\-\-no\-cues\fR which inhibits the creation of cue
|
|
entries regardless of the \fB\-\-cues\fR options used.
|
|
.TP
|
|
\fB\-\-default\-track\fR
|
|
Sets the 'default' flag for all tracks read from this file. If the user does
|
|
not explicitly select a track himself then the player should prefer the
|
|
track that has his 'default' flag set. Only one track of each kind (audio,
|
|
video, subttiles) can have his 'default' flag set.
|
|
.LP
|
|
Other options:
|
|
.TP
|
|
\fB\-l\fR, \fB\-\-list\-types\fR
|
|
Lists supported input file types.
|
|
.TP
|
|
\fB\-h\fR, \fB\-\-help\fR
|
|
Show usage information.
|
|
.TP
|
|
\fB\-V\fR, \fB\-\-version\fR
|
|
Show version information.
|
|
.TP
|
|
\fB@\fR\fIoptionsfile\fR
|
|
Reads additional command line arguments from the file \fIoptionsfile\fR.
|
|
Lines whose first non-whitespace character is a hash mark (#) are treated
|
|
as comments and ignored. Whitespaces at the start and end of a line will
|
|
be stripped. If a space is encountered then the line will be split into
|
|
exactly two arguments - the string before the space and the string after
|
|
it. There is no meta character escaping.
|
|
.br
|
|
The command line \fBmkvmerge \-o "my file.mkv" -A "a movie.avi" sound.ogg\fR
|
|
could be converted into the following option file:
|
|
.br
|
|
# Write to the file "my file.mkv".
|
|
.br
|
|
\-o my file.mkv
|
|
.br
|
|
# Only take the video from "a movie.avi".
|
|
.br
|
|
\-A a movie.avi
|
|
.br
|
|
sound.ogg
|
|
.SH USAGE
|
|
.LP
|
|
For each file the user can select which tracks \fBmkvmerge\fR should take.
|
|
They are all put into the file specified with '-o'. A list of known
|
|
(and supported) source formats can be obtained with the '-l' option.
|
|
.SH EXAMPLES
|
|
.LP
|
|
Let's assume you have a file called \fIMyMovie.avi\fP and the audio track in a
|
|
separate file, e.g. \fIMyMovie.wav\fP. First you want to encode the audio to
|
|
OGG:
|
|
.LP
|
|
$ \fBoggenc -q4 -oMyMovie.ogg MyMovie.wav\fP
|
|
.LP
|
|
After a couple of minutes you can join video and audio:
|
|
.LP
|
|
$ \fBmkvmerge -o MyMovie-with-sound.mkv MyMovie.avi MyMovie.ogg\fP
|
|
.LP
|
|
If your AVI already contains an audio track then it will be copied aswell
|
|
(if \fBmkvmerge\fR supports the audio format). To avoid that simply do
|
|
.LP
|
|
$ \fBmkvmerge -o MyMovie-with-sound.mkv -A MyMovie.avi MyMovie.ogg\fP
|
|
.LP
|
|
After some minutes of consideration you rip another audio track, e.g.
|
|
the director's comments or another language to \fIMyMovie-add-audio.wav\fP.
|
|
Encode it again and join it up with the other file:
|
|
.LP
|
|
$ \fBoggenc -q4 -oMyMovie-add-audio.ogg MyMovie-add-audio.wav\fP
|
|
.br
|
|
$ \fBmkvmerge -o MM-complete.mkv MyMovie-with-sound.mkv MyMovie-add-audio.ogg\fP
|
|
.LP
|
|
The same result can be achieved with
|
|
.LP
|
|
$ \fBmkvmerge -o MM-complete.mkv -A MyMovie.avi MyMovie.ogg \\\fP
|
|
.br
|
|
\fBMyMovie-add-audio.ogg\fP
|
|
.LP
|
|
Now fire up mplayer and enjoy. If you have multiple audio tracks (or even
|
|
video tracks) then you can tell mplayer which track to play with the
|
|
\&'\fB-vid\fP' and '\fB-aid\fP' parameters. These are 0-based and do not
|
|
distinguish between video and audio.
|
|
.LP
|
|
If you need an audio track synchronized you can do that easily with
|
|
.LP
|
|
$ \fBmkvmerge -o goodsync.mkv -A source.avi -s 200 outofsync.ogg\fP
|
|
.LP
|
|
This would add 200ms of silence at the beginning of the audio tracks taken from
|
|
\fIoutofsync.ogg\fP. And \fB-s\fP always applies to all audio tracks in a
|
|
source file. If you want to apply \fB-s\fP only to a specific track then take
|
|
the same source file more than once and add \fB-a\fP and \fB-s\fP accordingly.
|
|
.LP
|
|
Some movies start synced correctly but slowly drift out of sync. For these
|
|
kind of movies you can specify a delay factor that is applied to all
|
|
timestamps - no data is added or removed. So if you make that factor too
|
|
big or too small you'll get bad results. An example is that an episode
|
|
I transcoded was 0.2 seconds out of sync at the end of the movie which
|
|
was 77340 frames long. At 29.97fps 0.2 seconds correspond to approx. 6
|
|
frames. So I did
|
|
.LP
|
|
$ \fBmkvmerge -o goodsync.mkv -s 0,77346/77340 outofsync.mkv\fP
|
|
.LP
|
|
The result was fine.
|
|
.LP
|
|
The sync options can also be used for subtitles in the same manner.
|
|
.LP
|
|
For text subtitles you can either use some Windows software (like
|
|
\fBSubRipper\fR) or the \fBsubrip\fR package found in \fBtranscode(1)\fR's
|
|
sources (in \fBcontrib/subrip\fR). The general process is:
|
|
.TP
|
|
1.
|
|
extract a raw subtitle stream from the source:
|
|
.br
|
|
$ \fBtccat -i /path/to/copied/dvd/ -T 1 -L | \\
|
|
.br
|
|
tcextract -x ps1 -t vob -a 0x20 | \\
|
|
.br
|
|
subtitle2pgm -o mymovie\fP
|
|
.TP
|
|
2.
|
|
convert the resulting PGM images to text with \fBgocr\fP:
|
|
.br
|
|
$ \fBpgm2txt mymovie\fP
|
|
.TP
|
|
3.
|
|
spell-check the resulting text files:
|
|
.br
|
|
$ \fBispell -d american *txt\fP
|
|
.TP
|
|
4.
|
|
convert the text files to a SRT file:
|
|
.br
|
|
$ \fBsrttool -s -w -i mymovie.srtx -o mymovie.srt\fP
|
|
.LP
|
|
The resulting file can be used as another input file for \fBmkvmerge\fR:
|
|
.LP
|
|
$ \fBmkvmerge -o mymovie.mkv mymovie.avi mymovie.srt\fP
|
|
.SH NOTES
|
|
.LP
|
|
What works:
|
|
.TP
|
|
*
|
|
AVI as the video and audio source (only raw PCM, MP3 and AC3 audio tracks at
|
|
the moment)
|
|
.TP
|
|
*
|
|
OGG as the source for video, audio (Vorbis, raw PCM, MP3 and AC3 audio) and
|
|
text streams (subtitles).
|
|
.TP
|
|
*
|
|
WAV as the audio source
|
|
.TP
|
|
*
|
|
MP3 audio files
|
|
.TP
|
|
*
|
|
AC3 audio files
|
|
.TP
|
|
*
|
|
Track selection
|
|
.TP
|
|
*
|
|
Manual audio synchronization by adding silence/removing packets for Vorbis
|
|
audio and for text streams by adjusting the starting point and duration.
|
|
.TP
|
|
*
|
|
Manual audio synchronization for AC3 and MP3 audio by duplicating/removing
|
|
packets at the beginning.
|
|
.TP
|
|
*
|
|
Text subtitles can be read from SRT (SubRipper / subrip) files or
|
|
taken from other OGM files.
|
|
.TP
|
|
*
|
|
PCM, AC3 and MP3 audio work well under Windows and with MPlayer.
|
|
.LP
|
|
What not works:
|
|
.TP
|
|
*
|
|
Matroska files cannot be read at the moment.
|
|
.TP
|
|
*
|
|
Manual audio synchronization for PCM sound (who needs it anyway?)
|
|
.LP
|
|
Planned functionality:
|
|
.TP
|
|
*
|
|
support for other subtitle formats
|
|
.TP
|
|
*
|
|
chapter information
|
|
.TP
|
|
*
|
|
a lot of other stuff, like tags, user information etc.
|
|
.SH AUTHOR
|
|
.I mkvmerge
|
|
was written by Moritz Bunkus <moritz@bunkus.org>.
|
|
.SH SEE ALSO
|
|
.BR mkvinfo (1)
|
|
.SH WWW
|
|
The newest version can always be found at
|
|
.UR http://www.bunkus.org/videotools/mkvtoolnix/
|
|
<http://www.bunkus.org/videotools/mkvtoolnix/>
|
|
.UE
|