Creating and working with Matroska files
Go to file
2003-07-07 17:44:03 +00:00
avilib Updated ChangeLog, ignore props for some DLLs and a small OS compat update. 2003-06-20 21:40:13 +00:00
debian Included mkvextract in the package description. 2003-06-22 13:56:13 +00:00
aac_common.cpp Made the AAC reader automatically recognize if a MPEG4 AAC file contains the emphasis header (deprecated) or not (current standard). 2003-06-19 19:32:50 +00:00
aac_common.h Made the AAC reader automatically recognize if a MPEG4 AAC file contains the emphasis header (deprecated) or not (current standard). 2003-06-19 19:32:50 +00:00
ac3_common.cpp Id keyword stuff 2003-06-15 14:03:28 +00:00
ac3_common.h Id keyword stuff 2003-06-15 14:03:28 +00:00
acinclude-2.1.m4 Changes for compilation against libebml/libmatroska 0.5.0 2003-07-06 13:49:32 +00:00
acinclude-2.5.m4 Changes for compilation against libebml/libmatroska 0.5.0 2003-07-06 13:49:32 +00:00
autogen.sh Added a note about the file version being used. 2003-05-10 09:44:20 +00:00
ChangeLog Added support for the missing tags: KaxTagMultiComment, KaxTagMultiCommentName, KaxTagMultiCommentComments and KaxTagMultiCommentLanguage. 2003-07-07 14:45:16 +00:00
cluster_helper.cpp Changes for compilation against libebml/libmatroska 0.5.0 2003-07-06 13:49:32 +00:00
cluster_helper.h Changes for compilation against libebml/libmatroska 0.5.0 2003-07-06 13:49:32 +00:00
common.cpp Introduced some new helper functions for reading integers from a stream and for handling big endian issues. 2003-07-05 14:29:18 +00:00
common.h Changes for compilation against libebml/libmatroska 0.5.0 2003-07-06 13:49:32 +00:00
configure.in New version 0.5.0 2003-06-20 21:49:01 +00:00
COPYING standard GPL 2003-04-11 13:44:04 +00:00
depcomp initial addition, compilation fixups 2003-02-16 00:47:53 +00:00
dts_common.cpp Id keyword stuff 2003-06-15 14:03:28 +00:00
dts_common.h Id keyword stuff 2003-06-15 14:03:28 +00:00
error.h Id keyword stuff 2003-06-15 14:03:28 +00:00
install-sh Removed whitespaces at the end of the line. 2003-05-20 06:30:25 +00:00
iso639.cpp Id keyword stuff 2003-06-15 14:03:28 +00:00
iso639.h Id keyword stuff 2003-06-15 14:03:28 +00:00
Makefile.am Added support for RealAudio reading. Added a pass-through packetizer that is used for RealAudio. Fixed some SVN keywords. 2003-07-06 11:10:56 +00:00
matroska.h Added the very first version of a RealMedia demuxer. 2003-07-05 14:43:08 +00:00
matroska.xpm Started an optional GUI for mkvinfo. 2003-05-28 07:39:45 +00:00
missing switched to auto* 2003-02-16 12:09:37 +00:00
mkinstalldirs switched to auto* 2003-02-16 12:09:37 +00:00
mkvextract.1 Removed "(mkvinfo) " from mkvinfo's output in order to improve readability and save space. 2003-06-22 12:27:46 +00:00
mkvextract.cpp Fix for compilation with gcc 2.95 2003-07-07 17:44:03 +00:00
mkvinfo_gui.cpp Changes for compilation against libebml/libmatroska 0.5.0 2003-07-06 13:49:32 +00:00
mkvinfo_tag_types.cpp Added support for almost all tags (totally untested). 2003-07-02 21:12:07 +00:00
mkvinfo_tag_types.h Added support for almost all tags (totally untested). 2003-07-02 21:12:07 +00:00
mkvinfo.1 Some clarifications. 2003-06-22 12:26:27 +00:00
mkvinfo.cpp Added support for the missing tags: KaxTagMultiComment, KaxTagMultiCommentName, KaxTagMultiCommentComments and KaxTagMultiCommentLanguage. 2003-07-07 14:45:16 +00:00
mkvinfo.h Unified a LOT of OS and compiler dependant stuff. Introduced support for mingw compilation. 2003-06-20 19:29:26 +00:00
mkvmerge.1 Some clarifications. 2003-06-22 12:26:27 +00:00
mkvmerge.cpp Changes for compilation against libebml/libmatroska 0.5.0 2003-07-06 13:49:32 +00:00
mkvmerge.h Changes for compilation against libebml/libmatroska 0.5.0 2003-07-06 13:49:32 +00:00
mkvmerge.mak Makefile for mkvmerge for Microsoft Developer Studio by Shelly 2003-04-09 13:34:31 +00:00
mm_io.cpp Introduced some new helper functions for reading integers from a stream and for handling big endian issues. 2003-07-05 14:29:18 +00:00
mm_io.h Changes for compilation against libebml/libmatroska 0.5.0 2003-07-06 13:49:32 +00:00
mp3_common.cpp Id keyword stuff 2003-06-15 14:03:28 +00:00
mp3_common.h Id keyword stuff 2003-06-15 14:03:28 +00:00
ogmstreams.h Removed whitespaces at the end of the line. 2003-05-20 06:30:25 +00:00
os.h New version 0.5.0 2003-06-20 21:49:01 +00:00
p_aac.cpp Implemented time slice durations , default block duration and block durations for slices where necessary. 2003-06-29 17:56:38 +00:00
p_aac.h Unified a LOT of OS and compiler dependant stuff. Introduced support for mingw compilation. 2003-06-20 19:29:26 +00:00
p_ac3.cpp Implemented time slice durations , default block duration and block durations for slices where necessary. 2003-06-29 17:56:38 +00:00
p_ac3.h Unified a LOT of OS and compiler dependant stuff. Introduced support for mingw compilation. 2003-06-20 19:29:26 +00:00
p_dts.cpp Id keyword stuff 2003-06-15 14:03:28 +00:00
p_dts.h Unified a LOT of OS and compiler dependant stuff. Introduced support for mingw compilation. 2003-06-20 19:29:26 +00:00
p_mp3.cpp Implemented time slice durations , default block duration and block durations for slices where necessary. 2003-06-29 17:56:38 +00:00
p_mp3.h Unified a LOT of OS and compiler dependant stuff. Introduced support for mingw compilation. 2003-06-20 19:29:26 +00:00
p_passthrough.cpp Added support for RealAudio reading. Added a pass-through packetizer that is used for RealAudio. Fixed some SVN keywords. 2003-07-06 11:10:56 +00:00
p_passthrough.h Added support for RealAudio reading. Added a pass-through packetizer that is used for RealAudio. Fixed some SVN keywords. 2003-07-06 11:10:56 +00:00
p_pcm.cpp Implemented time slice durations , default block duration and block durations for slices where necessary. 2003-06-29 17:56:38 +00:00
p_pcm.h Unified a LOT of OS and compiler dependant stuff. Introduced support for mingw compilation. 2003-06-20 19:29:26 +00:00
p_textsubs.cpp Made the SSA reader more spec compliant. Made the charset recoding in textsubs packetizer optional (only if the source is a SRT or OGM. Not if the source is a Matroska file (already UTF-8) nor for SSA/ASS files (reader will recode)). Renamed the long writeline_unix_newlines() to puts_unl(). 2003-06-21 23:24:07 +00:00
p_textsubs.h Made the SSA reader more spec compliant. Made the charset recoding in textsubs packetizer optional (only if the source is a SRT or OGM. Not if the source is a Matroska file (already UTF-8) nor for SSA/ASS files (reader will recode)). Renamed the long writeline_unix_newlines() to puts_unl(). 2003-06-21 23:24:07 +00:00
p_video.cpp Added the very first version of a RealMedia demuxer. 2003-07-05 14:43:08 +00:00
p_video.h Added the very first version of a RealMedia demuxer. 2003-07-05 14:43:08 +00:00
p_vorbis.cpp Implemented time slice durations , default block duration and block durations for slices where necessary. 2003-06-29 17:56:38 +00:00
p_vorbis.h Unified a LOT of OS and compiler dependant stuff. Introduced support for mingw compilation. 2003-06-20 19:29:26 +00:00
pr_generic.cpp Changes for compilation against libebml/libmatroska 0.5.0 2003-07-06 13:49:32 +00:00
pr_generic.h Changes for compilation against libebml/libmatroska 0.5.0 2003-07-06 13:49:32 +00:00
r_aac.cpp Made the AAC reader automatically recognize if a MPEG4 AAC file contains the emphasis header (deprecated) or not (current standard). 2003-06-19 19:32:50 +00:00
r_aac.h Unified a LOT of OS and compiler dependant stuff. Introduced support for mingw compilation. 2003-06-20 19:29:26 +00:00
r_ac3.cpp Id keyword stuff 2003-06-15 14:03:28 +00:00
r_ac3.h Unified a LOT of OS and compiler dependant stuff. Introduced support for mingw compilation. 2003-06-20 19:29:26 +00:00
r_avi.cpp Added the very first version of a RealMedia demuxer. 2003-07-05 14:43:08 +00:00
r_avi.h Unified a LOT of OS and compiler dependant stuff. Introduced support for mingw compilation. 2003-06-20 19:29:26 +00:00
r_dts.cpp Id keyword stuff 2003-06-15 14:03:28 +00:00
r_dts.h Unified a LOT of OS and compiler dependant stuff. Introduced support for mingw compilation. 2003-06-20 19:29:26 +00:00
r_matroska.cpp Changes for compilation against libebml/libmatroska 0.5.0 2003-07-06 13:49:32 +00:00
r_matroska.h Changes for compilation against libebml/libmatroska 0.5.0 2003-07-06 13:49:32 +00:00
r_microdvd.cpp Switching from fwrite/fread etc. to mm_io_c. 2003-05-23 06:34:58 +00:00
r_microdvd.h Unified a LOT of OS and compiler dependant stuff. Introduced support for mingw compilation. 2003-06-20 19:29:26 +00:00
r_mp3.cpp Id keyword stuff 2003-06-15 14:03:28 +00:00
r_mp3.h Unified a LOT of OS and compiler dependant stuff. Introduced support for mingw compilation. 2003-06-20 19:29:26 +00:00
r_mp4.cpp Id keyword stuff 2003-06-15 14:03:28 +00:00
r_mp4.h Unified a LOT of OS and compiler dependant stuff. Introduced support for mingw compilation. 2003-06-20 19:29:26 +00:00
r_ogm.cpp Added the very first version of a RealMedia demuxer. 2003-07-05 14:43:08 +00:00
r_ogm.h Added "percentage done" to the progress output of the OGM reader. 2003-06-24 18:26:20 +00:00
r_real.cpp Added support for RealAudio reading. Added a pass-through packetizer that is used for RealAudio. Fixed some SVN keywords. 2003-07-06 11:10:56 +00:00
r_real.h Removed a lot of debug output. 2003-07-05 18:28:25 +00:00
r_srt.cpp Made the SSA reader more spec compliant. Made the charset recoding in textsubs packetizer optional (only if the source is a SRT or OGM. Not if the source is a Matroska file (already UTF-8) nor for SSA/ASS files (reader will recode)). Renamed the long writeline_unix_newlines() to puts_unl(). 2003-06-21 23:24:07 +00:00
r_srt.h Unified a LOT of OS and compiler dependant stuff. Introduced support for mingw compilation. 2003-06-20 19:29:26 +00:00
r_ssa.cpp Parsed the start time as the end time as well. 2003-06-22 10:37:41 +00:00
r_ssa.h Made the SSA reader more spec compliant. Made the charset recoding in textsubs packetizer optional (only if the source is a SRT or OGM. Not if the source is a Matroska file (already UTF-8) nor for SSA/ASS files (reader will recode)). Renamed the long writeline_unix_newlines() to puts_unl(). 2003-06-21 23:24:07 +00:00
r_vobsub.cpp Switching from fwrite/fread etc. to mm_io_c. 2003-05-23 06:34:58 +00:00
r_vobsub.h Unified a LOT of OS and compiler dependant stuff. Introduced support for mingw compilation. 2003-06-20 19:29:26 +00:00
r_wav.cpp Fixes for the OS compab stuff. 2003-06-20 19:42:25 +00:00
r_wav.h Unified a LOT of OS and compiler dependant stuff. Introduced support for mingw compilation. 2003-06-20 19:29:26 +00:00
README New version 0.4.3 2003-06-03 14:29:59 +00:00
README.Windows.txt New version 0.4.3 2003-06-03 14:29:59 +00:00
subtitles.cpp Id keyword stuff 2003-06-15 14:03:28 +00:00
subtitles.h Unified a LOT of OS and compiler dependant stuff. Introduced support for mingw compilation. 2003-06-20 19:29:26 +00:00
TODO Updated my TODO list. 2003-07-05 09:58:05 +00:00

MKVToolNix 0.4.3
================

These tools allow information about (mkvinfo) or extraction
from (mkvdemux) or creation of (mkvmerge) or the splitting of
(mkvsplit) Matroska files. Matroska is a new multimedia file
format aiming to become THE new container format for the future. You
can find more information about it and its underlying technology, the
Extensible Binary Meta Language (EBML), at

http://www.matroska.org/

At the moment only mkvinfo and mkvmerge are available, but the others
will be as well.

MkvToolNix aims to become for Matroska what the OGMTools are for
OGM.

The full documentation for each command is now maintained in its
man page only. Type 'mkvmerge -h' to get you started.

This code comes under the GPL (see www.gnu.org or the file COPYING).
Modify as needed.

The newest version can always be found at
http://www.bunkus.org/videotools/mkvtoolnix/

Moritz Bunkus <moritz@bunkus.org>

Installation
------------

Installation is not trivial but not impossible either. You first need
libebml and libmatroska.

If you run Debian/unstable on a x86 then you can get binary
packages from my apt repository. Just add the following lines to
/etc/apt/sources.lst:

deb http://www.bunkus.org/debian/unstable/ ./
deb-src http://www.bunkus.org/debian/unstable/ ./

Run 'apt-get update' and 'apt-get install libebml-dev
libmatroska-dev mkvtoolnix'.

If you want to compile from source then get the two libraries via CVS:

cvs -d:pserver:anonymous@cvs.corecodec.org:/cvsroot/matroska login

Just hit the enter key if you're prompted for a password. Now check out
the sources themselves:

cvs -z3 -d:pserver:anonymous@cvs.corecodec.org:/cvsroot/matroska \
  co libmatroska
cvs -z3 -d:pserver:anonymous@cvs.corecodec.org:/cvsroot/matroska \
  co libebml

Change to libebml/make/linux and run 'make'. Change to
libmatroska/make/linux. Once more run 'make'. As root run 'make
install' in both directories. This will install the libraries into
/usr/local/lib and the header files into /usr/local/include/ebml and
/usr/local/include/matroska respectively.

After you've compiled the two libraries you can now compile MkvToolNix
itself. If you want to use the GUI for mkvinfo then you also need
wxWindows v2.4.0 or later (http://www.wxwindows.org/). If configure
finds the wx-config script then support for the GUI will be enabled.

bunzip2 < mkvtoolnix-...tar.bz2 | tar xvf -
cd mkvtoolnix-...
./configure
make
make install

The last step must be run as root and is optional.

If the configure script cannot find the EBML and Matroska headers,
then you'll have to manually point it to their locations:

./configure --with-matroska-include=/where/i/put/libmatroska/src \
  --with-matroska-lib=/where/i/put/libmatroska/make/linux \
  --with-ebml-include=/where/i/put/libebml/src \
  --with-ebml-lib=/where/i/put/libebml/make/linux

Now run 'make' and 'make install'.

Example
-------

Here's a *very* brief example of how you could use mkvmerge
with mencoder in order to rip a DVD:

a) Extract the audio to PCM audio and let mencoder calculate the
video frame numbers:

mencoder -dvd 1 -ovc frameno -oac pcm -o frameno.avi

If you're low on disk space and can invest a bit more time then you
tell mencoder to encode to MP3 instead:

mencoder -dvd 1 -ovc frameno -oac mp3lame -lameopts br=32 -o frameno.avi

b) Extract the audio again, this time to a plain WAV file:

mplayer -dvd 1 -vc dummy -vo null -hardframedrop -ao pcm -aofile audio.wav

At the moment selecting a non-existant video codec with -vc results
in the fastest audio dump.

c) Normalize the sound (optional)

normalize audio.wav

d) Encode the audio to Vorbis:

oggenc -q3 -oaudio-q3.ogg audio.wav

e) Somehow calculate the bitrate for your video. Use something like...

video_size = (target_size - audio-size) / 1.005
video_bitrate = video_size / length / 1024 * 8

target_size, audio_size in bytes
length in seconds
1.005 is the overhead caused by putting the streams into an Matroska file
  (about 0.5%, that's correct ;)).
video_bitrate will be in kbit/s

f) Use the two-pass encoding for the video:

mencoder -dvd 1 -oac copy -ovc lavc \
  -lavcopts vcodec=mpeg4:vbitrate=1000:vhq:vqmin=2:vpass=1 \
  -vop scale=....,crop=..... \
  -o /dev/null

mencoder -dvd 1 -oac copy -ovc lavc \
  -lavcopts vcodec=mpeg4:vbitrate=1000:vhq:vqmin=2:vpass=2 \
  -vop scale=....,crop=..... \
  -o movie.avi

g) Merge:

mkvmerge -o movie.mkv -A movie.avi audio-q3.ogg

-A is necessary in order to avoid copying the raw PCM (or MP3) audio as well.