mplex(1)
๐ NAME ๐
okay bestie, meet mplex โ the MPEG 1/2 program/system stream multiplexer. ๐
โจ SYNOPSIS โจ
mplex [-f|--format format_code] [-i|--vdr-index] index_pathname
[-v|--verbose num] [-b|--video-buffer video_buffer_size_kB[,
video_buffer_size_kB...]] [-L|--lpcm-params params[, params...]]
[-r|--mux-bitrate muxed_bitrate_kbps] [-l|--mux-limit num] [-O|--sync-
offset num[ms|s|mpt]] [-d|--subpicture-delay [ms|s|mpt|c][:stream-
id][,delay[:stream-id]] [-R|--run-in num] [-V|--vbr] [-C|--cbr]
[-s|--sector-size sector_size_B] [-p|--packets-per-pack num]
[-h|--system-headers] [-S|--max-segment-size output_filesize_limit_MB]
[-M|--split-segment]
[-?|--help] -o|--output output_pathname_pattern input_file...
๐ DESCRIPTION ๐
So like, mplex is your general-purpose audio/video multiplexer for MPEG-1 and MPEG-2. It takes one or more MPEG-1/2 video streams, MPEG layer I/II/III audio, DTS, AC3 and LPCM audio streams, and mushes them all together into one combined program/system stream according to whatever constraints you asked for. the way it just does that?? ๐ฆ
It supports so many different types of output structure, plus presets for standard VCD and SVCD streams. Those ones can literally be burned to CD with tools like vcdimager(1) and played in stand-alone players. iconic behaviour honestly ๐ฟโจ
It can also automatically split the output stream into chunks of a specified size โ either independently, or at sequence end/start points in the input video stream. two vibes, one tool ๐
๐ซถ GENERAL FUNCTION LETTERS ๐ซถ
-o,--outputoutput_filename_pattern โ this one is MANDATORY bestie, no skipping it ๐ญ It sets the pattern for the name(s) of the output files.
An integer format code (e.g. %d) in the name gets replaced by the number of the file generated (see printf(3)). iykyk
-v,--verbosenum โ Sets the verbosity level to num:0โ warnings and errors only,1โ information as well,2โ really verbose. like, really really. ๐ฃ๏ธ
-?,--helpโ Displays a synopsis of the command syntax. the classic "help me pls" move ๐ซถ
๐ FUNCTION LETTERS ๐
-f,--formatformat_code โ This lets you pick one of a bunch of convenient preset output formats, or generic MPEG1 / MPEG2 output. For the generic formats you can use the other function letters to control tons of aspects of the multiplexed stream. But for VCD/SVCD/DVD compliant output you must use the corresponding formats, because the standards require the multiplexer to enforce a whole variety of special constraints on the structure of the output stream. no negotiating with the standards, periodt ๐0โ Generic MPEG1. A simple general-purpose MPEG1 format primarily suitable for software decoders. Buffer sizes and VBR must be specified. Bit-rate can be auto-detected.1โ VCD. Standard VCD. Overrides other option settings.2โ User VCD. VCD format but buffer size, bit rate and VBR can be set manually.3โ Generic MPEG2. Like0except MPEG2.4โ SVCD. Standard SVCD. Overrides other option settings.5โ User-rate SVCD. SVCD format but buffer size bit rate and VBR can be set.6โ VCD Stills stream (mixed mode with hi-res and standard-res image streams multiplexed are supported).7โ SVCD Stills stream.8โ DVD (with NAV sectors). Don't get too excited. This is really a very minimal mux format. It includes empty versions of the peculiar VOBU start sectors DVD VOB's include. This is enough to persuade some hardware players to play the stream but is a long way from full DVD authoring. it's giving "DVD-adjacent" ngl ๐9โ DVD. As above but without the empty VOBU sectors.
-W,--workaroundsworkaround_flag [,workaround_flag...] โ A comma-seperated list of flags that set special work-arounds for what are suspected to be parser Bugs in widely used players. No workarounds are (currently) implemented but history suggests this may change quickly ;-) foreshadowing fr fr ๐ฎ-i,--vdr-indexindex_pathname โ This tellsmplexto generate an index file for the output in the format used by thevdr(video disk recorder package). Useful if you want to write output into vdr's recordings directory for playback on your video recorder PC. This probably only useful in combination with-f 9. niche but valid ๐-r,--mux-bitratenum โ The total (non VBR) / peak (VBR) bit-rate of the output stream in k Bits/sec. If unspecified and not set by a preset it is automatically calculated from the input stream. โจ-b,--video-buffernumlist โ A comma-seperateed list of video decoder buffer sizes in KB for the video streams (given in the order the video streams appear on the command line). The default is46KBthe (tiny) size specified for VCD. The size to use for SVCD is the (more reasonable)230KB. If you are encoding for a half-decent software decoder it makes sense to push this up to500Kor more. go big or go home honestly ๐-L,--lpcm-paramssamples_per_sec:channels:bits_per_sample [, samples_per_sec:channels:bits_per_sample ...] โ A comma-seperated list of paramter sets for the lpcm audio streams (given in the order the lpcm streams appear on the command line). Each parameter set comprises the sampling rate in Hz, the number of channels, and the number of bits per sample seperated by colons. For example, the default 48kHz two-channel 16-bit audio would be specified as48000:2:16. write that down bestie ๐
Note: these parameters are necessary because mplex expects raw LPCM audio data without any headers. That is: for each sample point a group of 16, 20, or 24 bit amplitude values, one for each channel. Amplitude values are signed with the constituent bytes in big-endian (most significant bytes first) order. For 20 bit samples I am not sure but what documentation I have suggests such samples are padded at the lsb end so that they byte-align at the most significant bits. the author being honest about not being sure is honestly so real of them ๐
-l,--mux-limitnum โ Multiplex limit. Multiplex only the specified number of seconds. Useful for tuning and debugging. tiny test run, big energy โญ-O,--sync-offsetnum[ms|s|mpt|c] โ Set the presentation timestamp offset of video stream w.r.t. audio stream (video-audio) in mSec. This flag is used to produce a stream with synchronised audio/video when one stream started before/after the other. This is common when transcoding as the synchronisation information is typically lost during the (seperate) decoding/encoding of audio and video. the classic "wait which one started first" situation ๐ญ
By appending s, ms or mpt the offset can given in seconds, milliseconds or MPEG clock ticks (1/90000th of a second) respectively. If no suffix is given milliseconds are assumed. defaults, we love them ๐
-d,--subpicture-delaynum[ms|s|mpt|c][:stream-id][,delay[:stream-id]] โ Specify offset of timestamps (video-subpicture) in msec sec, mpt or clock-ticks. If no suffix is given milliseconds are assumed. โฑ๏ธ
The intention of the adding subtitle support was to enable mplex to mux all streams necessary for a DVD so that the mpeg2 stream created can be used directly for further dvd creation. Currently only ps1 streams (like created by tcextract) are supported. ps1 only, no cap
Valid subtitle stream are in a range of 32-63 (including). You may want to specify each stream you mplex, use "," to delimit each stream. one bullet per stream bestie, don't be shy
Example: If you want to mux one video, one audio and two subtitle streams having delays of 500 and 1000 ms, the first shall have id 32, the second is 33 (Subtitle streams 0 and 1):
$ mplex -f 8 -o my_mpeg.mpeg -d 500:32,1000:33 video_in.mpv
audio_in.m2a subtitle_0.ps1 subtitle_1.ps1
-R,--run-innum โ Set a non-default run-in (the time data is preloaded into buffers before decoding is scheduled) at the start of each sequence in video frame intervals. By default a run-in matching the specified size of the video and audio buffers in the decoder and the type of multiplexing (constant or variable bit-rate) is selected automatically. it just knows what to do, main character energy โจ-V,--vbrโ Force variable bit rate multiplexing even if selected profile defaults to constant-bit-rate. rebel era ๐ฆ-C,-cbrโ Force constant bit rate multiplexing even if selected profile defaults to variable bit-rate. the opposite rebel era ๐ธ-s,--sector-sizenum โ This option specifies the sector size of the output stream in bytes.-p,--packets-per-packnum โ This option specifies the number of packets per pack in the output stream.-S,--max-segment-sizenum โ This option specifies the maximum size of output files in MBytes (2^10). When the limit is reached a new file is started. The default is (0) unlimited. no limits, just vibes ๐ฅ
Note: This option is not for splitting a long video across multiple VCD's or SVCD's.
It simply splits a single long sequence into in a way that prevents bits of a video GOP (group of pictures) or audio frame being split between chunks. This is fine for formats like that used for DVDs where all stream parameters appear every GOP. However, for VCD / SVCD it won't work as the players expect each file to start a new MPEG sequence. so like, do NOT do that, ok?? ๐ญ
For VCD / SVCD a different technique is used. If mplex encounters a sequence break (sequence end followed by start) in the input video stream it starts a new output stream and file at the sequence start. Thus to split a long video across VCD's/SVCD's you have to get the MPEG video encoder to introduce sequence splits at the right points (see mpeg2enc(1) for details of how to do this). go read that one next bestie ๐
-M,--ignore-seqend-markersโ This flag makesmplexignore sequence end markers embedded in the first video stream instead of switching to a new output file. This is sometimes useful splitting a long stream in files based on a-Slimit that doesn't need a run-in/run-out like (S)VCD. special little use case, respect it ๐-h,--system-headersโ A system header is generated in every pack rather than just in the first. every pack gets one, generous queen ๐
๐ฉบ DIAGNOSTIC OUTPUT ๐ฉบ
When multiplexing using mplex you may get warning or error messages complaining about buffer underflow. This means that the bit-rate you have specified is simply too low to permit the video and audio to be played back without skipping. the fix?? Either reduce the data-rate of the input material, or increase the output stream bit-rate. two doors, pick one ๐ชโจ
๐ BUGS ๐
The multiplexer should handle MPEG(5.1) audio. should. SHOULD. it currently does not. we're manifesting. ๐โจ
๐ AUTHOR ๐
Okay bestie, credit where credit is due: this man page was written by Andrew Stevens. Iconic behaviour, honestly. ๐
Got questions? Remarks? Found a problem? Or you just wanna slide into the devs' DMs (respectfully)? The main mailing list for the MJPEG-tools is literally right here:
mjpeg-users@lists.sourceforge.net
And if you want more info โ the full lore, the vibes, all of it โ go check out the website at:
http://mjpeg.sourceforge.net
fr fr, that's the spot. Go look. ๐ฆ
๐ SEE ALSO ๐
The whole friend group, assembled ๐ โ go say hi to the siblings:
And that's a wrap on mplex(1), bestie. ๐ This page came to you courtesy of the MJPEG Tools Team, dated 2 June 2001 โ yeah, she's vintage, and she still ate. โจ Go forth, multiplex responsibly, and remember: read the options, love the options. ๐ซถ๐ธ
mwah ๐ bye bestie
๐ฆ where this page comes from
- arch rolling: mjpegtools 2.2.1-4 ยท GPL-2.0-or-later
- debian bookworm: mjpegtools 1:2.1.0+debian-7
- debian trixie: mjpegtools 1:2.1.0+debian-8.1+b1
- fedora 43: mjpegtools 2.2.1-11.fc43 ยท GPL-2.0-or-later AND GPL-2.0-only AND GPL-1.0-or-later
- fedora 44: mjpegtools 2.2.1-12.fc44 ยท GPL-2.0-or-later AND GPL-2.0-only AND GPL-1.0-or-later
- nixos 26.05: mjpegtools 2.2.1
- nixpkgs unstable: mjpegtools 2.2.1
- opensuse-leap 16.0: mjpegtools 2.2.1-160000.2.2 ยท GPL-2.0-only
- opensuse-leap 16.0: mjpegtools 2.2.1-160000.2.2 ยท GPL-2.0-only
- opensuse-leap 16.0: mjpegtools 2.2.1-160000.2.2 ยท GPL-2.0-only
- opensuse-leap 16.0: mjpegtools 2.2.1-160000.2.2 ยท GPL-2.0-only
- ubuntu jammy: mjpegtools 1:2.1.0+debian-6build1
- ubuntu noble: mjpegtools 1:2.1.0+debian-8.1build1
- ubuntu questing: mjpegtools 1:2.1.0+debian-8.1build1
- ubuntu resolute: mjpegtools 1:2.2.1-3
- ubuntu stonking: mjpegtools 1:2.2.1-3
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms