Repairing Corrupt Photo and Video Files: RAW, MP4, MOV and PSD
The file is there but will not open: this is repair, not recovery. Why files become corrupt, how repair differs from recovery, moov atom reconstruction in MP4 and MOV, the healthy reference file method, JPEG and RAW header repair, PSD layer corruption, truncated files and the limits of repair.
You come back from a wedding, slide the card into your computer, and the RAW files from a camera you trusted until this very moment will not open. The files are sitting right there, their sizes look correct, but the viewer says "file is corrupt" or shows you half an image filled with colored streaks. The same thing can happen with an MP4 video: the camera shut off mid recording, the file never got the chance to close, and now the player does not recognize it at all. This article is about exactly that situation, repairing corrupt media files that exist but will not open.
At DSET we have been doing data recovery from Hacettepe Teknokent in Ankara since 2003, and corrupt file repair comes across our bench far more often than people expect. There is an important distinction I want to make clear right at the start: this article is not about bringing back deleted files. If your files were deleted by accident, the card was formatted, or the recycle bin was emptied, we are talking about an entirely different process, file recovery. For that, our Photo and Video Recovery Guide and What Is Data Recovery and How Is It Done articles are the right starting point.
Repair is a different job. Here the file is physically present on the disk or card, its bytes are readable, but the internal structure, the arrangement that turns the file into an image or a video, has been broken. Our work is to rebuild that internal structure, to fill in the missing or wrong parts by looking at a healthy reference. In this article I will walk through, one by one and through an engineer's eyes, why files become corrupt, how repair differs from recovery, the moov atom logic in MP4 and MOV videos, JPEG and RAW structure, PSD layer corruption, and when repair simply is not possible.
Quick Answer
If a corrupt photo or video file is sitting on the disk but will not open, the first thing to do is leave the original file alone and make an exact copy first. All repair attempts are done on the copy, because a tool that fails can damage the file further and destroy the only chance you have. Repair means rebuilding the structure inside the file, that is the header information, the video container indexes (the moov atom in MP4 and MOV), and the image data layout. In most cases a healthy reference file shot on the same device is used to complete the missing structure of the corrupt file. If the file's actual image or frame data has been partly overwritten or is missing, a partial result may be obtained; if the data is entirely gone, repair is not possible. This process does not work on deleted files, that is an entirely different subject.
Why Files Become Corrupt
Behind almost every corrupt media file lies a write process that was cut short. When a camera or phone saves an image, it first writes the image data to the disk or card, and only at the very end writes the file's "closing" information, that is the header and the indexes. If that last step never happens, if the device shuts off, the battery dies, or the card is pulled, the file is left half finished. The data is there, but the map that makes it readable is not.
Let me list the causes we see most often. Interrupted write operations come first: a battery dying while recording video, a card being removed while recording is still running, a computer shutting off suddenly while a file is being copied. Bad sectors, especially on hard disks, make part of a file unreadable; the beginning of a file can be intact while the middle is unreadable. Failing memory cards are very common; cheap or counterfeit cards, cards that have seen too many write cycles, and electrically worn cards return data in a corrupted form. Partial transfers happen when the connection drops while copying a file from one device to another; perhaps only the first few megabytes of the file were copied.
To these we add file system inconsistencies, virus or ransomware interference, and sometimes faulty save behavior in applications themselves. If an image editor crashes while saving a PSD file, the file can be left in an invalid state. Whatever the cause, the result is the same: the file is physically present, but its internal layout is invalid. When the corruption is hardware related, for example when the disk has bad sectors, an intact image of the disk must be taken on the HDD Data Recovery side before moving to file repair, because reading a failing disk over and over can finish it off completely.
The Difference Between Repair and Recovery
This distinction is the foundation of choosing the right method, so let me be precise. Recovery deals with situations where the file's reference has been deleted or lost. When you delete a file, the operating system usually does not erase the data immediately; it only marks that area as "free." Recovery tools scan the disk or card and, based on known file signatures (for example the opening bytes of a JPEG), find and reassemble files in these apparently free areas. Here the file itself is not corrupt, the file system simply no longer recognizes it.
Repair, on the other hand, deals with situations where the file's reference is in place, the file is readable, but its internal structure is invalid. Here we are not trying to find the data, the data is already in hand; we rearrange the bytes and rebuild the missing structural information. Let me make an analogy: recovery is finding a book that was thrown out of the library by mistake, fishing it out of the trash, and putting it back on the shelf. Repair is rebinding a book whose pages got shuffled, whose cover came off, and whose table of contents was torn out, putting the pages back in the right order.
In practice these two processes sometimes overlap. When you recover data from a failing card, some of the recovered files may come out complete and some corrupt; then you recover first and repair the corrupt ones afterward. But mixing the methods is a mistake. Running a recovery tool on a corrupt but present file usually does nothing, because the "lost" state the tool is looking for does not exist. Conversely, running a repair tool on a genuinely deleted file is futile, because there is no structure yet to repair. The right diagnosis determines the right treatment.
Always Work on a Copy, Never the Original
I want to write this in bold because the most destructive mistakes we see in the lab come from here: never touch the original file, do all work on a copy. Repair tools write to the file; they change the header, rearrange the bytes, save the file anew. If a tool makes a wrong guess, or its algorithm does not expect that particular kind of corruption, it can take the file from a bad state into an even worse one. If you are working on your original file, there may be no way back.
The correct workflow is this. First, take an exact image of the card or disk holding the corrupt file, at the block level if possible. If the card is physically worn, imaging the whole card sector by sector is far safer than copying files one at a time, because every read attempt can damage a worn card further. Then produce working copies from this image or copy. Use a fresh copy for each repair attempt; if a tool corrupts the file, do not stack a new attempt on top of the bad output, start over from a clean copy.
In the lab we never operate directly on the original media a customer brings in. The first job is to take a safe image of that media and set the original aside, untouched. All attempts are made on the image. This discipline ensures that you can always return to square one when an attempt fails. So apply the same rule even when you are trying things yourself: copy first, then attempt.
Video Repair: MP4 and MOV with the moov Atom
Video files are more fragile than photos because their structure is more complex and far more exposed to corruption during recording. The MP4 and MOV formats both rest on the same basic architecture, made up of nested data blocks called "atoms" or "boxes." The most critical of these blocks is the moov atom. The moov atom is the map of the video: it holds which frame sits where in the file, the frame rate, the resolution, how the audio and video streams are to be decoded, and all the metadata the player needs to assemble the video. The actual image and audio data lives in the mdat atom, the media data block.
Here is the crucial point: many cameras write the moov atom at the very end of the file, after the whole recording is finished. Because some of the information the camera will write into that map is not yet known until the video shoot ends. So if the battery dies during a recording or the card is pulled, the file holds an enormous mdat (the actual image data) but the moov atom was never written. The result is a file carrying gigabytes of real video data that the player calls "not a video." The images are there, only the map that tells how to decode them is missing.
This is exactly where the healthy reference file method comes in, and it is the heart of video repair. We take a healthy video shot on the same camera or phone, with the same settings (same resolution, frame rate, codec). The moov atom of this healthy file is structurally almost identical to that of the corrupt file, because the same device encoded in the same way. Repair amounts to taking the moov atom structure of this healthy file and adapting it to the mdat data of the corrupt file: the offsets are recalculated according to the size of the corrupt file, the frame indexes are rebuilt, and the missing map is thus regenerated. This is why we ask our customers to bring along, together with the corrupt video, any healthy video shot on the same device; that reference directly determines the success of the repair.
It is critical that the reference file genuinely comes from the same device with the same settings. A reference shot at a different resolution or with a different codec produces a wrong map, and the repaired video either does not play at all or shows broken colors, skewed images, and audio out of sync. With the MOV format, especially on professional cameras, the same logic applies; QuickTime based MOV and MP4 come from the same atom family, so reference based repair works on both.
JPEG and RAW Header and Structure Repair
Let us move to the photo side. A JPEG file is structured as header information (dimensions, encoding tables, EXIF metadata) followed by compressed image data. JPEG corruption is usually of two kinds. The first is corruption of the header or the compression tables (the Huffman and quantization tables); in this case, even if the image data is intact, the decoder cannot open it, because the table carrying the decoding rules is invalid. The second is corruption of the image data itself from some point onward; in this case the top part of the photo comes out fine, and from a certain line down it turns into gray or colored streaks. The reason is that JPEG is decoded as a stream: data corrupted at one point breaks the synchronization of every line after it.
When the header or tables are corrupt, the reference file logic applies to JPEG repair as well. The tables of a healthy JPEG shot on the same camera with the same quality setting are transferred into the corrupt file, making the image data decodable again. If the image data itself is corrupt from a certain point on, the part up to that point can be salvaged; the rest cannot be brought back if it is physically gone.
RAW files are more complex because each manufacturer uses its own format: Canon CR2 and CR3, Nikon NEF, Sony ARW, Fujifilm RAF, and so on. A RAW file actually carries the unprocessed data from the sensor along with, most of the time, an embedded JPEG preview and a wide metadata block. In RAW corruption, the file's structural header, the manufacturer specific directories (the image file directories called IFDs in TIFF based structures), and the sensor data itself can be affected separately. If only the header or directory is corrupt, the structure can be rebuilt using a healthy RAW file shot on the same camera as reference, and the file becomes openable. In some cases, even if the actual sensor data cannot be salvaged, the JPEG preview embedded inside the file can be extracted; this may not be at full resolution, but for some frames it is better than nothing. With photos taken on an iPhone and synced through iCloud, an entirely different scenario may be at play; for that case I recommend looking at our iCloud Data Recovery article.
PSD Layer Corruption and Truncated Files
Photoshop's PSD files have a different corruption profile from photos and videos because they are multilayered, complex structures. A PSD file contains the file header, the color mode information, the layer and mask section, and the composite image data. The most common PSD problem we see is corruption of the layer section while the composite preview data stays intact. This happens when the program crashes during a save or the file is written only halfway.
The good news is this: for backward compatibility, the PSD format usually stores a merged, flattened copy of all the layers at the end of the file. So even if the layer data is entirely corrupt, the flattened full image can often be salvaged. Bringing the layers back individually may not be possible, but extracting the final image as a single flattened layer succeeds in most cases. If only part of the layer section is corrupt, the intact layers can be recovered individually and only the corrupt ones are lost.
Truncated files are a separate category and appear in PSD, video, and RAW alike. A truncated file is one where only part of the size it should be exists; a transfer cut short or a card that becomes unreadable past a certain point is the typical cause. Say a RAW file that should be 80 MB has only 30 MB copied. In this case you cannot bring back the part of the file that does not exist, because that data is physically not there. But the part that does exist is often useful: the first half of a JPEG gives the top half of an image, the first section of a video can be made to play the first few minutes. With truncated files, the goal is to make the most of what exists, not to try to bring back what does not.
When Repair Is Not Possible
Being honest is the most important part of this work, so let me say it plainly: not every corrupt file can be repaired. The only thing that determines whether repair is possible is whether the actual image or frame data is physically there. Structural information, headers, indexes, the moov atom, all of these can be rebuilt from reference files. But if the actual content data is gone, there is nothing to rebuild.
The typical situations where repair is not possible are these. Overwritten data: if the file's image data section has been overwritten with other data, that original content is gone. If a card was formatted and new recordings were made on top of it, the actual data of the old files may genuinely be erased. Heavy encryption or ransomware: if ransomware encrypted the files, this is not corruption but a deliberate transformation, and it cannot be reversed without the key. Severely truncated files: if only the header part of the file exists and the actual content is gone, there is no image or frame to extract. Completely unreadable physical media: if the card or disk is so physically worn that the data cannot be read at all, there is a hardware recovery problem before any repair.
Our approach in the lab is never to promise something we cannot deliver. After examining a file, we see how much real image data inside it is intact and give you an honest assessment. If a partial result is possible we say so; if it is not, we do not want you paying a fee for nothing. For a full diagnosis we need to examine the file itself, because two files can look identical from the outside yet hold entirely different kinds of corruption inside.
Mobile and Camera Card Scenarios
In practice, the vast majority of corrupt media cases that reach us come from two sources: memory cards and mobile devices. Each has its own traps.
Camera cards are the source we encounter most often. The typical scenario is the battery dying while recording video or the card being removed while recording is still running; this leads to the missing moov atom we described earlier. Another common scenario is the card giving a "file system damaged" warning and the camera showing some files as corrupt. Here the golden rule is not to panic and format the card in the camera. A format rebuilds the file system and can seriously reduce the recovery and repair chances you have. Take the card out, enable write protection if possible, and bring it for a professional assessment without writing any new data to it. If you keep shooting, you take the risk of writing new photos over corrupt but recoverable files.
On mobile devices the situation is a little different because modern phones store photos and videos in a more protected but harder to access structure. When a video recording on a phone is cut short or an app saves a file corrupt, the same repair logic applies; a healthy reference video shot on the same phone is used to rebuild the moov atom structure of the corrupt file. An extra layer with phone photos is cloud synchronization; even if a photo looks corrupt on the phone, an intact copy may exist in the cloud, so cloud backups should always be checked.
In both scenarios the most critical step is the same: stop writing new data to the media holding the corrupt data and take a copy first. Continuing to use the card, taking new photos on the phone, raises the risk of overwriting corrupt but recoverable content with every passing minute. The moment you have doubt, stop, set the media aside, and talk to us through Contact or look at the right solution for you on our Services page.
FAQ
Is repairing a corrupt file the same as recovering a deleted file?
No, these are two different processes. Repair is rebuilding the internal structure of a file that exists on the disk but will not open; the data is already there, only its layout is broken. Recovery is finding and reassembling a deleted or lost file from the disk or card. If your files were deleted, repair tools do nothing, recovery is needed; if the file is present but will not open, repair is needed, not recovery.
Why do you ask for a healthy file from the same camera to repair a corrupt video?
Because the moov atom, the map needed to play MP4 and MOV videos, is often never written in the corrupt file. A healthy video shot on the same camera with the same settings has a structurally almost identical moov atom. We take this healthy structure as reference, adapt it to the image data of the corrupt file, and rebuild the missing map. Without a reference file, guessing this structure correctly is much harder.
I am told not to try things on the original file, why is this so important?
Because repair tools write to the file and a wrong attempt can take the file from its current state into an even worse one. If you are working on your original file, there may be no way back after a failed attempt. Always make an exact copy first, do all attempts on the copy, and start each new attempt with a clean copy. This preserves the only chance you have in case of failure.
Only half the file was copied, can you bring back the rest?
No, we cannot bring back data that does not exist; this is physically impossible. In a truncated file, the part that was not copied is not there, and no software can regenerate it. However, the part that does exist is often useful: the top half of a photo, the first minutes of a video can be salvaged. The goal is to make the most of the available data.
Can every corrupt file be repaired?
No. For repair to be possible, the actual image or frame data must be physically there. Structural information can be rebuilt from a reference, but if the content data was overwritten, encrypted by ransomware, or never copied, there is nothing to bring back. We examine every file and give an honest assessment of how much is recoverable, and we do not promise something we cannot deliver.
Conclusion
A corrupt photo or video, though it may look lost at first glance, often still carries most of the valuable data inside it. What matters is choosing the right process, that is repair, protecting the original file, and providing a healthy reference file from the same device where possible. The moov atom can be rebuilt, JPEG and RAW headers can be repaired, flattened images can be extracted from PSDs; the one requirement for all of this is that the actual content data is there.
Since 2003, from Hacettepe Teknokent in Ankara, we have been dealing with exactly these kinds of files, and we begin every case with an honest diagnosis. If you have a photo, video, RAW, or PSD file that will not open, reach out to us before you try things on it. Stop using the card or disk, set the media aside, and get in touch with us through our Contact page. We can tell you clearly which data is recoverable, and you can review the entire process on our Services page.
References
Kimliğinizi doğrulayın
Yetkilendirilmiş erişim alanı. Tüm giriş denemeleri kayıt altına alınır.