Creating and working with Matroska files
Go to file
2003-05-11 09:04:43 +00:00
avilib Fixes that allow compilation with MS VC6. 2003-05-09 10:05:26 +00:00
debian New revision/dependency. 2003-05-04 20:27:16 +00:00
.cvsignore Added data directory. 2003-04-17 12:36:58 +00:00
ac3_common.cpp Introduced result checking memory handling functions (safe*). 2003-05-05 18:37:36 +00:00
ac3_common.h first working version. yay! 2003-02-16 17:04:39 +00:00
acinclude-2.1.m4 Different acinclude.m4 files based on the autoconf version. 2003-05-10 09:41:37 +00:00
acinclude-2.5.m4 Different acinclude.m4 files based on the autoconf version. 2003-05-10 09:41:37 +00:00
autogen.sh Added a note about the file version being used. 2003-05-10 09:44:20 +00:00
ChangeLog Added build instructions for cygwin. 2003-05-09 06:27:26 +00:00
ChangeLog.cvs Automatic ChangeLog update. 2003-05-06 08:18:46 +00:00
cluster_helper.cpp Removed LL postfixes on constants. gcc 3.2 does not need them, VC6 does not recognize them, so just ditch them :) 2003-05-08 18:46:25 +00:00
cluster_helper.h Removed the IDs associated with the packet_ts and used the timecodes for bref and fref instead. 2003-04-18 13:08:04 +00:00
common.cpp Improved handling of endian matters. 2003-05-11 09:04:43 +00:00
common.h Improved handling of endian matters. 2003-05-11 09:04:43 +00:00
configure.in Fixes that allow compilation under cygwin. 2003-05-09 05:26:02 +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
error.h Removed malloc.h. 2003-05-05 20:18:32 +00:00
install-sh switched to auto* 2003-02-16 12:09:37 +00:00
iso639.cpp Support for KaxTrackLanguage and ISO639 languages. 2003-05-01 22:38:54 +00:00
iso639.h Support for KaxTrackLanguage and ISO639 languages. 2003-05-01 22:38:54 +00:00
Makefile.am Fixes that allow compilation under cygwin. 2003-05-09 05:26:02 +00:00
matroska.h Sync with the specs. 2003-04-30 11:31:47 +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
mkvinfo.1 New version 0.3.1 2003-05-04 07:36:32 +00:00
mkvinfo.cpp Fixes that allow compilation with MS VC6. 2003-05-09 10:05:26 +00:00
mkvmerge.1 Added support for aspect ratio. 2003-05-06 09:59:37 +00:00
mkvmerge.cpp Fixes that allow compilation with MS VC6. 2003-05-09 10:05:26 +00:00
mkvmerge.h Reversed the direction of the data requests. Each packetizer is asked to fill itself. The packetizer calls its reader which reads data and makes sure that every packetizer has at least one packet. 2003-05-05 21:55:02 +00:00
mkvmerge.mak Makefile for mkvmerge for Microsoft Developer Studio by Shelly 2003-04-09 13:34:31 +00:00
mp3_common.cpp Removed all traces of dmalloc as I use valgrind for debugging purposes now. 2003-05-04 10:05:41 +00:00
mp3_common.h Changed all pointers to general data to unsigned char * 2003-03-04 10:16:28 +00:00
ogmstreams.h Removed a lot of indenting whitespace. 2003-05-02 20:11:34 +00:00
p_ac3.cpp Implemented durations for each packet, but only those packets that really need them (forced by the packetizer) or that are the last packet for a track (forced by mkvmerge itself) get a KaxBlockDuration element. 2003-05-06 07:51:24 +00:00
p_ac3.h Reversed the direction of the data requests. Each packetizer is asked to fill itself. The packetizer calls its reader which reads data and makes sure that every packetizer has at least one packet. 2003-05-05 21:55:02 +00:00
p_mp3.cpp Implemented durations for each packet, but only those packets that really need them (forced by the packetizer) or that are the last packet for a track (forced by mkvmerge itself) get a KaxBlockDuration element. 2003-05-06 07:51:24 +00:00
p_mp3.h Reversed the direction of the data requests. Each packetizer is asked to fill itself. The packetizer calls its reader which reads data and makes sure that every packetizer has at least one packet. 2003-05-05 21:55:02 +00:00
p_pcm.cpp Implemented durations for each packet, but only those packets that really need them (forced by the packetizer) or that are the last packet for a track (forced by mkvmerge itself) get a KaxBlockDuration element. 2003-05-06 07:51:24 +00:00
p_pcm.h Reversed the direction of the data requests. Each packetizer is asked to fill itself. The packetizer calls its reader which reads data and makes sure that every packetizer has at least one packet. 2003-05-05 21:55:02 +00:00
p_textsubs.cpp Implemented durations for each packet, but only those packets that really need them (forced by the packetizer) or that are the last packet for a track (forced by mkvmerge itself) get a KaxBlockDuration element. 2003-05-06 07:51:24 +00:00
p_textsubs.h Reversed the direction of the data requests. Each packetizer is asked to fill itself. The packetizer calls its reader which reads data and makes sure that every packetizer has at least one packet. 2003-05-05 21:55:02 +00:00
p_video.cpp Implemented durations for each packet, but only those packets that really need them (forced by the packetizer) or that are the last packet for a track (forced by mkvmerge itself) get a KaxBlockDuration element. 2003-05-06 07:51:24 +00:00
p_video.h Reversed the direction of the data requests. Each packetizer is asked to fill itself. The packetizer calls its reader which reads data and makes sure that every packetizer has at least one packet. 2003-05-05 21:55:02 +00:00
p_vorbis.cpp Fixes that allow compilation with MS VC6. 2003-05-09 10:05:26 +00:00
p_vorbis.h Reversed the direction of the data requests. Each packetizer is asked to fill itself. The packetizer calls its reader which reads data and makes sure that every packetizer has at least one packet. 2003-05-05 21:55:02 +00:00
pr_generic.cpp Removed LL postfixes on constants. gcc 3.2 does not need them, VC6 does not recognize them, so just ditch them :) 2003-05-08 18:46:25 +00:00
pr_generic.h Proper aspect ratio support for the Matroska reader. 2003-05-06 10:22:55 +00:00
r_ac3.cpp Fixes that allow compilation with MS VC6. 2003-05-09 10:05:26 +00:00
r_ac3.h Moved the header rendering (including the header settings of the packetizers) to after the argument parsing. 2003-05-02 21:49:42 +00:00
r_avi.cpp Fixes that allow compilation with MS VC6. 2003-05-09 10:05:26 +00:00
r_avi.h Moved the header rendering (including the header settings of the packetizers) to after the argument parsing. 2003-05-02 21:49:42 +00:00
r_matroska.cpp Fixes that allow compilation with MS VC6. 2003-05-09 10:05:26 +00:00
r_matroska.h Proper aspect ratio support for the Matroska reader. 2003-05-06 10:22:55 +00:00
r_microdvd.cpp Removed my own queue class in favor of the standard deque class. 2003-05-05 20:48:49 +00:00
r_microdvd.h Removed my own queue class in favor of the standard deque class. 2003-05-05 20:48:49 +00:00
r_mp3.cpp Fixes that allow compilation with MS VC6. 2003-05-09 10:05:26 +00:00
r_mp3.h Removed my own queue class in favor of the standard deque class. 2003-05-05 20:48:49 +00:00
r_ogm.cpp Improved handling of endian matters. 2003-05-11 09:04:43 +00:00
r_ogm.h Moved the header rendering (including the header settings of the packetizers) to after the argument parsing. 2003-05-02 21:49:42 +00:00
r_srt.cpp Reversed the direction of the data requests. Each packetizer is asked to fill itself. The packetizer calls its reader which reads data and makes sure that every packetizer has at least one packet. 2003-05-05 21:55:02 +00:00
r_srt.h Moved the header rendering (including the header settings of the packetizers) to after the argument parsing. 2003-05-02 21:49:42 +00:00
r_vobsub.cpp Reversed the direction of the data requests. Each packetizer is asked to fill itself. The packetizer calls its reader which reads data and makes sure that every packetizer has at least one packet. 2003-05-05 21:55:02 +00:00
r_vobsub.h Removed my own queue class in favor of the standard deque class. 2003-05-05 20:48:49 +00:00
r_wav.cpp Fixes that allow compilation with MS VC6. 2003-05-09 10:05:26 +00:00
r_wav.h Removed my own queue class in favor of the standard deque class. 2003-05-05 20:48:49 +00:00
README Updated version information. Updated installation instructions. 2003-04-30 11:29:10 +00:00
README.Windows.txt Updated installation instructions. 2003-05-09 10:05:09 +00:00
subtitles.cpp Removed malloc.h. 2003-05-05 20:18:32 +00:00
subtitles.h Removed a lot of indenting whitespace. 2003-05-02 20:11:34 +00:00
TODO Small update. 2003-05-03 10:09:50 +00:00

MKVToolNix 0.3.0
================

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:

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.