An awesome friend of mine needed some help to repair a video he recorded with Photo Booth (I know…my first line of advice was to never do that again).
As he was recording his video, his laptop shut off in the middle of the recording. When he woke his computer again, he was able to continue recording as if nothing was amiss. However, when he proceeded to export the video, that’s when things went awry—the video refused to play. While the file he exported was >6 GBs, the video refused to play in VLC or QuickTime.
When I ran the video file through exiftool
, I got this output:
ExifTool Version Number : 13.10
File Name : corrupt.mov
Directory : .
File Size : 6.6 GB
File Modification Date/Time : 2025:02:04 17:02:20-05:00
File Access Date/Time : 2025:02:04 17:02:20-05:00
File Inode Change Date/Time : 2025:02:04 21:58:05-05:00
File Permissions : -rw-r--r--
File Type : MOV
File Type Extension : mov
MIME Type : video/quicktime
Major Brand : Apple QuickTime (.MOV/QT)
Minor Version : 0.0.0
Compatible Brands : qt
Media Data Size : 6617114676
Media Data Offset : 36
No codec, no readability. So I continued the interrogation of the corrupt file with ffmpeg
. Claude Sonnet 3.6 helped produce key ffmpeg
diagnostic commands to analyze the video problems:
- Basic file information and error report:
ffmpeg -v error -i video.mov
- Detailed stream information (resolution, codec, etc):
ffprobe -show_format -show_streams -print_format json video.mov
- Check for container/file corruption:
ffmpeg -v error -i video.mov -f null - 2>&1
- Analyze frame types and keyframes:
ffprobe -select_streams v -show_frames -show_entries frame=pict_type -of csv video.mov
- Check timestamps and packet data:
ffmpeg -i video.mov -f null - -v debug 2>&1 | grep -i "pts"
- Analyze all packets in detail:
ffprobe -show_packets video.mov
- Detailed debug information:
ffmpeg -v debug -i video.mov 2>&1
Once I ran those commands, I quickly came across my issue:
ffmpeg version 7.1 Copyright (c) 2000-2024 the FFmpeg developers
built with Apple clang version 16.0.0 (clang-1600.0.26.4)
configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/7.1_4 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags='-Wl,-ld_classic' --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon
libavutil 59. 39.100 / 59. 39.100
libavcodec 61. 19.100 / 61. 19.100
libavformat 61. 7.100 / 61. 7.100
libavdevice 61. 3.100 / 61. 3.100
libavfilter 10. 4.100 / 10. 4.100
libswscale 8. 3.100 / 8. 3.100
libswresample 5. 3.100 / 5. 3.100
libpostproc 58. 3.100 / 58. 3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x13fc04850] moov atom not found
[in#0 @ 0x60000150ca00] Error opening input: Invalid data found when processing input
Error opening input file corrupt.mov.
Error opening input files: Invalid data found when processing input
Thanks to some helpful Reddit threads, I was able to use untrunc
to get the video repaired. Unfortunately, the current instructions as it stands didn’t compile on my MacBook Pro M1 Pro directly. Here are my updated instructions to get the app to compile.
Step 1: Install Required Software
- Open Terminal (find it in Applications > Utilities or use Spotlight search)
- Install Homebrew (if you don’t have it) by pasting this command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Install the required dependencies:
brew install ffmpeg yasm
Step 2: Download and Build Untrunc
- Download Untrunc by running:
git clone https://github.com/anthwlock/untrunc
cd untrunc
- Build the program:
export PKG_CONFIG_PATH="/opt/homebrew/lib/pkgconfig"
CPPFLAGS="-I/opt/homebrew/include" LDFLAGS="-L/opt/homebrew/lib" make
Step 3: Prepare Your Files
- Get a working reference video. In my case, I just recorded a fresh video on Photo Booth, exported it (I only recorded 30 seconds) and then used it as my reference.
- Note the exact location of both your corrupted video and a working reference video.
- For easiest use, copy both files to the untrunc folder you just created
- Make sure both files have simple names without spaces (e.g., rename “Corrupted Video.mov” to “corrupted-video.mov”)
Step 4: Run Untrunc
- If your files are in the untrunc folder, use:
./untrunc working-video.mov corrupted-video.mov
- If your files are elsewhere, use full paths:
./untrunc /path/to/working-video.mov /path/to/corrupted-video.mov
Initial Analysis
First, analyze the corrupted file using untrunc’s information command:
./untrunc -i working-video.mov corrupted-video.mov
Basic Recovery Attempts
- Simple Recovery
./untrunc working-video.mov corrupted-video.mov
- Skip Unknown Sequences
./untrunc -s working-video.mov corrupted-video.mov
- You may run into an issue where only a few seconds of the video gets fixed. To try and bypass this, go ahead and skip unknown sequences in the footage by adding the
-s
flag like so:
./untrunc -s working-video.mov corrupted-video.mov
What to Expect
- Be patient as the video is re-encoding on your computer. You should expect to see output like this:
Info: version 'v5-13cafed' using ffmpeg '7.1' Lavc61.19.100
Info: reading working-ashraf-file.mov
Info: parsing healthy moov atom ...
Composition time offset atom found. Out of order samples possible.
Sample dependency flag atom found. I and P frames might need to recover that info.
Info: reading mdat from truncated file ...
Info: using 64-bit offsets for the broken file
Warning: NOT skipping titl atom: 3535283770 (at 0x24adb92 / 0x24adbb6)
Warning: NOT skipping hnti atom: 2553088343 (at 0x3971430 / 0x3971454)
Warning: NOT skipping stsh atom: 1777973038 (at 0x5e2d4c6 / 0x5e2d4ea)
Warning: NOT skipping dpnd atom: 3165969420 (at 0xcf1c0a9 / 0xcf1c0cd)
...
Warning: guessed frame durations of 'avc1' will probably be wrong!
Info: Found 18 packets ( mp4a: 0 avc1: 18 avc1-keyframes: 1 )
Info: Duration of mp4a: (0 ms)
Info: Duration of avc1: 615ms (615 ms)
Warning: Unknown sequences: 5
Warning: Bytes NOT matched: 5.86GiB (95.05%)
Info: pruned empty 'mp4a' track
Info: saving corrupted-video.mov_fixed.mov
2 warnings were hidden!
- The repaired file will be saved as
[your-corrupted-filename]_fixed.mov
- The process may show warnings about codecs or frame durations
- Not all files can be fully recovered; success depends on the type and extent of corruption
Advanced Techniques
Step Size Variations
Try different step sizes based on frame patterns:
./untrunc -s -dcc -st 32 working-video.mov corrupted-video.mov
./untrunc -s -dcc -st 29 working-video.mov corrupted-video.mov
./untrunc -s -dcc -st 15 working-video.mov corrupted-video.mov
Range-Based Recovery
Attempt to recover specific portions:
./untrunc -s -dcc -range 0:673227 working-video.mov corrupted-video.mov
./untrunc -s -dcc -range 28:47559853 working-video.mov corrupted-video.mov
Combined Options
Try multiple options together:
./untrunc -s -dcc -st 15 -mp 1116675 working-video.mov corrupted-video.mov
./untrunc -sm -v -k -dcc working-video.mov corrupted-video.mov
Metadata Analysis
Use verbose logging to understand file structure:
./untrunc -lsm -v working-video.mov corrupted-video.mov
Troubleshooting Tips
- If you get permissions errors, run:
chmod +x untrunc
- If you get path errors, make sure you’re in the correct directory:
cd ~/path/to/untrunc
- If the build fails, try using system ffmpeg:
make USE_SYSTEM_FFMPEG=1
No dice, no frames
As for my friend’s video, unfortunately, the video refused to recover, no matter how many different incantations I used on the command line.
I tried switching to different apps like photorec
and even directly reading the file by using dd
and then parsing it in ffmpeg
. No dice. I used Stellar Repair for Video’s trial in my virtualized Windows environment to see if I could get it to work. And, it also didn’t work. Fix.video has been slow and has had no fix either to show for it either.
So yeah, don’t use Photo Booth to record videos. QuickTime Player works just fine.