How to Fix Corrupted Video Files: Repair & Recovery Guide
Learn how to repair corrupted video files that won't play, have no audio, or show visual glitches. Step-by-step recovery methods for MP4, MOV, AVI, and MKV using free and professional tools.

Learn how to repair corrupted video files that won't play, have no audio, or show visual glitches. Step-by-step recovery methods for MP4, MOV, AVI, and MKV using free and professional tools.

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.

Before you can fix a corrupted video, it helps to understand how video files work. Every video file consists of two main components:
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.
| 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 |
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.
ffprobe -v error -show_format -show_streams corrupted_video.mp4
This command outputs detailed information about the file structure. Look for:
N/A or 0, the moov atom or index is missingh264, aac)0 or N/A suggests metadata corruptionFor a more detailed error analysis:
ffprobe -v verbose -show_error corrupted_video.mp4 2>&1 | head -50
Run through these checks before attempting any repair:
file command on Linux/Mac or check with a hex editorPro 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.

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.
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.
VLC has a built-in repair feature:
VLC can also fix AVI files specifically:
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.
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.
For files where no reference is available:
# recover_mp4 attempts to reconstruct without a reference
recover_mp4 corrupted_video.mp4 repaired.mp4
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.
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.
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.
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.

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% |
Prevention is always better than repair. Here are the most effective strategies:
md5sum or sha256sum before and after transfer# Generate checksum before transfer
sha256sum original_video.mp4
# Verify after transfer
sha256sum transferred_video.mp4
Some corruption scenarios are beyond what free tools can handle:
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.
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:
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.
This means the repair tool could not reconstruct the index. Try:
untrunc with a matching reference filerecover_mp4 as an alternativeffmpeg -fflags +genpts to generate timestampsThe file may not actually be a video file, or it may be severely corrupted:
file corrupted_video.mp4 to verify the file typehexdump -C corrupted_video.mp4 | head to check the file headerThis indicates missing keyframes in the bitstream:
-c:v libx264 instead of -c copy-fflags +discardcorrupt to skip damaged frames entirelyThe timestamps need regeneration:
ffmpeg -fflags +genpts -i corrupted.mp4 -c copy -movflags +faststart fixed.mp4
If you are working with video files regularly, these guides will help you avoid corruption and work with video more effectively:
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.
Marcus Rivera
Systems engineer writing about video transcoding, hardware acceleration, and large-scale media processing.