Une version française de ce fichier README est disponible : README_fr.md
A French version of this README is available: README_fr.md
This Python script calculates the total duration of media files (video/audio) in a directory and estimates the total processing time. It was created to help estimate the total duration of daily/rush footage on a hard drive. The project was renamed from FileSizeTreeChecker to MediaDurationRecursiveChecker to better reflect its purpose.
- Supports common media formats:
.mp3
,.mp4
,.avi
,.mkv
,.mov
,.wav
,.flac
- Recursively scans directories
- Excludes hidden files (those starting with '.')
- Provides:
- Total number of media files
- Total size in GB
- Total duration of all files (and estimation every 10 files)
- Verbose output with individual file durations
- Results optionally saved to JSON file
- Python 3.6+ (only tested on 3.8 and 3.11)
moviepy
(for media duration extraction)pyperclip
(to handle copying and pasting the path)
You have two options to run MediaDurationRecursiveChecker:
- Install required Python packages:
# On macOS:
sudo python3 -m pip install moviepy pyperclip
# On other platforms:
pip install moviepy pyperclip
- Ensure
ffmpeg
is installed on your system - Run the script:
python MediaDurationRecursiveChecker.py
- Use the graphical interface to select folders and process files
If you prefer to build it yourself:
- Install PyInstaller:
pip install pyinstaller
- Build the executable:
pyinstaller --onefile --name MediaDurationRecursiveChecker MediaDurationRecursiveChecker.py --noconsole --hidden-import=imageio_ffmpeg
- The executable will be in the
dist
directory
Note: This has been tested to work on macOS 11 when using the command:
sudo pyinstaller --onefile --windowed --name MediaDurationRecursiveChecker MediaDurationRecursiveChecker.py --clean
A pre-compiled .app for macOS is available in the 1.0.1 release.
Found 1234 media files (456.78 GB)
Processing files: 100%|████████████████████| 1234/1234 [12:34<00:00, 1.23it/s]
Current: 12h 34m | Estimated total: 15h 30m
Total duration: 15h 30m
Results saved to media_durations.json
The output JSON file contains:
{
"/path/to/file.mp4": {
"duration": 3600, // in seconds
"size": 1048576 // in bytes
},
...
}
- Files are processed in random order to provide better time estimates
- The script handles errors gracefully, skipping files it can't process