[Matroska-users] Newbie help please :)
moritz at bunkus.org
Sun Jan 10 17:33:47 CET 2010
On Sunday 10 January 2010 17:08:33 Henti Smith wrote:
> It shows the mp3 file being added to the current mkv file to create a
> new mkv file. When this happens mkvmegre labels the mpeg4 stream as
> track 1, ac3 track 2, subtitle track 3.
> If you look at the example mkvmerge command I use the subtitles are
> track 0, this is because when I mkvmerge video,audio and subtitles, it's
> all listed as track 0. I'm not sure how to change this, I've tried using
> --track-order, but I'm unsure how it works.
The track IDs that mkvmerge assigns to each input stream depend on the
input file type, number of tracks in each input file etc. Luckily you
can let mkvmerge tell you which IDs it has assigned and use those IDs
afterwards (that's how the GUI (mmg) does this as well).
The syntax for this is:
mkvmerge --identify inputfile.avi
inputfile.avi can be any file type that mkvmerge can read as an input
file for tracks (so it doesn't work on chapters, tags, attachments etc
as those are special file types that you need special options like
An example output is:
File 'v.avi': container: AVI
Track ID 0: video (DIV3)
Track ID 1: audio (MP3)
This output has a fixed format:
1. The first line always describes the container format mkvmerge has
2. Starting with the second line mkvmerge lists tracks, chapters,
attachments and tags found in the source file. The first word on the
line determines what it found, e.g. two tracks in the example.
3. Each 'track' line starts with 'Track ID', followed by the track ID
you have to use on the command line, followed by ':', followed by a word
describing its type (either 'audio', 'video', 'subtitles' or
'buttons'). The rest of the line is variable and depends on the source
container, track type etc and is only supposed to be used for displaying
it for the user (e.g. mmg displays the 'DIV3' part as part of the track
If you really want to do it right then you have to query mkvmerge for
each input file and note the track IDs it uses. However, there are a few
rules by which you can guess the actual track IDs without querying
1. All raw container formats (MP3, AAC, AC3 etc) have only a single
'track', and its ID is '0'.
2. AVIs have '0' for the video track and 1, 2, 3... for the audio
tracks. Subtitle tracks get numbered starting where the audio track
numbers left off.
3. Matroska files' track IDs start at 1 and go up for each track as it
is found. If you created the source Matroska file in the first place
then you know the order in which the original tracks were put into it
(it's the same order that you used on mkvmerge's command line UNLESS
you've overwritten it with the --track-order parameter).
4. The same is true for MP4 files, if I'm not mistaken.
One thing to keep in mind is that track IDs are only valid for the next
input file on the command line. Therefore it is possible to have several
tracks with the same track ID in a single mkvmerge command, e.g.
mkvmerge -o two_audio.mka --language 0:eng file1.mp3 --language 0:fre file2.mp3
If Darl McBride was in charge, he'd probably make marriage
unconstitutional too, since clearly it de-emphasizes the commercial
nature of normal human interaction, and probably is a major impediment
to the commercial growth of prostitution. - Linus Torvalds
More information about the Matroska-users