Repairing Corrupt DJI Video Files
Sometimes, if you accidentally power off your
(Phantom, Mavic, or Inspire)
before stopping video recording,
you'll be left with a file that's corrupt, and cannot be played.
The user manual advises:
"Keep or place the Micro-SD card back into the camera. Power cycle the camera and wait about 30 seconds for the video file to be restored."
This often works, but sometimes you'll still be left with a corrupt file.
This page explains the problem, and provides software that can be used to repair such a file.
This section assumes some knowledge of the MP4 file format. If you're interested only in
the software for repairing corrupt video files, you can skip this section.
Three basic kinds of corrupt file seem to be possible.
- Often, the corrupt video file looks like a proper MP4-format file; it begins with
'ftyp' and 'moov' atoms, followed by a 'mdat' ('movie data') atom.
Normally, this 'mdat' atom would contain raw video data (H.264 NAL units).
In a corrupt file, however, the 'mdat' atom instead contains new 'ftyp', 'moov', and 'mdat'
atoms. These new atoms make up a valid MP4 video file!
Therefore, the file can be repaired simply by skipping over the initial 'ftyp' and 'moov' atoms,
and the header for the 'mdat' atom, and copying the remaining data into a new file.
- Another type of corrupt file is also possible (especially after a crash). In this case, the
file does not contain any MP4-format data at all.
Instead, the file consists only of a sequence of raw H.264 NAL units, each preceded by a 4-byte size field.
(The first of these NAL units has a size of 2 bytes.)
In this case, we can repair the file, but the result will be a ".h264"-format file, not a MP4-format file.
The repaired file will be playable by the
VLC media player,
but might not be playable by other media players or video editors.
(The file can, however, be converted (transcoded) to a MP4-format file using software such as the
or converted (copied) to a MP4-format file using
"ffmpeg -c copy".)
- Another possibility is that the corrupt video file begins as a normal MP4-format file;
it begins with 'ftyp' and 'moov' atoms, followed by a 'mdat' ('movie data') atom that contains raw
However, the tail of the file - following the 'mdat' data - can be incorrect, perhaps because the
file was not 'finalized' properly.
In this case, because the file contains raw video data (inside the 'mdat' atom), we can repair
it just like the previous case - resulting in a '.h264'-format file.
Software for repairing a corrupt video file
The (command-line) application "djifix"
will repair a corrupt DJI video file.
Note that this software is intended only for repairing a corrupt video file
that was generated by the DJI
Phantom, Mavic, or Inspire
quadcopter; it is not general-purpose software
for repairing any video file.
Note also that video file must be the original file that came from your quadcopter's SD card; not a
file that was generated by some other 'repair' software.
Pre-built application binaries
For Mac OS X (64-bit)
- Download the file "djifix", and move it to your "Movies" folder.
- Also move the file that you want to repair into your "Movies" folder.
- Run the "Terminal" application (which you'll find in the "Utilities" folder, inside the "Applications" folder), then, in a Terminal window, type
chmod +x djifix
For Windows (32-bit)
- Download the file "djifix.exe", and move it to the same folder as the file that you want to repair.
- Run the Windows "Cmd" application (i.e., the command shell), and use the "cd" command to change to the folder that contains "djifix.exe" and the file that you want to repair.
- In the command shell, type:
(Current version: 2017-02-11)
If you have software development tools (a C compiler), you can compile the C program
(released under the GNU GPL).
To build the program,
and run (from a terminal or command window):
cc -O -o djifix djifix.c
If this program didn't work
If you have a file that this "djifix" software cannot repair, then please put it online and send the URL in an email to "djifix(at)live555.com".
(Note: please do not 'zip' the file before uploading it; video files are already
compressed, and do not need to be 'zip'ped.)
We'll take a look at your file, and see whether the software can be updated to repair it.
Note, however, that we cannot provide one-on-one assistance for this software 'for free'.
If you do not want to run the "djifix" software yourself (or do not know how to do so), then
we would be happy to look at your file and repair it for you;
once again, please put it online and send the URL in an email to "djifix(at)live555.com".
For this, we will charge a fee - but the fee will be refunded in full if your file turns out
to be one that the "djifix" software cannot repair.
We can also - as a service, on request - convert a repaired ".h264"-format file (playable by VLC) into a ".MP4"-format file that's playable by other media players.
(For this, we also charge a fee.)
Frequently-asked questions (FAQ)
The repaired video is missing the 'crash' at the very end. I want to see this. Can you recover this?
Unfortunately not. The "dijfix" software recovers all of the video that it finds in a file. However, the last few seconds of video might not have been written to the file - especially if the power to the camera was disconnected suddenly (e.g. during a crash). Apparently the camera+encoder buffers the last few seconds of video in volatile RAM before writing it to the (non-volatile) Flash storage.)
I ran the software, and it produced a 'repaired' file, but this file does not play. What's the problem?
If the 'repaired' file has a filename that ends with ".h264", then this file cannot be played by many media players.
VLC Media Player
should be able to play the file. If, however, it cannot, then it's probably because you chose
an incorrect video format code when the "djifix" software asked you to enter the video format. Try running "djifix" again, this time entering a different video format code when prompted.
If necessary, try each of the possible format codes, in turn, until you find the one that
If, however, the 'repaired' file has a filename that ends with ".mp4", but cannot be played, then
try running "djifix" a second time, this time on the 'repaired' file. This time, you will get a ".h264" file that can be played by
I ran the software, but it told me that the file
"appears to contain nothing but zeros or 0xFF! We cannot repair this file!".
What can I do about this?
The software means what it says.
Your file (for some reason) contains nothing but '0' bits (or nothing but '1' bits).
Obviously, it cannot be repaired.
(Imagine that you were given a book that contained pages that were all blank, or all black;
obviously, you could not expect to 'repair' it.)
I ran your software to repair my file, but when I played the repaired file with the VLC media player, the video was very jerky. What's the problem?
You may be running an old version of VLC.
Make sure that you download the latest version of VLC; available from
I'm on a Mac. When I tried running the pre-built "djifix" Mac OS X application binary, I got an "Illegal instruction" error. What's the problem?
You may be running an old version of Mac OS X. If you upgrade, you should be able to run the "djifix" application binary.
(Alternatively, if you have "Xcode" installed, you can build the application from source code, as described above.)
If you've found this software useful, please
what your repaired video(s) were worth to you.
Copyright Live Networks, Inc. All Rights Reserved
"djifix" is a trademark of Live Networks, Inc.