OGMMERGE(1)
๐ OGMMERGE(1) โ User Commands ๐
okay bestie, welcome to the ogmmerge manual page ๐
this is the User Commands one, and it's all about merging multimedia streams. no cap, it's iconic.
๐ธ NAME ๐ธ
ogmmerge โ Merge multimedia streams into an OGG/OGM file
๐ฆ SYNOPSIS ๐ฆ
the whole vibe is:
ogmmerge [global options] -o out [options] <file1> [[options] <file2>
...]
โจ DESCRIPTION โจ
okay so this program takes the input from several media files and joins their streams โ all of them or just a selection โ into an OGM. It was formerly known as oggmerge and is based on the oggmerge CVS module from Xiph's repository (<http://www.xiph.org/>). iconic lineage, fr fr
๐ Global options:
-v,--verboseโ increase verbosity. more yap, more detail.-q,--quietโ suppress status output. shhh ๐คซ-o,--output outโ write to the fileout. not optional, bestie.
๐ Options that can be used for each input file:
-a,--astreams <n,m,...>โ copy the n'th audio stream, and NOT the stream with the serial no. n. Default: copy all audio streams.-d,--vstreams <n,m,...>โ copy the n'th video stream, and NOT the stream with the serial no. n. Default: copy all video streams.-t,--tstreams <n,m,...>โ copy the n'th text stream, and NOT the stream with the serial no. n. Default: copy all text streams.-A,--noaudioโ don't copy any audio stream from this file.-D,--novideoโ don't copy any video stream from this file.-T,--notextโ don't copy any text stream from this file.-s,--sync <d[,o[/p]]>โ synchronize manually, bb: delay the audio stream bydms.d > 0: pad with silent samples.d < 0: remove samples from the beginning.o/p: adjust the timestamps byo/pto fix linear drifts.pdefaults to1000if omitted. Bothoandpcan be floating point numbers.- Defaults: no manual synch correction (which is the same as
d = 0ando/p = 1.0).
-r,--range <start-end>โ only process fromstarttoend. Both values take the form'HH:MM:SS.mmm'or'SS.mmm', e.g.'00:01:00.500'or'60.500'. If one ofstartorendis omitted then it defaults to0or to end of the file respectively. If you want to split a file into smaller ones I strongly suggest you useogmsplit(1)as it can do a much better job than using the-roption.-c,--comment 'A=B#C=D'or'@filename'โ set additional comment fields for the streams. Sensitive values would be'LANGUAGE=English'or'TITLE=Ally McBeal'. If the parameter starts with'@'then the comments will be read from a file with the same name without the leading'@'.-ccan be specified multiple times per file. The comments will all be concatenated.-f,--fourcc <FourCC>โ forces the FourCC to the specified value. Works only for video streams. Note that you cannot simply use a hex editor and change the FourCC by hand as the OGG file format uses checksums which would be wrong after such a change. do not try it, bestie ๐ญ--omit-empty-packetsโ normally, when a subtitle entry should be removed, an empty packet is created and inserted with the appropriate timestamp. With this option these empty packets are omitted completely.--old-headersโ assume that the input file has been created with an older version ofogmmerge(< 1.1). This may be needed ifogmmergecannot read such a file correctly.--nav-seek <filename>โ use an external AVI index file as generated byaviindexfrom thetranscodepackage. Can be used if an AVI file has a broken index. broken index rescue arc โจ
๐ Other options:
-l,--list-typesโ list supported input file types.-h,--helpโ show usage information.-V,--versionโ show version information.
๐ USAGE ๐
For each file the user can select which tracks ogmmerge 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. track-picking era ๐
๐ฅ EXAMPLES ๐ฅ
okay bestie, scenario time. Let's assume you have a file called MyMovie.avi and the audio track in a separate file, e.g. MyMovie.wav. First you want to encode the audio to OGG:
$ oggenc -q4 -oMyMovie.ogg MyMovie.wav
After a couple of minutes you can join video and audio:
$ ogmmerge -o MyMovie-with-sound.ogm MyMovie.avi MyMovie.ogg
If your AVI already contains an audio track then it will be copied aswell (if ogmmerge supports the audio format). To avoid that simply do:
$ ogmmerge -o MyMovie-with-sound.ogm -A MyMovie.avi MyMovie.ogg
After some minutes of consideration you rip another audio track, e.g. the director's comments or another language to MyMovie-add-audio.wav. Encode it again and join it up with the other file:
$ oggenc -q4 -oMyMovie-add-audio.ogg MyMovie-add-audio.wav
$ ogmmerge -o MM-complete.ogm MyMovie-with-sound.ogm MyMovie-add-audio.ogg
The same result can be achieved with:
$ ogmmerge -o MM-complete.ogm -A MyMovie.avi MyMovie.ogg \
MyMovie-add-audio.ogg
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 '-vid' and '-aid' parameters. These are 0-based and do not distinguish between video and audio. iykyk ๐
If you need an audio track synchronized you can do that easily with:
$ ogmmerge -o goodsync.ogm -A source.avi -s 200 outofsync.ogg
This would add 200ms of silence at the beginning of the audio tracks taken from outofsync.ogg. And -s always applies to all audio tracks in a source file. If you want to apply -s only to a specific track then take the same source file more than once and add -a and -s accordingly.
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:
$ ogmmerge -o goodsync.ogm -s 0,77346/77340 outofsync.ogm
The result was fine. slay, math girlie โจ
The sync options can also be used for subtitles in the same manner.
For text subtitles you can either use some Windows software (like SubRipper) or the subrip package found in transcode(1)'s sources (in contrib/subrip). The general process is:
- extract a raw subtitle stream from the source:
$ tccat -i /path/to/copied/dvd/ -T 1 -L | \
tcextract -x ps1 -t vob -a 0x20 | \
subtitle2pgm -o mymovie
- convert the resulting PGM images to text with
gocr:
$ pgm2txt mymovie
- spell-check the resulting text files:
$ ispell -d american *txt
- convert the text files to a SRT file:
$ srttool -s -w -i mymovie.srtx -o mymovie.srt
The resulting file can be used as another input file for ogmmerge:
$ ogmmerge -o mymovie.ogm -c 'TITLE=My Movie' mymovie.avi \
-c LANGUAGE=English mymovie.ogg -c LANGUAGE=English mymovie.srt
๐ FILE SIZE ๐
okay so using OGG as the container format introduces overhead โ each OGG packet has a header, and each OGG packet can span one or more OGG pages, which itself again contain headers. Several tests show that the overhead is bigger than the overhead introduced by AVI (comparing video only files and files with video and MP3 audio). numbers time, bestie ๐
The overhead is defined as file size - raw stream size. mencoder prints the raw stream size after encoding, so you'll be able to get that information rather easily.
Most of the times you want to calculate the overhead prior to encoding in order to adjust the bitrate accordingly. Unfortunately the overhead per frame is not constant โ only the percentage is constant. This percentage is calculated as 100 * (OGG size - raw size) / raw size and seems to be somewhere between 1.1% and 1.2%. This depends on the number of streams and the stream types used.
The raw size itself can be approximated by:
frames * vbitrate
raw size = ( ----------------- + length * abitrate ) / 8 * 1000 * 1024
frames per sec
assuming that vbitrate and abitrate are given in kbit/s = 1000 bit/s, and length is given in seconds.
๐ NOTES ๐
โ What works:
- AVI as the video and audio source (currently only raw PCM, MP3 and AC3 audio tracks)
- OGG as the source for video, audio (Vorbis, raw PCM, MP3 and AC3 audio) and text streams (subtitles).
- WAV as the audio source
- MP3 audio files
- AC3 audio files
- Track selection
- Manual audio synchronization by adding silence/removing packets for Vorbis audio and for text streams by adjusting the starting point and duration.
- Manual audio synchronization for AC3 and MP3 audio by duplicating/removing packets at the beginning.
- Adding user comments to the mandatory comment headers (only the headers are mandatory. Comments themselves are not mandatory.)
- Text subtitles can be read from SRT (SubRipper / subrip) and MicroDVD files or taken from other OGM files.
- PCM, AC3 and MP3 audio work well under Windows and with MPlayer now.
- Chapter information as generated by dvdxchap are supported.
๐ What not works:
- Manual audio synchronization for PCM sound (who needs it anyway?)
๐ฎ Planned functionality:
- support for other subtitle formats
๐ CHAPTERS ๐
ogmmerge supports chapter information as generated by dvdxchap(1). The format is very simple:
CHAPTER01=HH:MM:SS.sss
CHAPTER01NAME=the first chapter
CHAPTER02=HH:MM:SS.sss
CHAPTER02NAME=another chapter
with HH = hour, MM = minute, SS = seconds, sss = milliseconds.
The chapter information is stored in the video stream's comments. Therefore you could also specify the chapters with -c CHAPTER01=.... Using a chapter file has an advantage: If the video stream's comments already contain chapter information and the command line contains a chapter information file then the existing chapter information will be completely replaced. chapter file supremacy ๐
๐ง TECHNICAL ASPECTS ๐ง
Okay bestie, real talk: this section is not needed by the average user. Itโs for the girlies who wanna peek under the hood (affectionate). ๐
ogmmerge consists of three parts:
- Demultiplexers (called readers) โ they open and read the input files specified on the command line and extract specific tracks.
- Packetizers (or output modules) โ they take data from a demultiplexer and encapsulate them into OGG pages. These are stored in queues.
- The main program โ it requests from every known demultiplexer that it should read some data. It then gets the OGG page with the smallest timestamp from all the packetizer queues. This page is written to the output file.
The general class definitions for the readers and the packetizers can be found in ogmmerge.h.
The main loop is lowkey specific about what it expects: the queues managed by the demuxerโs packetizers are filled with at least one page after a call to the demuxerโs read() function. The demuxer must make sure that enough data is passed to each of its associated packetizers. Have a look at r_ogm.cpp. ๐
A possible setup might look like this:
+-> p_video
+-> r_avi -+
| +-> p_pcm
|
ogmmerge -+-> r_ogm ---> p_vorbis
|
| +-> p_video
| |
+-> r_ogm -+-> p_vorbis
|
+-> p_vorbis
So thatโs one AVI source with a video and an audio track, one OGG/OGM source with only one Vorbis track, and another OGG/OGM source with a video and two Vorbis tracks. The diagram is giving main character energy fr fr. ๐
๐ AUTHOR ๐
ogmmerge was written by Moritz Bunkus <moritz@bunkus.org>. Iconic behavior, honestly. ๐
๐ SEE ALSO ๐
๐ WWW ๐
The newest version can always be found at <http://www.bunkus.org/videotools/ogmtools/>. Go bestie, click the link. โจ
okay thatโs the whole page, bestie ๐ catch you later โ this was ogmmerge v1.5, November 2004, rolling out as OGMMERGE(1). periodt. ๐ซถโจ
๐ฆ where this page comes from
- arch rolling: ogmtools 1.5-12 ยท GPL
- fedora 43: ogmtools 1.5-40.fc43 ยท GPL-2.0-or-later
- fedora 44: ogmtools 1.5-41.fc44 ยท GPL-2.0-or-later
- nixos 26.05: ogmtools 1.5
- nixpkgs unstable: ogmtools 1.5
- opensuse-leap 16.0: ogmtools 1.5-bp160.1.12 ยท GPL-2.0-or-later
- opensuse-leap 16.0: ogmtools 1.5-bp160.1.12 ยท GPL-2.0-or-later
- opensuse-leap 16.0: ogmtools 1.5-bp160.1.12 ยท GPL-2.0-or-later
- opensuse-leap 16.0: ogmtools 1.5-bp160.1.12 ยท GPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms