When Your Video File Refuses to Play
You recorded an important interview, downloaded a large video, or received a critical file from a client -- and it will not play. The player shows a black screen, the audio is missing, the video freezes partway through, or the file refuses to open entirely. This is video corruption, and it is far more common than most people realize.
Video file corruption can happen for dozens of reasons: interrupted transfers, storage device failures, incomplete downloads, encoding errors, or even software crashes during editing. The good news is that most corrupted video files can be repaired. The key is understanding what went wrong and applying the right fix.
This guide walks you through every major method for diagnosing and repairing corrupted video files, from simple re-encoding to advanced header reconstruction. Whether you are dealing with a damaged MP4, a broken MOV, or an unplayable MKV, you will find a solution here.

Understanding Video File Corruption
How Video Files Are Structured
Before you can fix a corrupted video, it helps to understand how video files work. Every video file consists of two main components:
- Container (MP4, MOV, MKV, AVI) -- The wrapper that holds everything together, including metadata, index tables, and pointers to the actual media data
- Streams (video codec + audio codec) -- The actual compressed media data inside the container
The container stores critical metadata: the moov atom (in MP4/MOV files), index tables, timestamps, and information about how the video and audio streams are interleaved. If this metadata is damaged, the file becomes unplayable even though the actual video data may be perfectly intact.
For a deeper understanding of the relationship between containers and codecs, the container vs codec guide explains these concepts in detail.
Common Types of Video Corruption
| Corruption Type | Symptoms | Common Cause | Repairability |
|---|---|---|---|
| Missing moov atom | File won't open at all | Interrupted recording/transfer | High |
| Corrupt index/headers | Cannot seek, no duration shown | Incomplete download | High |
| Partial data loss | Playback stops at certain point | Disk failure, bad sectors | Medium |
| Audio/video desync | Audio drifts from video | Encoding error, format mismatch | High |
| Visual artifacts | Blocks, glitches, green frames | Codec errors, bitstream corruption | Medium |
| Complete bitstream corruption | Unrecognizable file | Severe disk failure, ransomware | Low |
Step 1: Diagnose the Problem
Before attempting any repair, you need to understand exactly what is wrong with your file. FFmpeg's ffprobe tool is the best diagnostic instrument available.
Using FFprobe to Analyze Corrupted Files
ffprobe -v error -show_format -show_streams corrupted_video.mp4
This command outputs detailed information about the file structure. Look for:
- Duration: If it shows
N/Aor0, the moov atom or index is missing - Stream info: Check if both video and audio streams are detected
- Codec name: Verify the codec is recognized (e.g.,
h264,aac) - Bit rate: A value of
0orN/Asuggests metadata corruption
For a more detailed error analysis:
ffprobe -v verbose -show_error corrupted_video.mp4 2>&1 | head -50
Quick Diagnosis Checklist
Run through these checks before attempting any repair:
- Does the file have a reasonable size? A 0 KB file is empty, not corrupted
- Can VLC play it? VLC has built-in repair capabilities and can often play partially corrupt files
- Does the file extension match the actual format? Use
filecommand on Linux/Mac or check with a hex editor - Was the file fully downloaded/transferred? Check file size against the expected size
Pro Tip: Always work on a copy of the corrupted file, never the original. Some repair attempts can make corruption worse if they fail, and you want to preserve the original data for other recovery methods.

Step 2: Simple Fixes (Try These First)
Method 1: Re-encode with FFmpeg
The simplest and most effective repair method. FFmpeg can often read corrupted files that other players cannot, and re-encoding creates a clean new file:
ffmpeg -i corrupted_video.mp4 -c:v libx264 -c:a aac -strict experimental repaired.mp4
If the file has errors FFmpeg chokes on, add error handling flags:
ffmpeg -err_detect ignore_err -i corrupted_video.mp4 -c:v libx264 -c:a aac repaired.mp4
To skip damaged sections and continue processing:
ffmpeg -err_detect ignore_err -fflags +genpts+discardcorrupt -i corrupted_video.mp4 -c:v libx264 -c:a aac repaired.mp4
For more on FFmpeg conversion commands, the FFmpeg beginner's guide covers the fundamentals.
Method 2: Copy Streams Without Re-encoding
If the media data is intact and only the container is damaged, stream copying is faster and lossless:
ffmpeg -i corrupted_video.mp4 -c copy -movflags +faststart repaired.mp4
This rewrites the container metadata without touching the actual video and audio data. It is particularly effective for MP4 files with missing or misplaced moov atoms.
Method 3: Use VLC Media Player
VLC has a built-in repair feature:
- Open VLC and go to Media > Convert/Save
- Add the corrupted file
- Click Convert/Save
- Choose a profile (H.264 + AAC in MP4)
- Set output filename and click Start
VLC can also fix AVI files specifically:
- Go to Tools > Preferences > Input/Codecs
- Find Damaged or incomplete AVI file
- Set to Always fix
Step 3: Fix Missing Moov Atom (MP4/MOV Files)
The moov atom is a critical metadata section in MP4 and MOV files that contains the index, timing information, and stream descriptions. By default, many encoders write the moov atom at the end of the file. If recording or transfer is interrupted before this atom is written, the file becomes unplayable even though the actual video data is intact.
Using untrunc
The untrunc tool reconstructs the moov atom by using a reference file recorded with the same device and settings:
# Build untrunc (one-time setup)
git clone https://github.com/anthwlock/untrunc.git
cd untrunc && make
# Repair the file using a working reference
./untrunc reference_video.mp4 corrupted_video.mp4
The reference file must be recorded with the same camera/device using the same settings (resolution, frame rate, codec). Untrunc analyzes the reference file's moov atom and uses it as a template to rebuild the corrupted file's metadata.
Using recover_mp4
For files where no reference is available:
# recover_mp4 attempts to reconstruct without a reference
recover_mp4 corrupted_video.mp4 repaired.mp4
Using FFmpeg to Rebuild the Index
ffmpeg -i corrupted_video.mp4 -c copy -movflags +faststart repaired.mp4
The -movflags +faststart flag moves the moov atom to the beginning of the file, which can sometimes resolve playback issues even when the original moov atom exists but is in the wrong position.
Pro Tip: If you regularly record long videos (interviews, lectures, events), configure your recording software to write the moov atom at the beginning of the file, or use a format like MKV that does not rely on a trailing index. You can always convert MKV to MP4 afterward.
Step 4: Advanced Repair Techniques
Repairing AVI Files
AVI files use a different index structure (idx1) that can also become corrupted. FFmpeg can rebuild it:
ffmpeg -i corrupted.avi -c copy -f avi repaired.avi
For severely damaged AVI files, DivFix++ is a specialized tool:
divfix++ -i corrupted.avi -o repaired.avi
If you need to convert the repaired AVI to a more modern format, the AVI to MP4 converter handles the conversion while preserving quality.
Repairing MKV Files
MKV (Matroska) files are more resilient to corruption than MP4 because they use a different container structure. The mkclean and mkvtoolnix utilities can repair many issues:
# Rebuild the MKV container
mkvmerge -o repaired.mkv corrupted.mkv
# If mkvmerge fails, try extracting and remuxing tracks
mkvextract tracks corrupted.mkv 1:video.h264 2:audio.aac
mkvmerge -o repaired.mkv video.h264 audio.aac
For converting repaired MKV files, our MKV converter supports batch processing.
Fixing Audio/Video Sync Issues
Desynchronized audio is one of the most common corruption symptoms. FFmpeg can correct the drift:
# Add a fixed audio delay (positive = delay audio, negative = advance audio)
ffmpeg -i desync_video.mp4 -itsoffset 0.5 -i desync_video.mp4 -map 0:v -map 1:a -c copy fixed.mp4
# Or re-encode with timestamp generation
ffmpeg -fflags +genpts -i desync_video.mp4 -c:v libx264 -c:a aac -af "aresample=async=1000" fixed.mp4
The aresample=async=1000 filter stretches or compresses the audio slightly to maintain sync with the video timestamps.

Step 5: Repair by Format
Different formats require different approaches. Here is a quick reference for the most common scenarios:
| Format | Best Repair Tool | Command / Method | Success Rate |
|---|---|---|---|
| MP4 (H.264) | FFmpeg or untrunc | ffmpeg -err_detect ignore_err -i input.mp4 -c copy output.mp4 | 80-90% |
| MOV | FFmpeg + untrunc | Same as MP4 (same container family) | 75-85% |
| AVI | DivFix++ or FFmpeg | ffmpeg -i input.avi -c copy -f avi output.avi | 70-80% |
| MKV | mkvtoolnix | mkvmerge -o output.mkv input.mkv | 85-95% |
| WebM | FFmpeg | ffmpeg -i input.webm -c copy output.webm | 75-85% |
| WMV | FFmpeg (re-encode) | ffmpeg -i input.wmv -c:v libx264 -c:a aac output.mp4 | 60-70% |
| FLV | FFmpeg | ffmpeg -i input.flv -c copy output.mp4 | 70-80% |
Preventing Video Corruption
Prevention is always better than repair. Here are the most effective strategies:
During Recording
- Use a reliable storage device -- Avoid cheap SD cards for important recordings
- Do not remove storage media during recording -- Always stop recording first
- Monitor available storage -- Running out of space during recording almost always corrupts the file
- Use cameras that write moov atom early -- Some cameras write periodic moov atom updates during recording
- Record in MKV if possible -- MKV's container structure is more resilient to recording interruptions
During Transfer
- Verify file integrity after transfer -- Compare file sizes and checksums
- Use reliable transfer methods -- Wired connections over wireless when possible
- Never interrupt a file copy -- Wait for the transfer to complete fully
- Use checksum verification -- Run
md5sumorsha256sumbefore and after transfer
# Generate checksum before transfer
sha256sum original_video.mp4
# Verify after transfer
sha256sum transferred_video.mp4
During Editing and Conversion
- Save frequently -- Use your editing software's autosave feature
- Export to a new file -- Never overwrite the original source file
- Use the right conversion settings -- Mismatched settings can cause subtle corruption. The quality preservation guide covers optimal settings in detail
- Convert to MP4 for maximum compatibility -- Use the MP4 converter to create universally playable files
When Professional Recovery Is Needed
Some corruption scenarios are beyond what free tools can handle:
- Physical storage damage -- Platter damage on hard drives, NAND failure on SSDs
- Encrypted or ransomware-locked files -- The file data itself has been modified
- Multiple layers of corruption -- Damaged during recording AND transfer
- Critical business or legal footage -- When the stakes are too high for DIY
Professional data recovery services can sometimes recover video from physically damaged storage by reading individual sectors and reconstructing the file structure. This is expensive (typically $500-$3,000) but may be the only option for irreplaceable footage.
Online Repair: When You Cannot Install Software
If you cannot install FFmpeg or other tools, online conversion can often fix minor corruption issues. When you upload a corrupted file to an online converter, the server-side processing effectively re-encodes the file, which can resolve:
- Missing or misplaced moov atoms
- Container metadata issues
- Minor index corruption
- Codec compatibility problems
Upload your file to the video compressor or use the MP4 converter -- the re-encoding process will create a clean, properly structured output file.
For batch repair of multiple files, the batch processing guide explains how to process many files efficiently.
Troubleshooting Common Repair Failures
"Moov atom not found" After Repair
This means the repair tool could not reconstruct the index. Try:
- Use
untruncwith a matching reference file - Try
recover_mp4as an alternative - Use
ffmpeg -fflags +genptsto generate timestamps
"Invalid data found when processing input"
The file may not actually be a video file, or it may be severely corrupted:
- Check with
file corrupted_video.mp4to verify the file type - Try
hexdump -C corrupted_video.mp4 | headto check the file header - If the header is wrong, the file extension may be incorrect
Repaired File Has Green or Black Frames
This indicates missing keyframes in the bitstream:
- Re-encode instead of stream copying:
-c:v libx264instead of-c copy - Add
-fflags +discardcorruptto skip damaged frames entirely - Accept that some data loss is unavoidable with bitstream-level corruption
Repair Creates a File but Duration Is Wrong
The timestamps need regeneration:
ffmpeg -fflags +genpts -i corrupted.mp4 -c copy -movflags +faststart fixed.mp4
Related Resources
If you are working with video files regularly, these guides will help you avoid corruption and work with video more effectively:
- How to Convert MOV to MP4 -- Converting Apple's format to universal MP4
- How to Convert AVI to MP4 -- Modernizing legacy AVI files
- Video Codecs Explained -- Understanding what is inside your video files
- How to Compress Video Without Losing Quality -- Reducing file size safely
- Video Bitrate Explained -- Understanding how bitrate affects quality and file integrity
Summary
Most corrupted video files can be repaired using free tools. Start with the simplest approach -- re-encoding with FFmpeg -- and escalate to more specialized tools like untrunc or mkvtoolnix if needed. The most important thing is to work on a copy, diagnose the problem before attempting repairs, and prevent corruption in the first place by using reliable storage, complete transfers, and proper recording practices.
When in doubt, converting the file to a clean MP4 container with H.264 video and AAC audio is the most reliable recovery path. The re-encoding process effectively rebuilds the file from scratch, eliminating most container-level corruption.



