1OGMMERGE(1) User Commands OGMMERGE(1)
2
3
4
6 ogmmerge - Merge multimedia streams into an OGG/OGM file
7
9 ogmmerge [global options] -o out [options] <file1> [[options] <file2>
10 ...]
11
13 This program takes the input from several media files and joins their
14 streams (all of them or just a selection) into an OGM. It was formerly
15 known as 'oggmerge' and is based on the 'oggmerge' CVS module from
16 Xiph's repository (<http://www.xiph.org/>). ⟨http://www.xiph.org/⟩
17
18 Global options:
19
20 -v, --verbose
21 Increase verbosity.
22
23 -q, --quiet
24 Suppress status output.
25
26 -o, --output out
27 Write to the file 'out'.
28
29 Options that can be used for each input file:
30
31 -a, --astreams <n,m,...>
32 Copy the n'th audio stream, NOT the stream with the serial no.
33 n. Default: copy all audio streams.
34
35 -d, --vstreams <n,m,...>
36 Copy the n'th video stream, NOT the stream with the serial no.
37 n. Default: copy all video streams.
38
39 -t, --tstreams <n,m,...>
40 Copy the n'th text stream, NOT the stream with the serial no. n.
41 Default: copy all text streams.
42
43 -A, --noaudio
44 Don't copy any audio stream from this file.
45
46 -D, --novideo
47 Don't copy any video stream from this file.
48
49 -T, --notext
50 Don't copy any text stream from this file.
51
52 -s, --sync <d[,o[/p]]>
53 Synchronize manually, delay the audio stream by d ms.
54 d > 0: Pad with silent samples.
55 d < 0: Remove samples from the beginning.
56 o/p: adjust the timestamps by o/p to fix linear drifts. p
57 defaults to 1000 if omitted. Both o and p can be floating point
58 numbers.
59 Defaults: no manual synch correction (which is the same as d = 0
60 and o/p = 1.0).
61
62 -r, --range <start-end>
63 Only process from start to end. Both values take the form
64 'HH:MM:SS.mmm' or 'SS.mmm', e.g. '00:01:00.500' or '60.500'. If
65 one of start or end is omitted then it defaults to 0 or to end
66 of the file respectively.
67 If you want to split a file into smaller ones I strongly suggest
68 you use ogmsplit(1) as it can do a much better job than using
69 the -r option.
70
71 -c, --comment 'A=B#C=D' or '@filename'
72 Set additional comment fields for the streams. Sensitive values
73 would be 'LANGUAGE=English' or 'TITLE=Ally McBeal'. If the
74 parameter starts with '@' then the comments will be read from a
75 file with the same name without the leading '@'. -c can be spec‐
76 ified multiple times per file. The comments will all be concate‐
77 nated.
78
79 -f, --fourcc <FourCC>
80 Forces the FourCC to the specified value. Works only for video
81 streams. Note that you cannot simply use a hex editor and change
82 the FourCC by hand as the OGG file format uses checksums which
83 would be wrong after such a change.
84
85 --omit-empty-packets
86 Normally, when a subtitle entry should be removed, an empty
87 packet is created and inserted with the appropriate timestamp.
88 With this option these empty packets are omitted completely.
89
90 --old-headers
91 Assume that the input file has been created with an older ver‐
92 sion of ogmmerge ( < 1.1). This may be needed if ogmmerge cannot
93 read such a file correctly.
94
95 --nav-seek <filename>
96 Use an external AVI index file as generated by aviindex from the
97 transcode package. Can be used if an AVI file has a broken
98 index.
99
100 Other options:
101
102 -l, --list-types
103 List supported input file types.
104
105 -h, --help
106 Show usage information.
107
108 -V, --version
109 Show version information.
110
112 For each file the user can select which tracks ogmmerge should take.
113 They are all put into the file specified with '-o'. A list of known
114 (and supported) source formats can be obtained with the '-l' option.
115
117 Let's assume you have a file called MyMovie.avi and the audio track in
118 a separate file, e.g. MyMovie.wav. First you want to encode the audio
119 to OGG:
120
121 $ oggenc -q4 -oMyMovie.ogg MyMovie.wav
122
123 After a couple of minutes you can join video and audio:
124
125 $ ogmmerge -o MyMovie-with-sound.ogm MyMovie.avi MyMovie.ogg
126
127 If your AVI already contains an audio track then it will be copied
128 aswell (if ogmmerge supports the audio format). To avoid that simply do
129
130 $ ogmmerge -o MyMovie-with-sound.ogm -A MyMovie.avi MyMovie.ogg
131
132 After some minutes of consideration you rip another audio track, e.g.
133 the director's comments or another language to MyMovie-add-audio.wav.
134 Encode it again and join it up with the other file:
135
136 $ oggenc -q4 -oMyMovie-add-audio.ogg MyMovie-add-audio.wav
137 $ ogmmerge -o MM-complete.ogm MyMovie-with-sound.ogm MyMovie-add-
138 audio.ogg
139
140 The same result can be achieved with
141
142 $ ogmmerge -o MM-complete.ogm -A MyMovie.avi MyMovie.ogg \
143 MyMovie-add-audio.ogg
144
145 Now fire up mplayer and enjoy. If you have multiple audio tracks (or
146 even video tracks) then you can tell mplayer which track to play with
147 the '-vid' and '-aid' parameters. These are 0-based and do not distin‐
148 guish between video and audio.
149
150 If you need an audio track synchronized you can do that easily with
151
152 $ ogmmerge -o goodsync.ogm -A source.avi -s 200 outofsync.ogg
153
154 This would add 200ms of silence at the beginning of the audio tracks
155 taken from outofsync.ogg. And -s always applies to all audio tracks in
156 a source file. If you want to apply -s only to a specific track then
157 take the same source file more than once and add -a and -s accordingly.
158
159 Some movies start synced correctly but slowly drift out of sync. For
160 these kind of movies you can specify a delay factor that is applied to
161 all timestamps - no data is added or removed. So if you make that fac‐
162 tor too big or too small you'll get bad results. An example is that an
163 episode I transcoded was 0.2 seconds out of sync at the end of the
164 movie which was 77340 frames long. At 29.97fps 0.2 seconds correspond
165 to approx. 6 frames. So I did
166
167 $ ogmmerge -o goodsync.ogm -s 0,77346/77340 outofsync.ogm
168
169 The result was fine.
170
171 The sync options can also be used for subtitles in the same manner.
172
173 For text subtitles you can either use some Windows software (like Sub‐
174 Ripper) or the subrip package found in transcode(1)'s sources (in con‐
175 trib/subrip). The general process is:
176
177 1. extract a raw subtitle stream from the source:
178 $ tccat -i /path/to/copied/dvd/ -T 1 -L | \
179 tcextract -x ps1 -t vob -a 0x20 | \
180 subtitle2pgm -o mymovie
181
182 2. convert the resulting PGM images to text with gocr:
183 $ pgm2txt mymovie
184
185 3. spell-check the resulting text files:
186 $ ispell -d american *txt
187
188 4. convert the text files to a SRT file:
189 $ srttool -s -w -i mymovie.srtx -o mymovie.srt
190
191 The resulting file can be used as another input file for ogmmerge:
192
193 $ ogmmerge -o mymovie.ogm -c 'TITLE=My Movie' mymovie.avi \
194 -c LANGUAGE=English mymovie.ogg -c LANGUAGE=English mymovie.srt
195
197 Using OGG as the container format introduces overhead - each OGG packet
198 has a header, and each OGG packet can span one or more OGG pages, which
199 itself again contain headers. Several tests show that the overhead is
200 bigger than the overhead introduced by AVI (comparing video only files
201 and files with video and MP3 audio).
202
203 The overhead is defined as file size - raw stream size. mencoder
204 prints the raw stream size after encoding, so you'll be able to get
205 that information rather easily.
206
207 Most of the times you want to calculate the overhead prior to encoding
208 in order to adjust the bitrate accordingly. Unfortunately the overhead
209 per frame is not constant - only the percentage is constant. This per‐
210 centage is calculated as 100 * (OGG size - raw size) / raw size and
211 seems to be somewhere between 1.1% and 1.2%. This depends on the number
212 of streams and the stream types used.
213
214 The raw size itself can be approximated by
215 frames * vbitrate
216 raw size = ( ----------------- + length * abitrate ) / 8 * 1000 * 1024
217 frames per sec
218 assuming that vbitrate and abitrate are given in kbit/s = 1000 bit/s,
219 and length is given in seconds.
220
222 What works:
223
224 * AVI as the video and audio source (currently only raw PCM, MP3
225 and AC3 audio tracks)
226
227 * OGG as the source for video, audio (Vorbis, raw PCM, MP3 and AC3
228 audio) and text streams (subtitles).
229
230 * WAV as the audio source
231
232 * MP3 audio files
233
234 * AC3 audio files
235
236 * Track selection
237
238 * Manual audio synchronization by adding silence/removing packets
239 for Vorbis audio and for text streams by adjusting the starting
240 point and duration.
241
242 * Manual audio synchronization for AC3 and MP3 audio by duplicat‐
243 ing/removing packets at the beginning.
244
245 * Adding user comments to the mandatory comment headers (only the
246 headers are mandatory. Comments themselves are not mandatory.)
247
248 * Text subtitles can be read from SRT (SubRipper / subrip) and
249 MicroDVD files or taken from other OGM files.
250
251 * PCM, AC3 and MP3 audio work well under Windows and with MPlayer
252 now.
253
254 * Chapter information as generated by dvdxchap are supported.
255
256 What not works:
257
258 * Manual audio synchronization for PCM sound (who needs it any‐
259 way?)
260
261 Planned functionality:
262
263 * support for other subtitle formats
264
266 ogmmerge supports chapter information as generated by dvdxchap(1). The
267 format is very simple:
268
269 CHAPTER01=HH:MM:SS.sss
270 CHAPTER01NAME=the first chapter
271 CHAPTER02=HH:MM:SS.sss
272 CHAPTER02NAME=another chapter
273
274 with HH = hour, MM = minute, SS = seconds, sss = milliseconds.
275
276 The chapter information is stored in the video stream's comments.
277 Therefore you could also specify the chapters with -c CHAPTER01=...
278 Using a chapter file has an advantage: If the video stream's comments
279 already contain chapter information and the command line contains a
280 chapter information file then the existing chapter information will be
281 completely replaced.
282
284 This section is not needed by the average user.
285
286 ogmmerge consists of three parts:
287
288 * Demultiplexers (called readers) open and read input files speci‐
289 fied on the command line and extract specific tracks.
290
291 * Packetizers (or output modules) take data from a demultiplexer
292 and encapsulate them into OGG pages. These are stored in queues.
293
294 * The main program requests from every known demultiplexer that it
295 should read some data. It then gets the OGG page with the small‐
296 est timestamp from all the packetizer queues. This page is writ‐
297 ten to the output file.
298
299 The general class definitions for the readers and the packetizers can
300 be found in ogmmerge.h.
301
302 The main loop expects that the queues managed by the demuxer's packe‐
303 tizers are filled with at least one page after a call to the demuxer's
304 read() function. The demuxer must make sure that enough data is passed
305 to each of its associated packetizers. Have a look at r_ogm.cpp.
306
307 A possible setup might look like this:
308
309 +-> p_video
310 +-> r_avi -+
311 | +-> p_pcm
312 |
313 ogmmerge -+-> r_ogm ---> p_vorbis
314 |
315 | +-> p_video
316 | |
317 +-> r_ogm -+-> p_vorbis
318 |
319 +-> p_vorbis
320
321 One AVI source with a video and an audio track, one OGG/OGM source with
322 only one Vorbis track, another OGG/OGM source with a video and two Vor‐
323 bis tracks.
324
326 ogmmerge was written by Moritz Bunkus <moritz@bunkus.org>.
327
329 ogmdemux(1), ogmsplit(1), ogminfo(1), ogmcat(1), dvdxchap(1)
330
332 The newest version can always be found at
333 <http://www.bunkus.org/videotools/ogmtools/>
334 ⟨http://www.bunkus.org/videotools/ogmtools/⟩
335
336
337
338ogmmerge v1.5 November 2004 OGMMERGE(1)