videoexiftool

ExifTool warning: "Skipping 'moov' atom > 32 MiB" when calculating total MP4 duration


I'm trying to calculate the total duration of multiple .mp4 files using exiftool. The command I’m using successfully outputs the total duration, but I receive the following warning for one of the larger video files:

exiftool -n -q -p '${Duration;our $sum;$_=ConvertDuration($sum+=$_)}' *.mp4 | tail -n 1

Warning: [Minor] Skipping 'moov' atom > 32 MiB - Large_video_file_1GB_and_9Hours_720p.mp4
13:04:10

It seems that exiftool is skipping the 'moov' atom in this specific file because it's larger than 32 MiB. The file here is long (almost 9 hours) and is a high-resolution educational video (~1GB). Interestingly, other MP4 files that are also larger than 1GB don’t trigger this warning and are processed correctly because the duration is less than 9 hours.


My questions are:

  1. Is there a way to make ExifTool handle 'moov' atoms larger than 32 MiB?
  2. If not, what is the alternative tool or method can I use to reliably calculate the total duration of all my MP4 files, including large ones?

I need to include all videos, especially any long files in the total duration calculation.


System Information:
OS:

NAME="Linux Mint"
VERSION="22 (Wilma)"
ID=linuxmint
ID_LIKE="ubuntu debian"
PRETTY_NAME="Linux Mint 22"
VERSION_ID="22"
VERSION_CODENAME=wilma
UBUNTU_CODENAME=noble
-------------
- CPU: quad core Intel Core i7-6820HQ (-MT MCP-) speed/min/max: 800/800/2700 MHz
- Kernel: 6.8.0-57-generic x86_64 Up: 5h 34m Mem: 5.53/15.47 GiB (35.7%)
- Storage: 476.94 GiB (88.5% used) Procs: 345 Shell: Zsh inxi: 3.3.34

ExifTool version: 12.76


Solution

  • To handle large MP4 files with moov atoms greater than 32 MiB (which ExifTool skips by default), you can use the following command:

    exiftool -m -api LargeFileSupport=1 -n -q -p '${Duration;our $sum;$_=ConvertDuration($sum+=$_)}' *.mp4 | tail -n 1
    

    This worked for me, it is now calculating the real duration and resolved the warning:

    Warning: [Minor] Skipping 'moov' atom > 32 MiB
    

    Credit: This solution was suggested by StarGeek in the comments. Updating to the latest version of ExifTool is also recommended.