Motion JPEG (MJPEG) is a video compression format in which every frame is encoded as an independent JPEG image, with no prediction from neighboring frames. Among video codecs it is the archetypal intra-frame codec: each picture can be decoded on its own, which makes the format simple, robust and fast, but far less storage-efficient than inter-frame codecs such as H.264 or H.265.
In video practice, MJPEG survives wherever low encoding latency, cheap hardware and frame-accurate access matter more than bitrate. Typical homes for it are USB webcams, IP surveillance cameras, industrial and machine-vision systems, some older digital still cameras with a video mode, and certain capture cards.
How Motion JPEG compresses each frame
Motion JPEG applies the baseline JPEG pipeline to each frame separately. The encoder converts RGB to YCbCr color, usually subsamples chroma to 4:2:2 or 4:2:0, splits the image into 8×8 pixel blocks, transforms each block with the discrete cosine transform (DCT), quantizes the coefficients and finally packs them with Huffman entropy coding.
The quantization tables decide the trade-off between quality and size. A higher JPEG quality setting means finer quantization steps, more retained detail and larger frames. Because there is no motion estimation, the encoder never compares one frame with the next, so the computational cost per frame stays constant and small.
The following table summarizes the stages of the pipeline and what each one contributes to the final frame size.
| Stage | What it does | Effect on size or quality |
|---|---|---|
| Color conversion | RGB to YCbCr | Separates brightness from color |
| Chroma subsampling | Reduces color resolution (4:2:2 or 4:2:0) | Saves about one third to one half of data |
| DCT | Converts 8×8 blocks into frequency coefficients | Concentrates energy in few values |
| Quantization | Rounds coefficients by table values | Main source of loss and savings |
| Huffman coding | Lossless packing of the remaining values | Removes statistical redundancy |
Variants, containers and transport of MJPEG
MJPEG is not one tightly specified standard but a family of closely related practices. Historically, vendors stored JPEG frames in AVI or QuickTime files with slightly different headers, which caused compatibility problems between editing systems in the 1990s. Apple defined MJPEG-A and MJPEG-B variants for QuickTime, and some implementations omit the Huffman tables from each frame and rely on a default table instead.
On networks, the format travels in several ways. The most common for cameras is an HTTP multipart stream, where the server sends JPEG frames one after another separated by boundary markers. RTP has a dedicated payload format for JPEG, and UVC webcams deliver MJPEG frames over USB when the bandwidth is insufficient for uncompressed YUV.
| Wrapper or transport | Typical use | Notes |
|---|---|---|
| AVI | Older cameras and capture cards | Widely readable, limited metadata |
| QuickTime MOV | Legacy editing workflows | MJPEG-A and MJPEG-B variants |
| HTTP multipart | IP and surveillance cameras | Viewable directly in many browsers |
| RTP payload for JPEG | Professional IP video | Standardized packetization |
| USB Video Class (UVC) | Webcams at 1080p and above | Reduces USB bandwidth demand |
A related but distinct format is Motion JPEG 2000, which wraps JPEG 2000 wavelet-coded frames. It is used in digital cinema packages and archival work and should not be confused with classic DCT-based MJPEG.
Motion JPEG compared with inter-frame codecs
The decisive difference is temporal redundancy. Codecs such as MPEG-2, H.264, H.265 and AV1 organize frames into a GOP with keyframes, P-frames and B-frames, transmitting only what changes. MJPEG transmits every frame in full, so at comparable visual quality it typically needs roughly five to ten times the bitrate of H.264, depending on scene motion and settings.
In exchange, MJPEG offers constant, very low latency, trivial random access and graceful failure: a corrupted frame affects only that single frame, while an error in an inter-frame stream can propagate until the next keyframe.
| Codec | Compression type | Relative bitrate | Typical strength |
|---|---|---|---|
| MJPEG | Intra-frame, DCT | Very high | Low latency, simple hardware |
| ProRes or DNxHR | Intra-frame, DCT, 10-bit and higher | High | Editing and grading quality |
| H.264 | Inter-frame with GOP | Low | Universal delivery |
| H.265 | Inter-frame with larger blocks | Lower than H.264 | 4K streaming and storage |
| Motion JPEG 2000 | Intra-frame, wavelet | High | Cinema and archives |
Compared with professional intermediates such as ProRes or DNxHR, classic MJPEG is usually limited to 8-bit depth and lacks their well-defined profiles, which is why it is rarely chosen for modern post-production even though the frame-by-frame principle is the same.
Where MJPEG is still the right choice
MJPEG remains a sensible choice when encoder simplicity and immediacy outweigh storage cost. A JPEG encoder is inexpensive in silicon and widely available as a hardware block in image signal processors, so low-cost cameras can produce MJPEG without a dedicated video engine.
The following decision table relates typical situations to a recommended approach.
| Situation | Recommended choice | Reason |
|---|---|---|
| Machine vision or robotics | MJPEG | Every frame is independently usable and latency is minimal |
| USB webcam at high resolution | MJPEG from camera, H.264 for sending | USB bandwidth limits uncompressed video |
| Long-term surveillance archive | H.264 or H.265 | MJPEG storage costs grow quickly |
| Internet streaming to viewers | H.264, H.265 or AV1 | MJPEG bitrates are impractical |
| Professional editing | ProRes or DNxHR | Higher bit depth and defined profiles |
When MJPEG is used, the JPEG quality factor is the main control. Values around 75 to 90 are common; below about 60, blocking artifacts and ringing become visible on edges and in gradients.
Limitations and common mistakes with Motion JPEG
The main weakness of MJPEG is inefficient use of bandwidth and storage. A 1080p stream at 30 frames per second can easily require tens of megabits per second, which quickly fills disks and saturates network links when many cameras record at once.
- Assuming MJPEG is lossless: every frame is lossy JPEG, and repeated re-encoding accumulates generation loss.
- Ignoring audio handling: many MJPEG streams, especially HTTP ones, carry no audio or carry it separately, which complicates synchronization.
- Overlooking variable frame rate: network cameras often drop or repeat frames, so timestamps matter when importing footage into editing software.
- Expecting modern color pipelines: 8-bit depth and limited metadata make MJPEG a poor source for HDR or heavy grading.
In plain words
Motion JPEG is video made of a fast series of ordinary photos. Each picture is saved as a separate JPEG, just like a phone photo, and the pictures are played one after another. Nothing is shared between them.
This makes the format simple and quick, because the camera never has to compare pictures. The price is large files. More modern formats save only the parts of the picture that change, so they are much smaller. MJPEG is like a flipbook where every page is fully redrawn instead of copying the unchanged background.
A real-world example
A food-processing plant uses eight inspection cameras above a conveyor belt. Each camera sends 1280×720 MJPEG at 30 frames per second to a vision computer that checks every package label. Because each frame is a complete JPEG, the software can grab any single frame immediately, and end-to-end delay stays under about 50 milliseconds, fast enough to trigger a rejection arm.
The engineers tried H.264 to reduce network load, but the encoder buffering added delay and occasional corrupted frames smeared across several images. They kept MJPEG for live inspection at a quality setting of 85, at roughly 15 Mbit/s per camera, and transcode only flagged clips to H.264 for the long-term archive. The result is reliable real-time inspection with manageable storage.