Fix 'moov atom not found' and unplayable 0-second MP4 recordings. Learn why cameras fail to finalize video headers and how to rebuild missing sample tables.
On This Page (7 sections) ▾
- 1. 🔬 Deep Dive: What Happens Inside an MP4 File?
- 2. Method 1: Repairing Truncated MP4s Using FFmpeg & Untrunc (Open Source)
- 3. Method 2: Automated Structural Repair with Prism Video Repair Tool
- 4. Technical Comparison: Repair Methods at a Glance
- 5. Frequently Asked Questions
- 6. 5 Proactive Tips to Prevent Truncated Video Corruption
- 7. Summary
⚡ Quick Direct Answer: What Is a Missing moov Atom and How to Recover It
A moov (Movie Atom) is the essential index header in an MP4/MOV container. It tells media players the frame rate, codec profiles, keyframe chunk offsets, and audio/video sync timings.
- Why it goes missing: When a recording device (such as a DJI drone, GoPro action camera, dashcam, or DSLR) suffers sudden power loss, battery exhaustion, or an interrupted SD card ejection before recording is stopped, raw video frames are written to the
mdatatom, but the closingmoovindex atom is never finalized. - Why media players fail: Without a
moovatom, players like VLC, Windows Media Player, or QuickTime cannot locate sample chunks. The file appears with a 00:00:00 duration or fails with errors like "moov atom not found". - How to fix it: Depending on camera write caching and storage integrity, raw compressed frames written prior to power loss may be present in the
mdatpayload. You can attempt to reconstruct the missing container headers by borrowing sample tables from a healthy donor video recorded on the same camera usinguntruncor an automated desktop utility like Prism Video Repair Tool.
You just completed a high-stakes shoot—drone aerial footage, a multi-camera wedding interview, or a mountain biking action run. When you plug the SD card into your workstation, your heart sinks: the video file is 4.2 GB on disk, but Windows reports 00:00:00 duration. When you try to open it in VLC, you receive a playback error, or FFmpeg outputs:
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f9a8800] moov atom not found
D:\Footage\DJI_0492.MP4: Invalid data found when processing inputThis error does not necessarily mean your footage is destroyed. In many recording interruptions, raw compressed frames written prior to power loss remain in the container file in sequential order. What is missing is the index map (moov atom).
This guide explains the internal architecture of ISO Base Media containers, why modern cameras write the moov atom last, and step-by-step methods to restore corrupted MP4s using command-line tools and automated donor-sample recovery.
🔬 Deep Dive: What Happens Inside an MP4 File?
An MP4 container is composed of discrete hierarchical data blocks called atoms or boxes (defined by ISO/IEC 14496-12). In a standard recording, three primary atoms govern playback:
┌────────────────────────────────────────────────────────┐
│ ANATOMY OF AN MP4 / MOV FILE │
├────────────────────────────────────────────────────────┤
│ 1. [ftyp] File Type Box (Magic Bytes: isom, mp42, qt) │
│ -> Declares container compatibility & brand profile │
├────────────────────────────────────────────────────────┤
│ 2. [mdat] Media Data Box (Majority of File Size) │
│ -> Raw compressed video (H.264/HEVC) and audio (AAC)│
│ -> Written continuously in real-time while recording│
├────────────────────────────────────────────────────────┤
│ 3. [moov] Movie Atom (The Missing Index Table) │
│ ├─ [mvhd] Movie Header: Timeline, timescale, duration│
│ ├─ [trak] Video Track: Dimensions, SPS/PPS sequence │
│ │ └─ [stbl] Sample Table Box │
│ │ ├─ [stts] Time-to-sample (frame timestamps) │
│ │ ├─ [stss] Sync sample (I-frame / keyframes) │
│ │ └─ [stco / co64] Chunk byte offset tables │
│ └─ [trak] Audio Track: Sample rate, channel maps │
└────────────────────────────────────────────────────────┘Why Do Cameras Place moov at the End?
When a camera records video, it cannot predict the final clip duration or total keyframe count in advance. To avoid repeatedly seeking back to the beginning of the SD card to update byte offsets—which would cause write stalls and dropped frames—camera firmware writes the continuous stream to mdat first.
Only when the user presses Stop Recording does the camera finish calculating chunk offsets, append the moov atom to the end of the file, and close the file handle.
If the battery disconnects, the drone crashes, or the SD card is pulled mid-write:
mdatmay contain compressed media packets successfully committed to flash storage before the cutoff.moovis completely absent.- Standard media players cannot decode
mdatwithoutstcochunk tables.
Preserve Your Original Media (Working Copy Required):
Before attempting any repair command or opening files in recovery tools, create a backup copy of your damaged video file and store the original in a safe directory. Never run repair operations directly against your only copy on an SD card or camera media.
Method 1: Repairing Truncated MP4s Using FFmpeg & Untrunc (Open Source)
If you are comfortable with command-line utilities, you can compile and use the open-source utility untrunc (developed by Federico Ponchio, hosted at https://github.com/ponchio/untrunc) to parse a healthy reference clip and calculate missing sample tables.
Upstream Specification & Prerequisites:
- Repository:
ponchio/untrunc(README Reference, checked October 2026). - The Damaged Video: (e.g.,
corrupt_flight.mp4). - A Healthy Donor Video: (e.g.,
healthy_reference.mp4) recorded on the exact same camera with the same resolution, frame rate, and codec profile (e.g., 4K 60fps H.264). - Compilation Requirements: Untrunc relies on internal Libav 12 headers and requires building Libav from source. Prerequisites include
git,g++(C++11),make,yasmornasm, and development libraries (zlib,pthreads). On macOS, linking flags for Apple frameworks (-framework CoreFoundation -framework CoreVideo -framework VideoDecodeAcceleration) may be needed.
Documented Build & Execution Commands (Upstream README):
Environment Note: The following sequence represents the build procedure documented in the upstream repository README. This procedure is documented for technical reference and has not been runtime-tested in this local environment.
# 1. Clone repository recursively to include libav submodule
git clone --recurse-submodules https://github.com/ponchio/untrunc
cd untrunc/libav
# 2. Configure and build Libav source
./configure
make
cd ..
# 3. Compile untrunc with Libav libraries
g++ -o untrunc -I./libav file.cpp main.cpp track.cpp atom.cpp codec_*.cpp codecstats.cpp codec.cpp mp4.cpp log.cpp -L./libav/libavformat -lavformat -L./libav/libavcodec -lavcodec -L./libav/libavresample -lavresample -L./libav/libavutil -lavutil -lpthread -lz -std=c++11
# 4. (Optional) Install system-wide
sudo install -vpm 755 ./untrunc /usr/local/bin/
# 5. Run untrunc with donor sample and working copy of corrupt file
./untrunc healthy_reference.mp4 corrupt_flight.mp4untrunc reads stbl sample tables from healthy_reference.mp4, matches the Sequence Parameter Sets (SPS) and Picture Parameter Sets (PPS) in corrupt_flight.mp4, and writes a reconstructed video: corrupt_flight.mp4_fixed.mp4.
Output Verification & Limitations:
- Donor Matching: A donor file provides a candidate index profile. If the donor differs in audio channel layout, timescale ticks, or variable frame rate cadence, audio/video synchronization drift can occur.
- Verification Step: Inspect the generated output using
ffprobeto verify track durations:
ffprobe -v error -show_entries stream=codec_name,duration -of default=noprint_wrappers=1 corrupt_flight.mp4_fixed.mp4- Stop Condition: If
untruncreports that no valid NAL units or recognizable video frames could be located inmdat, this repair attempt could not identify recoverable frames within the container. This outcome alone does not establish why parsing failed or certify that no recoverable data exists on the underlying medium. Preserve your original media untouched, stop repeated identical repair attempts that risk altering working copies, and avoid assuming missing footage can be synthesized.
Method 2: Automated Structural Repair with Prism Video Repair Tool
When command-line compilation is impractical or when working with multi-channel audio layouts, High Dynamic Range (HDR10 / HLG) metadata, Apple ProRes, or complex HEVC GOP structures, automated container recovery simplifies the restoration process.
Prism Video Repair Tool provides an automated desktop workflow on Windows and macOS that parses container syntax, reconstructs damaged atom trees, and performs frame-by-frame stream alignment locally on your workstation.
Step 1: Add Corrupted Video Files
Launch Prism Video Repair Tool. Drag and drop your truncated .mp4, .mov, .mkv, or .avi files into the batch queue.
Step 2: Provide a Working Sample Donor
For videos with missing moov atoms or damaged headers, click Add Sample Video. Select any working, playable video file recorded with the same camera model and recording profile.
┌──────────────────────────────────────────────────────────┐
│ PRISM ADVANCED ATOM RECONSTRUCTION PIPELINE │
├──────────────────────────────────────────────────────────┤
│ 1. Extract SPS / PPS & VUI Parameters from Sample Donor │
│ 2. Scan Damaged mdat for NALU Start Codes (0x00000001) │
│ 3. Rebuild stts, stsc, stsz, and co64 Byte Offset Tables │
│ 4. Re-interleave AAC / LPCM Audio Packet Timestamps │
│ 5. Lossless Remux: Direct Stream Copy Without Encoding │
└──────────────────────────────────────────────────────────┘Step 3: Repair and Preview
Click Repair All. The software performs a non-destructive read of the raw mdat stream and generates an index-aligned MP4 file. You can preview video playback directly in the integrated media player to evaluate visual continuity and audio sync before saving.
Free Trial Diagnostics: The free trial edition performs complete container diagnostics and provides a 1-minute video preview of repaired files, allowing you to verify audio synchronization and frame continuity before purchasing a license.
Technical Comparison: Repair Methods at a Glance
| Feature | VLC Transcode | FFmpeg Copy (-c copy) | Untrunc CLI | Prism Video Repair Tool |
|---|---|---|---|---|
Missing moov Atom | ❌ Fails (Cannot open file) | ❌ Fails (moov atom not found) | ✅ Rebuilds via donor sample | ✅ Rebuilds via donor sample |
| Donor Sample Engine | ❌ None | ❌ None | ✅ Command-line donor matching | ✅ Visual donor workflow |
| Audio/Video Sync | ⚠️ Re-encodes audio stream | ⚠️ Requires existing timestamps | ⚠️ Dependent on donor matching | ⚠️ Candidate alignment; preview check |
| Batch Processing | ❌ Single file conversion | ⚠️ Requires custom shell script | ❌ Single file CLI invocation | ✅ Multi-file queue |
| High Bit-Depth / HDR | ⚠️ Transcodes to standard 8-bit | ⚠️ Dependent on CLI flags | ⚠️ Dependent on Libav/FFmpeg build | ✅ Preserves compatible 10-bit HDR / ProRes streams when bitstream is undamaged |
| Operating System | Windows / macOS / Linux | Windows / macOS / Linux | Linux / macOS / WSL (compile) | Windows 11/10 / macOS |
Frequently Asked Questions
Can an MP4 with a missing moov atom be repaired without a donor sample?
If the video bitstream contains in-band Sequence Parameter Sets (SPS) and Picture Parameter Sets (PPS), basic frame dimensions can sometimes be identified. However, without a reference donor file recorded with the same camera settings, calculating precise sample chunk offsets (stco/co64), timescale ticks, and audio interleaving intervals is difficult. Providing a donor from the same device supplies candidate parameters, though exact frame count still depends on the undamaged mdat payload.
Why doesn't VLC's "Always fix" feature repair missing moov atom MP4 files?
VLC's automatic index repair function is specifically built for the AVI container format (.avi), which stores index blocks at the end of the file in an AVIIF structure that VLC can reconstruct on the fly. MP4 containers use hierarchical ISOBMFF atom structures; if the moov atom is absent, VLC cannot locate stream tracks and rejects the file.
Will repairing the moov atom degrade my original video quality?
Reconstructing a missing moov atom is a container remuxing operation. When the underlying compressed video frames (H.264, HEVC, ProRes) and audio packets stored in mdat are intact, they are re-indexed into a fresh container without decoding or re-encoding the bitstream. However, if individual frame packets suffered bit corruption during power loss, visual artifacts may exist in those specific frames.
Why does my camera show a 0-second file that takes up gigabytes of storage?
When recording begins, the camera reserves cluster storage and streams compressed frames directly into the mdat container on the SD card. Operating systems read the clip duration from the mvhd atom inside moov. Because power was lost before the camera firmware could write moov, file explorers display the correct byte size on disk but report a 00:00:00 duration.
5 Proactive Tips to Prevent Truncated Video Corruption
- Wait for Write Completion Before Powering Down: Wait 3 to 5 seconds after pressing Stop Recording to allow camera firmware to flush write buffers and finalize the
moovatom on the memory card. - Use High-Endurance Video-Class SD Cards: Ensure your cards meet minimum sequential write standards (V30, V60, or V90) matching your camera's bitrate to prevent buffer overflow truncation.
- Format Cards In-Camera: Avoid formatting camera memory cards with generic OS formatters; use your camera's internal formatting menu to maintain optimal allocation unit sizes.
- Monitor Drone and Camera Battery Health: Voltage dips during heavy loads can cause cameras to shut down unexpectedly before closing active file handles.
- Always Transfer to Local Storage Before Editing: Copy video files to an internal SSD before opening them in editors like Premiere Pro, DaVinci Resolve, or Final Cut Pro to prevent card reader disconnects during project ingestion.
Summary
A missing moov atom error indicates an incomplete container index rather than confirmed media loss. When raw compressed frames remain in the mdat payload, donor-assisted atom reconstruction in Prism Video Repair Tool or open-source command-line utilities can rebuild damaged container tables without re-encoding. Always verify repaired clips in a media player before deleting working backups.
Video Repair Tool
Resurrect corrupt, truncated, unplayable MP4, MOV, and MKV video files. Rebuild missing MOOV atoms, repair drone/action-camera crashes, and export lossless original bitstreams without re-encoding.