[ Overview | the avi container | Ogm tools ( installation , usage ) | vorbis tools | Matroska ( installation , usage ) ]
Last modified February 20,
2025
This site has
been automatically translated with Google Translate from this
original page written in french, there may be some
translation errors
A definition of containers is given in the video definition page . On this page are presented the ogm and matroska containers which both have a lot of future and are the successors of the avi container briefly described on this page. These two containers are really very rich compared to avi, this page however does not even touch on the most interesting features (chaptering, multiple video streams, subtitling, ...), but rest assured this page is intended to evolve and be enriched to address all the features of these two containers.
AVI is a video container
developed by Microsoft, it is the acronym for Audio Video
Interleaved. Each stream (video or audio) is defined by a
codec, so we can have different combinations of audio or video
codecs, here is a list of usable codecs:
Video codec
- MPEG
- divx
- xvid
- raw (YUV, YV12, ...)
- others (indeo, cinepak,
...)
Audio codec
- mp3
- mp2
- pcm / wav
- others
This container has the
particularity of being able to contain a video stream and two
audio streams (two languages for example).
The most used combinations
are divx / mp3 or xvid / mp3. This container does not allow
chaptering, subtitles and does not recognize some more modern
codecs such as vorbis.
First you need to install libdvdread as indicated in the video player page .
The official ogm tools
website is http://www.bunkus.org/videotools/ogmtools/index.html where you get the archive and unzip it by typing
tar xvfj
ogmtools-1.5.tar.bz2
This gives the ogmtools-1.5 directory in which you type
./configure
make
Then as root
make install
ldconfig
We will create an ogm file
from an avi. Open the .avi file with avidemux , save the soundtrack in mp2 format ( Audio -> Save the audio track ). Open the file with xmms and with its
recording module, save it in wav format. We now transform it
into ogg format.
oggenc -q4 -o bandeson1.ogg
video.wav
Here is the result
Opening with wav module:
WAV file reader
Encoding "video.wav" to
"bandeson1.ogg"
at quality 4.00
[100.0%] [0m00s remaining] -
Done encoding file
"bandeson1.ogg"
File length: 2m 49.0s
Elapsed time: 0m 45.6s
Rate: 3.7212
Average bitrate: 99.3 kb/s
Now we can merge the video
and the sound.
ogmmerge -o video.ogm
video.avi bandeson1.ogg
Note that the resulting file
will have two soundtracks, the original one and the one
previously obtained (provided that the original one is
compatible with ogm). To avoid this and have only one
soundtrack (it will delete the original soundtrack) we will
type:
ogmmerge -o video.ogm
-A video.avi bandeson1.ogg
Here is the result
Using AVI demultiplexer for video.avi. Opening file. This may
take some time depending on the file's size.
+-> Using video output module for video stream.
Using OGG/OGM demultiplexer for bandeson1.ogg.
OGG/OGM demultiplexer (bandeson1.ogg): using Vorbis audio
output module for stream 1.
progress: 4246/4246 frames (100%)
In the event that you would
like to add a second soundtrack (film in English or French for
example). To take the previous example, we will type
ogmmerge -o movie.ogm
video.ogm soundtrack2.ogg
We could just as well have
typed
ogmmerge -o movie.ogm -A
video.avi soundtrack1.ogg soundtrack2.ogg
If your files are too big to fit on a CD, you have the following command to split them into files of 700MB max (the files will start with movie)
ogmsplit -o movie -s 700
movie.ogm
with mplayer to have the first soundtrack
just type (the first track is numbered 1, the next 2, etc.). mplayer -aid 1 movie.ogm with gmplayer by clicking on the image you
have the Audio
Track
command, you just have to choose Track 1 or Track 2.
As its name suggests, vorbis tools allows you to install a bunch of command line tools
to manipulate ogg audio files. We will first install the curl-devel package . With vorbis tools we can encode, read or edit ogg files all in a
shell. The official site is http://www.xiph.org/downloads/ we will retrieve the archive there and decompress
it by typing
tar xvfz
vorbis-tools-1.4.2.tar.gz
This gives the vorbis-tools-1.4.2 directory in which we will type
./configure
make
then as root
make install
The official site is http://www.matroska.org/ we will get two libraries there. We unzip the first
by typing
tar xvfz
libebml-release-1.4.5.tar.gz
This gives the directory libebml-release-1.4.5 , in which we type
mkdir build
cd build
cmake ..
make
and as root
make install
ldconfig
Now we unzip the second
archive
tar xvfz
libmatroska-release-1.7.1.tar.gz
This gives the directory libmatroska-release-1.7.1 , in which we type
mkdir build
cd build
cmake ..
make
And as root
make install
ldconfig
Now we get the matroska tools from the site http://www.bunkus.org/videotools/mkvtoolnix/ . We will need to install the qt6 packages needed
for the installation qtbase6-common-devel, qt6core-devel,
qt6widgets-devel, qt6network-devel, qt6concurrent-devel,
qt6svg-devel, qt6multimedia-devel, qt6gui-devel as well as ruby and lib64cmark-devel beforehand. We unzip the archive by typing
tar xvf mkvtoolnix-90 . 0 .tar.xz
This gives
the directory mkvtoolnix-90 . 0 in which we type
if you have the following error
Ignoring io-console-0.8.0
because its extensions are not built. Try: gem pristine
io-console --version 0.8.0
Ignoring psych-5.2.2
because its extensions are not built. Try: gem pristine
psych --version 5.2.2
rake aborted!
as root you will have to type
gem pristine io-console
--version 0.8.0
gem pristine psych
--version 5.2.2
we retype rake then as root
rake install
if you do not
have the rake command , you can
recover it by typing as root
gem install rake
The syntax is
very similar to that of ogm tools (normal it is the same
author). We take the same video and audio files as before.
The command to create a matroska container (mkv) with the
avi file video.avi, from which we extracted the soundtrack
as seen previously, is the following mkvmerge -o video.mkv video.avi soundtrack1.ogg Here is the result
mkvmerge v90.0 ('Hanging
On') 64-bit
video.avi': Using the AVI
demultiplexer. Opening file. This may take some time
depending on the file's size.
'video.ogg': Using the
OGG/OGM demultiplexer.
'video.avi' track 0: Using
the video output module for the video track.
'video.avi' track 1: Using
the MPEG audio output module.
'video.ogg' track 0: Using
the Vorbis output module.
The file 'video.mkv' has
been opened for writing.
progress: 4246/4246 frames
(100%)
The cue entries (the
index) are being written...
Muxing took 17 seconds.
As with ogm tools, the file obtained will have two
soundtracks, the original one and the one previously
obtained (on the condition that the original one is
compatible with ogm). To avoid this and have only one
soundtrack (it will delete the original soundtrack) we will
type:
mkvmerge v90.0 ('Hanging On') 64-bit
video.avi': Using the AVI demultiplexer. Opening file. This may
take some time depending on the file's size.
'video.ogg': Using the OGG/OGM demultiplexer.
'video.avi' track 0: Using the video output module for the video
track.
'video.avi' track 1: Using the MPEG audio output module.
'video.ogg' track 0: Using the Vorbis output module.
The file 'video.mkv' has been opened for writing.
progress: 4246/4246 frames (100%)
The cue entries (the index) are being written...
Muxing took 17 seconds.
In case you
would like to add a second soundtrack (film in English or
French for example). To use the previous example, we will
type
mkvmerge -o movie.ogm video.ogm bandeson2.ogg
We could just
as well have typed
mkvmerge -o movie.ogm -A video.avi bandeson1.ogg bandeson2.ogg
The resulting
file is played with mplayer in the same way as an ogm file. Note that mkvtoolnix comes with a graphical interface that looks really
complete. Just type mkvtoolnix-gui
At this place http://www.bunkus.org/videotools/mkvtoolnix/doc/mkvmerge-gui.html you will find a very good help to use this software. For those allergic to English, I made a literal translation of this page.