mpeg2enc(1)

πŸ“¦
version 2.2.1 Β· 2 versions
, in arch rolling, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu resolute, ubuntu stonking

πŸ’– mpeg2enc(1) πŸ’–

MJPEG tools manual β€” bestie, it's the MPEG-1/2 encoder ✨


NAME

mpeg2enc β€” MPEG-1/2 encoder πŸŽ€


SYNOPSIS

okay so. deep breath. the synopsis is A LOT and we're gonna get through it together 🫢 every single flag is right here, character for character:

mpeg2enc [-v|--verbose num] [-M|--multi-thread num_CPU] [-f|--format
mpeg_profile] [-l|--level]h|high|m|main [-b|--video-bitrate
bitrate_kbps] [-V|--video-buffer video_buf_size_kB] [-T|--target-still-
size still_size_kB] [-q|--quantisation quantisation] [-r|--motion-
search-radius motion_search_radius] [-Q|--quantisation-reduction
-4.0..5.0] [-X|--quant-reduction-max-var 0.0..2500.0]
[-p|--3-2-pulldown] [-I|--interlace-mode 0|1|2] [-s|--sequence-header-
every-gop] [-g|--min-gop-size min_gop_size] [-G|--max-gop-size
max_gop_size] [-P|--force-b-b-p] [-n|--video-norm n|p|s] [-F|--frame-
rate frame_rate_code] [-x|--display-hsize] 32..38383] [-y|--display-
vsize] 32..38383] [-a|--aspect aspect_ratio_code] [-z|--playback-field-
order b|t] [-4|--reduction-4x4 1..4] [-2|--reduction-2x2 1..4]
[-S|--sequence-length size_MB] [-B|--nonvideo-bitrate bitrate_kbps]
[-N|--reduce-hf 0.0..2.0] [-D|--intra_dc_prec 8..11] [-H|--keep-hf]
[-d|--no-dummy-svcd-SOF] [-C|--correct-svcd-hds] [--no-constraints]
[-K|--custom-quant-matrices kvcd|tmpgenc|default|hi-
res|file=inputfile|help] [-E|--unit-coeff-elim -40..40] [-R|--b-per-
refframe 0..2] [--no-altscan-mpeg2] [--dualprime-mpeg2]
[-A|--ratecontroller 0..1] [-u|--cbr] [--chapters frame,...]
[-?|--help] -o|--output filename

DESCRIPTION

so mpeg2enc is a heavily enhanced derivative of the MPEG Software Simulation Group's MPEG-2 reference encoder. not a vibe, a fact πŸ’…

it takes streams in a simple planar YUV format called "YUV4MPEG", produced by lav2yuv and related filters (like yuvscaler(1)) from the mjpegtools(1) package. there's also an output plug-in for the mpeg2dec(1) MPEG decoder, so you can use it in transcoding applications. πŸ¦‹

right now the encoder fully supports generating:

  • elementary MPEG-1 streams
  • progressive MPEG-2 streams
  • interlaced frame MPEG-2 streams

Field encoded MPEG-2 is also possible, but it is not currently maintained or supported. so like… technically there, practically abandoned πŸ™ˆ

for most purposes you're gonna want to multiplex this elementary stream output together with one or more audio streams into a program/systems stream using the mplex(1) tool. periodt.

heads up bestie: this manual page wants to explain how to use mpeg2enc effectively β€” it is not an intro to MPEG-1/2 video, which is a whole complex topic in its own right. the MPEG video format is a somewhat baroque standard with many many options, and not all of them are easy to explain or even particularly useful in the context of a software encoder. 😭

much useful practical info for novices lives in the mjpeg-HOWTO document that should have been installed with the mjpegtools(1) package. more info and useful supporting software is on the mjpegtools web-site:

http://mjpeg.sourceforge.net

SELECTING THE MPEG PROFILE

set the MPEG profile you wanna use. the MPEG standards support a vast number of options, and in practice different applications of the MPEG format place additional constraints on the form of the MPEG stream. setting this flag picks which kind of stream you're producing. 🌈

  • -f, --format 0 β€” Generic MPEG1. a basic MPEG-1 profile that lets most parameters be adjusted for particular applications using the other flags. typical applications would be producing a variable bitrate MPEG-1 stream with big buffers and a high data-rate software playback on a computer. πŸ’»
  • -f, --format 1 β€” Standard VCD. an MPEG1 profile exactly to the VCD2.0 specification. flag settings that would result in a non-standard stream structure are simply ignored. 🚫
  • -f, --format 2 β€” User VCD. as for profile 2 but bitrate and video buffer size can be set to non-standard values. frame size may also be non-standard. bit-rate and buffer sizes default to those for standard VCD. 🎚️
  • -f, --format 3 β€” Generic MPEG2. a basic MPEG-2 profile that lets most parameters be adjusted for particular applications using the other flags. typical applications would be producing an MPEG-2 stream with big buffers and long GOP's for software playback on a computer. πŸ”₯
  • -f, --format 4 β€” Standard SVCD. an MPEG-2 profile exactly to the SVCD2.0 specification. flag settings that would result in a non-standard stream structure are simply ignored. 🚫
  • -f, --format 5 β€” Non-standard SVCD. as for profile 4 but bitrate, video buffer size, GOP sizes and structure can be set to non-standard values. frame size may also be non-standard. bit-rate and buffer sizes default to those for standard SVCD. 🎚️
  • -f, --format 6 β€” VCD Stills sequence. encodes the special style of MPEG stream used for still images on VCDs. to use this profile you must set the target size you wish to compress the images to using the -T flag. reasonable values are around 35KB for standard resolution stills (352 wide) and 120KB for high resolution stills (704 wide). πŸ“Έ
  • -f, --format 7 β€” SVCD Stills sequence. encodes the special style of MPEG stream used for still images on SVCDs. both standard (480 wide) and high resolution (704 wide) images are supported. as with VCD stills you select how big each compressed still should be using the -T flag. πŸ–ΌοΈ
  • -f, --format 8 β€” DVD MPEG-2 for 'dvdauthor'. this version adds special dummy navigation packets into the output stream that the dvdauthor tool fills in to make a proper .VOB for authoring. bit-rate defaults to 7500kbps, buffer sizes to the maximum permitted by the DVD specification. πŸ“€
  • -f, --format 9 β€” DVD MPEG-2. just a very basic implementation. useful with DXR2 board and similar hardware that can decode MPEG-2 only if it is presented in a DVD like form. bit-rate defaults to 7500kbps, buffer sizes to the maximum permitted by the DVD specification. πŸ“€
  • -f, --format 10 β€” ATSC 480i πŸ“Ί
  • -f, --format 11 β€” ATSC 480p πŸ“Ί
  • -f, --format 12 β€” ATSC 720p πŸ“Ί
  • -f, --format 13 β€” ATSC 1080i πŸ“Ί

GENERAL FUNCTION LETTERS

  • -v, --verbose num β€” set verbosity level to num. 0 = warnings and errors only, 1 = information as well, 2 = really verbose. πŸ—£οΈ
  • -K|--custom-quant-matriceskvcd|tmpgenc| default | hi-res | file=inputfile | help β€” specify which quantisation matrices to use instead of the defaults (which can be specified by using "-K default"). using "-K hi-res" is identical to using the -H option. the value kvcd uses the Kvcd.Net matrices from http://www.kvcd.net/; the value tmpgenc invokes the TMPGEnc matrices from http://www.tmpgenc.net/e_main.html. on average (this depends on the source material), the tmpgenc tables reduce the average bitrate by about 10% and the kvcd tables reduce bitrate by about 16% (compared to the default tables). ✨
not me pointing out that the synopsis spells this one -K|--custom-quant-matrices while the body of the page glues the name straight onto the first value β€” so yeah, the string above is the option name exactly as it's written here. iykyk 🫢
  • -E, --unit-coeff-elim -40..40 β€” specify when a special 'unit coefficient elimination' algorithm should be applied to the encoded picture blocks. basically, this procedure forces blocks of a type that don't carry much information but are expensive to encode to be simply skipped. the larger the number, the more potentially visible this skipping is likely to be β€” but the more compression is boosted. a negative value means all coefficients are zeroed; positive means only texture but not base intensity coefficients are zeroed. values of around 10 or -10 seem to work well with high quality source material. for noisier material it might be worth trying 20 or -20. πŸ”₯
  • -R, --b-per-refframe 0..2 β€” specify how many bi-directionally (B type) difference-encoded frames should be encoded between reference (I or P) frames. the default is 0 except for VCD encoding, where it is 2 B frames as required by the standard. experts differ on how much using B frames improves compression. in practice, unless you have really clean material they tend to be fairly useless and sometimes even harmful. encoding is significantly faster and uses less memory if no B frames are encoded, and compression is rarely more than marginally worse. πŸ’€
  • -?, --help β€” display a synopsis of the command syntax. πŸ†˜

and that's only the first chunk of this page β€” there's so much more coming, we're just getting started ✨

✨ FUNCTION LETTERS ADJUSTING THE SELECTED PROFILE ✨

ngl bestie, listen up β€” if the profile you already picked sets particular values for any of these parameters, the profile wins and your adjustment flags just get overridden. πŸ’… And especially? There is like almost nothing you can adjust for the standard VCD and SVCD profiles. They said what they said.

  • -b, --video-bitrate num β€” the bitrate of the output video stream, in kBits/sec. Default is exactly the bitrate you need for VCD streams. And if you've selected variable bitrate (VBR) mode (peep the -q option), then this number is the maximum bitrate of the stream.
NOTE: by default MPEG-2 streams (-f 3, 4, 5, 8 and 9) are VBR. If you want CBR (Constant Bit Rate) streams, use the --cbr option. πŸ’€
  • -A, --ratecontroller 0..1 β€” pick which rate control algorithm to use. Default is 0.
  • -V, --video-buffer num β€” the maximum video buffer usage required to decode the stream, in KBytes. Default is 46KB, which is the (tiny, tiny, microscopic) size specified for VCD. The size for SVCD is the (way more reasonable) 230KB. And if you're encoding for a half-decent software decoder? Honestly push it up to 500K or more, it's giving breathing room. 🫢
  • -T, --target-still-size num β€” sets the target size for (S)VCD still images, in KB.
  • -s, --sequence-header-every-gop β€” this flag forces the encoder to generate a "sequence header" at the start of every group-of-pictures. Some player hardware needs this for fast forward / rewind / random access functions, but otherwise it's just wasting bits, no cap. πŸ™ˆ
  • -d, --no-dummy-svcd-SOF β€” okay so the SVCD MPEG-2 profile demands these special "Scan OFfset" thingies, which are (in effect) pointers to the place on the final SVCD disk where the video for 0.5 and around 5-10 seconds behind and ahead in the stream is located. The whole point of this info is to support "Fast forward/Rewind" functions. Unfortunately, at the time mpeg2enc encodes the video it genuinely does not know where the video is going to finally end up. So it writes special dummy "Scan OFfset" values, which are meant to be filled in during the creation of the SVCD image. Currently the GNU vcdimager tool handles that task. BUT β€” in some circumstances the dummy offsets can cause problems. This flag stops mpeg2enc from generating them. 😌
  • --correct-svcd-hds β€” in the official SVCD standards, the field in the MPEG-2 header info that passes on the encoder's "recommended" horizontal resolution to decode the stream to is supposed to take the values 540 (for 4:3 sequences) or 720 (for 16:9 sequences). In practice though? Many players just don't work unless the value is 480. This flag forces mpeg2enc to follow the official standard. Worth trying if your 16:9 sequences are playing at 4:3 aspect ratio. πŸ‘‘
  • --no-constraints β€” this flag deactivates all constraints for the maximum video samplerate or video resolution. Its purpose is to allow encoding of unusual resolutions of MPEG-video (e.g. 2200 x 576, 160 degrees FOV VR-theatre MPEG movies), but bestie, use this with care:
It can possibly circumvent a number of other security checks, and untested settings can cause mpeg2enc to crash in this mode. πŸ’€
  • -l, --level h|high|m|main β€” lets you set the MPEG-2 implementation level against which the coding parameters are checked. You may need to set this to 'high' if you're encoding HDTV material. πŸ“Ί
  • --no-altscan-mpeg2 β€” deactivates the use of the 'alternate' macroblock scan pattern for MPEG2 encoding. Normally this pattern is used, but a few elderly software decoders had bugs relating to this feature. You should never need to use this flag, fr fr. 🧚
  • --dualprime-mpeg2 β€” MPEG-2 supports a special motion estimation mode (DPME, Dual Prime Motion Estimation) for I/P-frame only streams that can somewhat improve compression. A number of players (both hardware and software) do not support this mode. Those players may or may not be MPEG-2 compliant, depending on whether DPME is an option or not in the MPEG-2 specs. If you need to generate content for such players (e.g. Ogle or Apple's DVD player application) you should NOT turn on dualprime-mpeg2! And surprisingly, at least one hardware/set-top player is known to be allergic to DPME being used. 😭
  • -z, --playback-field-order b|t β€” this flag overrides the field-order specified in the interlacing tag of the input stream header. (If you need this option, it indicates a problem in the capturing/encoding process where the temporal order of the two fields in each frame has been mislabeled. The effect of this is weird "juddering" when playing back the stream on a TV. Check the mjpeg-howto for more information about interlacing problems.) 🌸

✨ OPTION LETTERS CONTROLLING VIDEO PARAMETERS ✨

  • -n, --video-norm n|p|s β€” forces the input stream to be treated as NTSC|PAL|SECAM regardless of what the stream header might suggest. Basically this just sets the defaults for a bunch of other options. πŸ’«
  • -F, --frame-rate num β€” sets the frame-rate of the output-stream. By default this value is inferred from the input header. Currently only the standard MPEG rates are supported. Eventually more-or-less arbitrary rates will be possible. (soon, bestie, soon)
 0 - illegal
 1 - 24000.0/1001.0 (NTSC 3:2 pulldown converted FILM)
 2 - 24.0 (NATIVE FILM)
 3 - 25.0 (PAL/SECAM VIDEO / converted FILM)
 4 - 30000.0/1001.0 (NTSC VIDEO)
 5 - 30.0
 6 - 50.0 (PAL FIELD RATE)
 7 - 60000.0/1001.0 (NTSC FIELD RATE)
 8 - 60.0
  • -a, --aspect num β€” sets the playback aspect ratio code of the encoded video. By default this value is inferred from the input header.
 1 - 1  - 1:1 display
 2 - 2  - 4:3 display
 3 - 3  - 16:9 display
 4 - 4  - 2.21:1 display

For MPEG-2 the specified aspect ratios are used directly. For MPEG-1, mpeg2enc infers the MPEG-1 pixel aspect code from the video norm specified and the specified playback aspect ratio. πŸŽ€

  • -x, --display-hsize num
  • -y, --display-vsize num

These set the display-horizontal-size and display-vertical-size hints in the MPEG-2. By default these are simply the encode frame dimensions. However, if they're set to different values, the player gets a hint that the appropriate 'black bars' or cropping/scaling should be performed. The main use for these parameters is to set a display-vertical-size of 1080 for HDTV 1080i or 1080p material. Here, since the frame height has to be a multiple of 16, the encoded frame height is forced to be 1088, even though HDTV standards specify only 1080 lines of picture content. Standards committees... love 'em. πŸ™„

  • -p, --3-2-pulldown β€” setting -p only makes sense for 24 frame/sec Movie source material. It sets flags in the output stream that tell the decoder to play the movie as NTSC 60 field/sec video using "3:2 pulldown". This is vastly more efficient than encoding as 60 field/sec video. The classic application is to transcode a PAL-encoded movie (24fps played too fast at 25 fps!) into NTSC (see the -f flag). πŸ”₯

πŸ’– OPTION LETTERS FOR CONTROLLING COMPRESSION AND SPEED πŸ’–

Okay bestie, this is the speed-vs-quality part of the vibe check. Compression settings, CPU threading, motion search, all of it. Let's go. ✨

  • -M|--multi-thread num_CPU β€” this one tells mpeg2enc how many CPUs to flex with.

MPEG encoding is a task that can be split over a small number of CPUs quite efficiently. Mpeg2enc can be internally set to split major processing tasks between a number of concurrent threads. This flag adjusts the multi-threading to the optimum to utilise the specified number of CPU's.

It should be noted that even with 1 CPU present some multi-threading is performed: frame input takes place in parallel with encoding. The default -M value is 1. This allows good performance to be achieved when a separate machine is being used for pre-processing (decoding from MJPEG, scaling, denoising etc) with the final result pipe to mpeg2enc (e.g. using rsh or ssh).

Setting -M 0 disables all multithreading. This is sometimes useful for debugging or to achieve maximum CPU efficiency on a shared machine. Setting -M 3 on a dual-CPU machine will produce slightly faster results than -M 2 at the price of slightly less CPU efficiency. This is useful if nothing else needs to be done on the encoding machine. In practice there is little point setting -M greater than 4 even if the CPU's are available due to the fairly coarse-grained parallelism used. Indeed there is a hardcoded limit of 4 worker threads.

The default has been changed to be 0 instead of 1 to avoid the crash at end of encoding:

INFO: [mpeg2enc] Signaling last frame = 499
mpeg2enc: seqencoder.cc:433: void SeqEncoder::EncodeStream(): Assertion `pass1coded.size() == 0' failed.
Abort
  • -q|--quantisation 1..31 β€” minimum quantisation of the output stream, and quantisation is literally the precision knob for image information.

Quantisation controls the precision with which image information is encoded. The lower the number the higher the quality but the greater the required data-rate. NOTE: on IA32 systems it is possible to cause artifacting by setting the value too low (3 or less) due to arithmetic overflow/truncation in the DCT/iDCT routines. If this option is set a variable bitrate stream is produced. This is more efficient but variable bitrate MPEG-1 cannot be played by some hardware decoders and is rejected by some DVD authoring packages. If you intend to use a software decoder you'd be insane not to use variable bitrate.

If this option is set without a maximum bitrate being specified then quantisation is fixed at the specified value. It should be noted that not specifying a bitrate is probably an error and may produce unexpected results.

For MPEG-2 streams a default of 8 is used if -q is not explicitly given. To force constant bitrate streams use --cbr and -b NOT -q!

  • -I|--interlace-mode 0|1|2 β€” sets the sequence picture structure and block encoding type for MPEG-2 streams.

By default, this value is inferred from the interlacing tag of the input stream. Setting 0 encodes frame-by-frame with support for interlaced video turned off, and specifies that progressive chroma subsampling has been used. Setting 1 encodes frame-by-frame with interlace-adapted motion compensation and block encoding, and specifies that interlaced chroma subsampling has been used. Setting 2 encodes interlaced material field-by-field, which will produce more accurate results for highly textured interlaced material with lots of motion, at the expense of generally less efficiency.

This setting should match the interlaced-ness of the input stream, otherwise chroma artifacts may be generated when the MPEG stream is played back.
  • -g|--min-gop-size num β€” sets the minimum group-of-picture (GOP) size for the output MPEG stream.
  • -G|--max-gop-size num β€” sets the maximum group-of-picture (GOP) size for the output MPEG stream.

These flags set the minimum and maximum group-of-picture (GOP) size for the output MPEG stream. The default values depend on the output format.

For MPEG-1 (for example VCD) the default is a fixed GOP size of 12 (-g and -G are both set to 12).

For MPEG-2 the default value of -G (max) is set according to the video system: -G 15 for 625 line (PAL) and 18 for 525 line (NTSC). If -g (min) has not been specified then the minimum GOP size is set to be one half of the maximum (-G).

To force a fixed GOP size specify both -g and -G with the same value.

If the minimum and maximum GOP sizes are not identical then mpeg2enc will start a new GOP if more than 60% of the macroblocks in a P or B frame are Intra encoded. This ensures big changes of image coincide with a fully-encoded I-frame by starting a new GOP. This can help prevent transient "blockiness".

Reasonable minimum GOP sizes are 6 or 9. If a minimum is not specified but a maximum is given then the minimum will be set to one half the maximum. A larger GOP size can help reduce the bitrate required for a given quality. However, this really only applies to high-quality source material with little noise (e.g. digital video). For broadcast material there is little point setting GOP size much beyond 21 or 24. Even with good source material diminishing returns set in quite rapidly. Also it must be noted that specific MPEG-2 formats (such as for DVD) are constrained in the maximum allowable GOP size.

Note: mpeg2enc is currently hard-wired to produce 2 B frames between each I/P frame unless the GOP size forces less. This is reasonable for medium to high bitrates (>= 1Mbps) but probably sub-optimal for low-bitrate encoding.

  • -c|--closed-GOPs β€” makes the encoder generate only "closed" GOPs.

Setting this flag causes the encoder to generate only "closed" GOPs (Groups of Pictures) that can be decoded without reference to their predecessor. This is useful for streams that are supposed to be used in multi-angle DVD's and applications where more easily edittable MPEG is required.

  • -P|--force-b-b-p β€” forces the GOP size selection to keep 2 B frames between adjacent I/P frames.

This flag forces the GOP size selection to choose sizes that ensure 2 B frames appear between adjacent I/P frames. Several common MPEG-1 decoders can't handle streams where less than 2 B-frames appear between I/P frames.

  • -Q|--quantisation-reduction -4.0..5.0 β€” sets how much quantisation is reduced for blocks with lots of sharp detail.

This flag sets the amount quantisation is reduced for blocks containing large amounts of sharp image detail. Large values produces efficient use of bits but may cause visible artifacting around detailed sections. With noisy source material this option may cause a "swimming" effect on textured backgrounds as the noise cause the quantisation of blocks to be boosted at random. The default is 0.0 (off). See also the -X option.

  • -X|--quant-reduction-max-var 0.0..2500.0 β€” luma variance below which quantisation boost (-Q) is activated.
  • -r|--motion-search-radius num β€” sets the motion estimation search radius.

For most purposes the default (16) should be just fine. For high-resolution MPEG-2 and active scenes it may be worth bumping it up. However, this will make encoding significantly slower. There is little point reducing the radius. Speed gains are not huge and the impact on quality can be marked.

  • -4|--reduction-4x4 1..4 β€” controls discarding during the initial 4*4 sub-sampled search stage.
  • -2|--reduction-2x2 1..4 β€” controls discarding during the secondary 2*2 sub-sampled stage.

These options control how radical the encoder is in throwing away apparently poor candidate estimates during motion estimation. A setting of 1 means very few blocks are discarded early which makes for slow encoding but quality as good as it gets. A setting of 4 makes for fast encoding but can impact quality. The -4 flag controls discarding during the initial 4*4 sub-sampled search stage, the -2 flag controls discarding during the secondary 2*2 sub-sampled stage.

These flags are useful as the speed quality trade-off is markedly different depending on which CPU you have. On modern machines the impact on speed is around a factor 2 on older machines a factor 3. The impact on quality is around 10% quantisation (0.2 of a bit of precision in encoding textures). For most purposes the default settings will be fine. However on P-III Katmai etc -4 2 -2 1 gives a good near-optimum quality setting with reasonably speed.
  • -N|--reduce-hf num β€” adjusts how texture detail is quantised to reduce high-frequency precision.

Setting this flag adjusts the way texture detail is quantised to reduce the precision with which high-frequency information is encoded. This is very useful for mildly noisy sources. If you have really noisy material the filtering tools available in mjpegtools are a much better bet. The specified number must be in the range 0.0 to 2.0 gives the maximum quantisation boost. A useful number to use would be 1.5 or 1.0.

  • -H|--keep-hf β€” makes the encoder keep as much high-frequency information as possible.

Setting this flag makes the encoder encode as much high-frequency information as possible. This is a good setting for maximising quality at VCD resolution with good quality low-noise source material. It can also help with "swimmy" material if you can spare the bitrate!

  • -D|--intra_dc_prec num β€” specifies the precision of the DC component.

The default is 9. Most commercial DVDs use 10. Using 9 instead saves a few bits. Using 10 might help to avoid larger areas of nearly the same color looking blocky. A value of 11 is only valid at the next MPEG-2 profile/level so it's not a currently meaningful value to use.

✨ OPTION LETTERS FOR CHUNKING THE OUTPUT STREAM ✨

okay so this is the part where we tell mpeg2enc how to slice up the output so it actually fits places πŸ’…

  • -S|--sequence-length num β€” bestie, this sets the target size of individual sequences in the final multiplexed stream, measured in MBytes. If you set it, mpeg2enc keeps an eye on how big the eventual stream is getting and inserts a sequence split (which, real talk, is actually a sequence end / sequence start) into the output stream every single time it hits that limit you gave it. And here's the slay part: the multiplexer mplex(1) can recognise these splits and start a whole new multiplexed output file each time it runs into one πŸŽ€. Which means you can automatically make sure every component sequence file can be burnt onto a CD-R and still be played as a stand-alone MPEG sequence. Obsessed. For the SVCD and VCD profiles the default target sequence length is 700M bytes. For other profiles the default is that sequence length is unlimited.
  • -B|--nonvideo-bitrate num β€” mpeg2enc cannot read minds, periodt. It literally cannot know in advance what other material is gonna get multiplexed with the output video stream 🧚. So for its calculations of where to insert split points to come out right, it needs you to tell it the combined data-rate of all that other material that's eventually going to be multiplexed with the video. This flag lets you specify that rate in K bits/sec.

A good rule of thumb is to use the total rate of all the other streams plus 1% of the total rate including video.

  • -u|--cbr β€” forces the use of Constant Bit Rate encoding. Not it, honestly: it's less than optimal and inefficient in almost all cases, but some folks insist on it πŸ™ˆ.
NOTE: this disables (overrides) the use of the -q option!

Also, it is an error to use this option and not specify a bitrate using -b, because a constant bitrate of 0 makes no sense. Like, none. Zero sense. Literally zero πŸ’€.

  • --chapters frame,... β€” this one lets you define chapter points inside the mpeg stream, which is most useful when you're generating DVD video. Each chapter point is specified by frame number, and the first frame is number 0. Every chapter point you define will end up at the beginning of a closed GOP as an I frame. iconic behaviour honestly πŸ‘‘

πŸ¦‹ SSE, 3D-Now!, MMX ! πŸ¦‹

mpeg2enc makes extensive use of these SIMD instruction set extensions on x86 family CPU's, and the routines it uses are determined dynamically at run-time πŸ”₯.

It should be noted that using SSE requires operating system support. Old 2.2.x Linux kernels (unless they're patched ones like RedHat) do not have this, and so SSE, although physically present, won't be activated. so close, yet so far 😭


πŸ’€ BUGS πŸ’€

  • There should be an option to force GOP sizes that permit 2 B frames between I/P frames. Some decoders (even software ones) can't handle the case where I/P frames come back to back or with only 1 B frame between them.
  • There needs to be a facility for writing dummy user-data fields so that the multiplexer/imager can insert forward/backward pointers when muxing/imaging an SVCD.

πŸ‘‘ AUTHOR πŸ‘‘

This man page was written by Andrew Stevens. If you have questions, remarks, problems or you just want to contact the developers, the main mailing list for the MJPEG-tools is:

mjpeg-users@lists.sourceforge.net

For more info, see our website at

http://mjpeg.sourceforge.net

🌈 SEE ALSO 🌈

mplex(1), mp2enc(1), lavrec(1), lavplay(1), lav2yuv(1), lav2wav(1), yuvscaler(1), yuvdenoise(1), y4mdenoise(1), mjpegtools(1)


and that's the whole page, bestie 🫢 this lil masterpiece was brought to you by the MJPEG Tools Team and dated 25 Aug 2002, and it's the man page for mpeg2enc(1). go forth and encode, you absolute main character πŸ’–βœ¨