File format · .mjpg
SMJPEG (.mjpg) Video Format: Structure, Corruption and Repair
SMJPEG is a simple Motion JPEG container from Loki Entertainment. Learn its structure, why .mjpg files fail to play, and how damaged frames are recovered.
SMJPEG, short for Simple Motion JPEG, is a compact video container introduced around 1999 by Loki Entertainment Software, the company best known for porting commercial games to Linux. Loki designed the format to carry the intro and cutscene video used in those ports and in its installer and demo tools. An SMJPEG file stores every frame as a complete, self-contained JPEG image, optionally interleaved with audio, and that simplicity is why the format is unusually forgiving when damaged: a fault normally costs individual frames rather than the entire recording. On this page we explain how SMJPEG files are built, why they stop playing, and what can realistically be recovered from a damaged one.
What Is SMJPEG and Which Software Uses It?
SMJPEG is a multimedia container, not a codec. The video inside is ordinary JPEG, one still image per frame, and the audio is either uncompressed PCM or a simple ADPCM variant. Loki chose this design because JPEG decoding was fast and dependable on late-1990s hardware, and because the company wanted a royalty-free video format it could freely ship with its Linux products.
The format is legacy today. Loki ceased operations in early 2002, and no mainstream recording device or editor produces SMJPEG now. The files we are asked to recover typically come from preserved game installations and demo discs of that era, from old backups, or from archival systems that once used Loki's freely licensed tools. Playback support survives in FFmpeg and in software built on it, including VLC and MPlayer, and the original Loki smjpegtools still circulate in source form.
Two identification notes are worth making. First, the conventional extension is .mjpg, which is heavily overloaded: cameras, webcams and surveillance recorders also label Motion JPEG output .mjpg or .mjpeg, and those files are usually M-JPEG inside an AVI container or a raw concatenation of JPEG frames, not SMJPEG at all. Second, SMJPEG has no IANA-registered MIME type, so capable software identifies it by its internal signature rather than by extension or declared type.
SMJPEG File Structure: Key Technical Facts
An SMJPEG file begins with the byte sequence 00 0A 53 4D 4A 50 45 47, a two-byte prefix (0x00 0x0A) followed by the ASCII string SMJPEG, then a four-byte big-endian version number for which the only defined value is zero. All multi-byte integers in the file are stored big-endian.
After the signature, the file is a flat sequence of chunks. Each chunk consists of a four-character tag, a four-byte big-endian length, and a payload of exactly that length. The header chunks are:
| Chunk tag | Purpose |
|---|---|
HEDR |
Video parameters: picture width and height, total frame count, frame rate |
SND |
Audio parameters: codec, bit depth, channel count, sample rate |
TXT |
Free-form text, typically a copyright or comment string |
The SND tag is four characters and its fourth character is a space. Inside the audio header, the codec is identified by name: NONE marks uncompressed PCM, while APCM marks an ADPCM variant.
Following the headers, audio and video data chunks are interleaved. Every data chunk begins with a 32-bit big-endian timestamp expressed in milliseconds, which is what keeps picture and sound in step. The payload of a video chunk is a complete JPEG image, bounded by the standard JPEG start-of-image marker (FF D8) and end-of-image marker (FF D9). There is no inter-frame compression: no frame depends on any other frame. The practical trade-off is a larger file than an equivalent MPEG-era stream, which is one reason the format disappeared, but it also means damage stays local instead of cascading through the whole video.
For exact field layouts, the original Loki specification and the FFmpeg source code are the authoritative references, and those are the documents our engineers work from when rebuilding files.
Why SMJPEG Files Become Corrupt or Unreadable
Several failure patterns account for nearly all of the damaged SMJPEG files we see:
- Interrupted writes. If the encoding or capture process crashed, or the machine lost power mid-write, the final chunk is truncated or the file simply stops mid-frame. Long unattended encodes on period hardware made this common.
- Interrupted transfers. A download or copy operation cut short leaves a structurally valid file with a hard stop partway through.
- Storage media decay. Bad sectors on aging hard drives, disc degradation on original CD media, and failing flash cards all punch holes in file data. Because intra-frame video produces large files, the odds of a hit somewhere in the stream are high.
- Header damage. If the HEDR chunk is affected, players may refuse the file entirely or misreport its duration and resolution even though every frame is intact underneath.
- Chunk length corruption. A single damaged length field desynchronizes the parser: everything after that offset looks like garbage to the player, even though perfectly good frames are sitting right there in the file.
- Misidentification. Many "corrupt SMJPEG" files turn out to be camera M-JPEG files with the same extension. The repair path for those is completely different, so format identification always comes first.
What Can Be Recovered from a Damaged SMJPEG File
The intra-frame design makes SMJPEG one of the more recoverable video formats. Realistic outcomes include:
- Intact frames, recoverable as normal JPEG still images regardless of what surrounds them in the file.
- The audio track, which can be extracted independently of the video.
- Original timing, reconstructed from the millisecond timestamps on each data chunk.
- A rebuilt header: picture dimensions can be read from the JPEG frame data itself, and duration and frame rate can be derived from the timestamps and frame count.
- Partial frames: when a JPEG is damaged partway through, the portion of the image above the break often still renders.
How SMJPEG Recovery Works
Professional recovery from an SMJPEG file generally proceeds in stages:
- Identification and triage. Confirm the signature bytes and establish what the file actually is before touching it.
- Structural walk. Parse the chunk chain offset by offset, recording every valid chunk, to locate the first structural break.
- Header reconstruction. Rebuild the HEDR information from the recovered frame data so players accept the file again.
- Frame carving. Scan for FF D8 and FF D9 boundaries and extract each complete JPEG, then repair per-frame damage such as truncated image data or missing tables.
- Audio salvage. Pull the PCM or ADPCM audio chunks and convert them to a standard waveform format.
- Reassembly. Re-interleave picture and sound using the original timestamps and remux the result into a modern container such as MKV, MP4 or AVI, or deliver an image sequence plus an audio file.
- Verification. A full play-through check of frame count, duration and audio synchronization before the file is returned.
First Checks You Can Try Yourself
Before seeking help, two quick tests are worthwhile. Open the file in VLC or ffplay, since robust players sometimes tolerate minor header inconsistencies. Then try a lossless remux, for example ffmpeg -i input.mjpg -c copy output.mkv, which rewraps the existing streams without re-encoding and can resolve purely structural quirks. If the tool reports an unrecognized or broken format, stop there and keep an untouched copy of the original: these methods only help when the header and chunk chain are fundamentally intact, and further attempts can overwrite recoverable data.
Frequently Asked Questions
What is an SMJPEG file?
A legacy video container created by Loki Entertainment Software for Linux game ports. Each frame is a standalone JPEG image, with optional PCM or ADPCM audio, and the conventional extension is .mjpg.
Is SMJPEG the same as the .mjpg videos my camera records?
Usually not. Camera and webcam .mjpg files are typically Motion JPEG inside an AVI container or a raw stream of JPEG frames. A quick signature check settles the question, and it matters because the two need different repair approaches.
Which programs open SMJPEG files?
VLC, MPlayer and ffplay, along with anything else that uses the FFmpeg or Libav SMJPEG demuxer. Loki's original smjpegtools also remain available in source form.
Why does my SMJPEG video stop partway through or play with heavy blockiness?
A truncated file or a corrupted chunk length desynchronizes the parser, so playback halts at the break. Heavy blockiness or color distortion in individual frames means the JPEG data itself is damaged partway through the image.
Can a truncated SMJPEG file be repaired?
Usually yes. Every frame before the cutoff is intact and can be carved out and remuxed into a playable file; the recovered duration simply reflects what was actually written.
Can I extract still images from a damaged SMJPEG file?
Yes. Because each frame is a complete JPEG bounded by standard markers, frame carving can pull every surviving image out as an ordinary .jpg file, even when the container itself is beyond repair.
Get a Free Evaluation
If you have an SMJPEG file that will not play, send it to us for a free evaluation. We will examine the header and chunk structure, tell you exactly which frames and audio are recoverable, and provide a clear quote before any repair work begins, with no obligation on your part.
Send us your .mjpg file for a free evaluation
Our recovery engineers will tell you exactly what can be recovered — at no cost. There is no charge if we cannot recover your data.
Start a free evaluation